AI知识库

53AI知识库

学习大模型的前沿技术与行业应用场景


揭开Agentic神秘面纱:吴恩达的翻译新思路
发布日期:2024-06-27 03:25:00 浏览次数: 1857



其实在发表这个观点之前,吴恩达老师还专门做了一个Agentic的翻译工作流,用来更好地解释什么是Agentic。

这篇文章,就结合公开的核心代码,讲解一下什么叫做Agentic工作流以及这个过程中最重要的是什么。

TL;DR

  • Agentic翻译工作流,通过引入反思改进两个步骤来优化翻译结果,使其比单纯的直译更为智能和有效
  • 这种工作流可以看作是一种结构化的提示工程,依赖对业务流程的深入理解来构造有效的提示词,从而优化大模型的输出结果

代码分析

吴老师公开的这个小项目真的很小,核心代码就一个文件——src/translation_agent/utils.py,虽然这个文件有近700行,但是简单看下,就只有12个函数。这12个函数,可以按照下面来分析:

  • 8个函数是具体的翻译流程,共处理长短不同的翻译原文这两情况
  • 2个函数是辅助判断这两种情况;
  • 剩下的2个,1个是封装输入输出的主函数,1个是封装大模型调用的函数。

我们这里只分析下短文本的翻译流程,因为这是Agentic翻译工作流的重点:

  • 初次翻译(直译)
  • 反思(Reflect)
  • 改进(Improve)

这三个步骤,仅仅通过提示词的构造,便可以实现。
正是因为这个工作流中有了反思改进,才使得这个工作流比仅仅通过一个直译的工作流要更加Agentic。

紧接着,对于一个具体的任务,该如何让大模型对初始结果进行反思和改进?这就需要业务专家来制定了。我们来通过具体的提示词来说明。

unsetunset反思的关键提示词unsetunset

When writing suggestions, pay attention to whether there are ways to improve the translation's
(i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text),
(ii) fluency (by applying {target_lang} grammar, spelling and punctuation rules, and ensuring there are no unnecessary repetitions),
(iii) style (by ensuring the translations reflect the style of the source text and takes into account any cultural context),
(iv) terminology (by ensuring terminology use is consistent and reflects the source text domain; and by only ensuring you use equivalent idioms {target_lang}).

Write a list of specific, helpful and constructive suggestions for improving the translation.
Each suggestion should address one specific part of the translation.

可以看到,代码里着重强调了在直译基础上,增加对准确性流畅性风格术语方面的建议。当然,也许你在翻译某些领域的内容时,会有不同的建议,那你也可以仿照上面的形式,增加反思的点。

unsetunset改进的关键提示词unsetunset

Please take into account the expert suggestions when editing the translation. Edit the translation by ensuring:

(i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text),
(ii) fluency (by applying {target_lang} grammar, spelling and punctuation rules and ensuring there are no unnecessary repetitions), 
(iii) style (by ensuring the translations reflect the style of the source text)
(iv) terminology (inappropriate for context, inconsistent use), or
(v) other errors.

Output only the new translation and nothing else.

这里改进的关键词,则与反思中的建议一一对应,指引大模型按照上面的建议对直译的结果进行修改,并直接输出修改后的内容。

总结

通过这个简短的翻译例子,我们可以看到Agentic工作流其实可以看成是一种结构化的prompt工程,结构化具体的体现就是在原始的直接输出结果的prompt之上,通过引入反思和改进,来优化大模型完成具体任务的效果。而具体prompt的构造,则需要对业务流程的深入理解


53AI,企业落地应用大模型首选服务商

产品:大模型应用平台+智能体定制开发+落地咨询服务

承诺:先做场景POC验证,看到效果再签署服务协议。零风险落地应用大模型,已交付160+中大型企业

联系我们

售前咨询
186 6662 7370
预约演示
185 8882 0121

微信扫码

与创始人交个朋友

回到顶部

 
扫码咨询