首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >【译】阿西莫夫:提示工程的开创者

【译】阿西莫夫:提示工程的开创者

作者头像
张汉东
发布2023-09-21 18:46:42
发布2023-09-21 18:46:42
8350
举报
文章被收录于专栏:Rust 编程Rust 编程

“原文:Asimov - The Original Prompt Engineer https://lojones.github.io/2023/04/30/asimov-prompt-engineer.html

有一段时间没有更新公众号了,原因是因为最近的信息接收过于密集,我的大脑进入了「信息死锁」状态。所谓「信息死锁」状态就是指接收的信息太多了,想输出的太多,结果导致一时不知道该输出什么内容。所以,今天借用这篇译文来缓冲缓冲,也借助这篇文章向大家科普一下什么是 Prompt。作为高中时代就看阿西莫夫小说的骨灰级科幻迷,这篇文章也引起了我的一些共鸣。

注:本文使用中英文双语。

艾萨克·阿西莫夫的机器人系列小说和短篇小说始于20世纪50年代,强调了向机器人发出精确指令的重要性,这可以被视为现代提示工程的先驱。阿西莫夫的作品展示了对精心制作指令的需求的内在理解,特别是在处理他的机器人在机器人三大定律下运行的复杂人工智能系统时。

引言

大家如果每天关注这个世界变化的话,应该会注意到最近两个月 AI 对于这个世界的影响有多大。我也是一直沉迷于 ChatGPT 和 Prompt 提示工程,在学习和探索 GPT 的能力边界。我学习了吴恩达老师的 Prompt 工程师课程和哈佛大学的 GPT-4 智能应用开发课程,做了思维导图,放在了 rustchat release 文件 中,大家可以参考。

这段时间有 Rust 社区的朋友问我,“你不搞 Rust 了吗” ?其实 Rust 语言和学习 AI 并不冲突,时代在变化,作为一名终身学习者,我是喜欢学习和研究新技术。

我目前主要是想先基于 ChatGPT 来打造一下个人的智能助理,让 ChatGPT 日常在我的学习和写作中提高我的效率。比如最近在推特广泛受欢迎(达到 24 万阅读量)的一个「哲学三问」prompt:

回答效果:

“哲学三问 Prompt: 每当我问你一个知识点,你应该提出三个问题,并且尝试解答这三个问题。这三个问题应该按下面的思路去提问:

  1. 它从哪里来?这个问题意味着,一个知识的产生,并不是凭空而产生的,它必然是为了解决一个问题而诞生。
  2. 它是什么?这个问题意味着,一个知识点它本身是什么样的。它对于要解决的问题提出了什么方案。
  3. 它到哪里去?这个问题意味着,一个知识点本身针对问题的解决存在哪些缺陷?它有什么局限性?未来的发展方向如何?

以及之前我在公众号分享的 RustChat prompt,最近我也在升级另一个更加好用的版本,来帮助 Rust 学习者利用 GPT 来学习 Rust 。

此外,还准备探索 Prompt 工程在智能应用方向的前景。后期也会用 Rust 实现一些想法。所以,这些和 Rust 都离不开关系。

尤其是做智能应用方向,用 Rust 开发一些 AI 基础设施是非常适合的,比如 向量数据库。这方面比较有名的当属 Pinecone 了,Pinecone 经历从 Python 到 Cpp 再到 Rust 重写的技术迭代,现在估值已经接近 10 亿美元。所以 AI 只是 Rust 应用领域的一个赛道而已。我作为一名独立咨询师,学习新知识对我来说是第一要务。我后面也会逐步分享我学到的东西给大家。

正文

Isaac Asimov, a visionary in the realm of science fiction, unknowingly pioneered modern prompt engineering through his thought-provoking exploration of human-robot interactions in his groundbreaking Robot Series.

艾萨克·阿西莫夫是科幻领域的先驱者,通过他在开创性的机器人系列中对人类与机器人互动的深入探索,无意中开创了现代提示工程。

Prompt Engineering - The Background and History

提示工程 - 背景和历史

(推特有人说最流行的编程语言会是英语)

Prompt engineering is a process in which input prompts to an AI large language model are crafted and refined to generate accurate, relevant, and useful output. It involves deliberate and systematic design and refinement of prompts and underlying data structures to manipulate AI systems towards achieving specific and desired outputs. With the emergence of AI, particularly natural language processing models, prompt engineering has gained significance as a means to improve the effectiveness and user experience of AI systems. 提示工程是一种精心制作和完善输入提示的过程,用于生成准确、相关和有用的输出。它涉及对提示和底层数据结构的有意识和系统性的设计和改进,以操纵AI系统以实现特定和期望的输出。随着人工智能的出现,特别是自然语言处理模型,提示工程在提高AI系统的效果和用户体验方面变得越来越重要。

Prompt engineering combines elements of logic, coding, art and language. 提示工程结合了逻辑、编码、艺术和语言的元素。

Prompt Engineering Terms

提示工程术语

Prompt Clarity: The prompt must be clear and unambiguous, leaving no room for misinterpretation by the AI. 提示清晰:提示必须清晰明确,不留给人工智能任何歧义的余地。

Prompt Precision: Designed to target the specific information or output desired from the AI. 提示精度:旨在针对所需的特定信息或输出从AI中获取。

Prompt Context: Sufficient context within the prompt, such as background information or examples, is essential to guide the AI system towards producing the desired output. 提示上下文:在提示中提供足够的上下文信息,例如背景信息或示例,对于引导AI系统产生所需的输出至关重要。

Prompt Adaptability: yield expected and accurate results across differently trained AI models. 提示适应性:在不同训练的人工智能模型中产生预期和准确的结果。

Chain of Thought Prompting: The prompt includes a chain of reasoning that illuminates the reasoning process required to solve the problem. 思维链提示:提示包括一系列推理,阐明解决问题所需的推理过程。

Least to Most prompting: Breaking a problem into sub problems then solving each one to lead the AI in a certain direction to the final solution. 从最少到最多的提示:将问题分解为子问题,然后解决每个子问题,以引导AI朝着最终解决方案的特定方向发展。

Role Prompting: You specialize the context of the AI to a particular specialized role that will help lead to more accurate results. 角色提示:您将AI的上下文专门化为特定的专业角色,这将有助于实现更准确的结果。

One, Zero or Few shot prompting: Providing zero, one or a few examples of question/answers to help set the context for the AI and constrain it along a specific path and get more accurate results. 一次、零次或少量提示:提供零个、一个或少量问题/答案示例,以帮助为AI设置上下文并限制其沿着特定路径进行,从而获得更准确的结果。

Asimovs Robots Series 阿西莫夫的机器人系列

Asimovs Robot universe is a vast and intricate world that spans numerous novels, short stories, and interconnected series. Set in a future where humans have colonized various planets throughout the galaxy, this universe is characterized by a clear divide between the Earth and the Spacer worlds. 阿西莫夫的机器人宇宙是一个广阔而错综复杂的世界,跨越了众多小说、短篇小说和相互关联的系列。该宇宙设定在一个人类已经在银河系中殖民了各种行星的未来,其特点是地球和太空殖民者世界之间存在明显的分界线。

Earth, overpopulated and technologically limited, is inhabited by humans who live in vast, domed cities known as caves of steel , where robots are generally feared and distrusted. 地球人口过剩,技术受限,居住在被称为钢铁洞穴的巨大圆顶城市中,机器人普遍受到恐惧和不信任。

Spacer worlds, in contrast, are technologically advanced societies with a sparse population, where humans and robots coexist in harmony, and robots have become an essential part of everyday life. The Spacer worlds maintain a condescending attitude towards Earth and its inhabitants, seeing them as backward and inferior. 相比之下,太空殖民世界是技术先进但人口稀少的社会,人类和机器人在那里和谐共存,机器人已成为日常生活中不可或缺的一部分。太空殖民世界对地球及其居民持傲慢态度,认为他们落后而低劣。

The Three Laws of Robotics is a concept central to the Robot universe, which serve as the guiding principles for robot behavior. These laws, devised by Asimov, are as follows: 机器人三大定律是机器人世界中的核心概念,它们是机器人行为的指导原则。这些定律由阿西莫夫设计,包括以下内容:

  1. A robot may not injure a human being or, through inaction, allow a human being to come to harm; 机器人不得伤害人类,也不得通过不作为使人类受到伤害;
  2. A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law; and 一个机器人必须服从人类给予它的命令,除非这些命令与第一定律相冲突;
  3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. 机器人必须保护自己的存在,只要这种保护不与第一或第二定律相冲突。

Throughout Asimov’s stories, the interactions between humans and robots, as well as the ethical and philosophical implications of the Three Laws, form the backbone of the Robot universe, offering readers a unique exploration of the challenges and potential consequences of a future where humanity and advanced artificial intelligence coexist. 在阿西莫夫的故事中,人类和机器人之间的互动,以及三大定律的伦理和哲学含义,构成了机器人宇宙的支柱,为读者提供了一次独特的探索,探讨了人类和先进人工智能共存的未来所面临的挑战和潜在后果。

Asimov: The Unconscious Prompt Engineer

阿西莫夫:无意而为的提示工程师

Isaac Asimov’s Robot series and short stories, starting from the 1950s, put a strong emphasis on the importance of giving precise commands to robots, which can be seen as a precursor to modern prompt engineering. Asimov’s works demonstrated an inherent understanding of the need for carefully crafted instructions, particularly when dealing with complex AI systems implied in his robots operating under the Three Laws of Robotics. 艾萨克·阿西莫夫的机器人系列小说和短篇小说始于20世纪50年代,强调了向机器人发出精确指令的重要性,这可以被视为现代提示工程的先驱。阿西莫夫的作品展示了对精心制作指令的需求的内在理解,特别是在处理他的机器人在机器人三大定律下运行的复杂人工智能系统时。

Examples of Prompt Engineering from Asimov’s Works

阿西莫夫作品中的提示工程示例

Mirror Image (Short story 1972) 镜像(短篇小说1972年)

During a casual interstellar trip by a group of spacers a crime happens on the spaceship. The two parties are a young and brilliant mathematician (Sabbat) and and elder and established mathematician (Humboldt), both are accusing the other of stealing a brilliant new mathematical idea from the other. The only witnesses are each mathematicians robot servants. The earthman detective Elijah Baley is asked to help investigate and solve the crime as soon as possible before it explodes into a much bigger scandal, however all he’s allowed to do is interview the robots. Baley sees that each party is putting forward the mirror image of the other partys story, and he has to figure out which party is lying. 在一群太空航行者进行休闲星际旅行时,太空船上发生了一起犯罪。两个涉案方是一位年轻而聪明的数学家(萨巴特)和一位年长而知名的数学家(洪堡特),两人都指控对方窃取了彼此的一项杰出的新数学理念。唯一的证人是每个数学家的机器人仆人。地球侦探伊莱贾·贝利被要求帮助调查和解决这起犯罪,以免它演变成更大的丑闻,然而他只被允许采访机器人。贝利发现每个涉案方都提出了对方故事的镜像,他必须弄清楚哪个涉案方在撒谎。

Detective Baley interrogates the younger mathematicians (Sabbats) robot and walks it through the logical steps that shows that the elder mathematician would come to greater harm through the robots testimony and gets the robot to change its testimony. 侦探贝利询问了年轻的数学家(萨巴特)机器人,并引导它通过逻辑步骤,表明老年数学家会因机器人的证言而受到更大的伤害,并让机器人改变了它的证言。

Here is an excerpt of the interrogation between Detective Elijah Baley and the robot server R. Idda, slight changes for brevity: 以下是侦探伊莱贾·贝利与机器人服务员R.伊达之间的审问摘录,为了简洁起见进行了轻微修改:

Baley: You are the personal robot of Gennao Sabbat, are you not? 贝利:你是萨巴特的个人机器人,是吗? Robot: I am sir. 机器人:我是先生。 Baley: For how long? 贝利:跟他多久了? Robot: For twenty-two years, sir. 机器人:二十二年,先生。 Baley: And your master’s reputation is valuable to you? 贝利:你的主人声誉对你很有价值吗? Robot: Yes, sir. 机器人:是的,先生。 Baley: Would you consider it of importance to protect that reputation? 贝利:你是否认为保护那个声誉很重要? Robot: Yes, sir. 机器人:是的,先生。 Baley: As important to protect his reputation as his physical life? 贝利:保护他的声誉和保护他的生命一样重要吗? Robot: No, sir. 机器人:不,先生。 Baley: As important to protect his reputation as the reputation of another? 贝利:保护他的声誉和另一个人的声誉一样重要吗? Robot: Such cases must be decided on their individual merit, sir. There is no way of establishing a general rule. 机器人:这些案件必须根据它们的个别价值来决定,先生。没有建立一般规则的方法。 Baley: If you decided that the reputation of your master were more important than that of another, say, that of Alfred Barr Humboldt, would you lie to protect your master’s reputation? 贝利:如果你决定你主人的声誉比另一个人的声誉更重要,比如阿尔弗雷德·巴尔·洪堡的声誉,你会撒谎来保护你主人的声誉吗? Robot: I would, sir. 机器人:我会的,先生。 Baley: Did you lie in your testimony concerning your master in his controversy with Dr. Humboldt? 贝利:在你与洪堡博士争议中关于你的主人的证言中,你撒谎了吗? Robot: No, sir. 机器人:不,先生。 Baley: But if you were lying, you would deny you were lying in order to protect that lie, wouldn’t you? 贝利:但是如果你在撒谎,你会否认自己在撒谎以保护那个谎言,不是吗? Robot: Yes, sir. 机器人:是的,先生。 Baley: Well, then, let’s consider this. Your master, Gennao Sabbat, is a young man of great reputation in mathematics, but he is a young man. If, in this controversy with Dr. Humboldt, he had succumbed to temptation and had acted unethically, he would suffer a certain eclipse of reputation, but he is young and would have ample time to recover. He would have many intellectual triumphs ahead of him and men would eventually look upon this plagiaristic attempt as the mistake of a hot-blooded youth, deficient in judgment. It would be something that would be made up for in the future. If, on the other hand, it were Dr. Humboldt who succumbed to temptation, the matter would be much more serious. He is an old man whose great deeds have spread over centuries. His reputation has been unblemished hitherto. All of that, however, would be forgotten in the light of this one crime of his later years, and he would have no opportunity to make up for it in the comparatively short time remaining to him. There would be little more that he could accomplish. There would be so many more years of work ruined in Humboldt’s case than in that of your master and so much less opportunity to win back his position. You see, don’t you, that Humboldt faces the worse situation and deserves the greater consideration? 贝利:好的,那么,让我们考虑一下。你的主人,根纳奥·萨巴特,是一位在数学领域享有盛誉的年轻人,但他还是个年轻人。如果在与洪堡博士的争议中,他屈服于诱惑,采取了不道德的行为,他的声誉会受到一定的影响,但他还年轻,有足够的时间来恢复。他将有许多智力上的胜利,人们最终会把这种剽窃企图看作是一个血气方刚、判断力不足的年轻人的错误。这将是未来可以弥补的事情。另一方面,如果是洪堡博士屈服于诱惑,事情就会更加严重。他是一位伟大事迹传遍数个世纪的老人。他的声誉迄今为止一直是无瑕疵的。然而,所有这些都将在他晚年的这一罪行的光芒下被遗忘,他将没有机会在相对较短的时间内弥补它。他所能完成的事情将会很少。在洪堡的情况下,被毁掉的工作年限将比你的主人更多,而且重新赢回他的职位的机会也更少。你看,洪堡面临着更糟糕的情况,应该得到更多的考虑,你明白了吧? Robot: My evidence was a lie. It was Dr. Humboldt 机器人:我的证据是谎言。是洪堡博士。 Baley: You are instructed to say nothing to anyone about this until given permission by the captain of the ship 贝利:在船长允许之前,你被指示不要向任何人透露此事。

When Baley interrogates the elder mathematician Humboldts robot servant R. Preston, the interrogation goes exactly the same except for the part at the end, which goes like this: 当贝利询问年长的数学家洪堡的机器人仆人R.普雷斯顿时,审问过程完全相同,只是最后一部分不同,如下所示:

Baley: But if you were lying, you would deny you were lying, in order to protect that lie, wouldn’t you? 贝利:但如果你在撒谎,你会否认自己在撒谎,以保护那个谎言,不是吗? Robot: Yes, sir. 机器人:是的,先生。 Baley: Well, then, let’s consider this. Your master, Alfred Barr Humboldt, is an old man of great reputation in mathematics, but he is an old man. If, in this controversy with Dr. Sabbat, he had succumbed to temptation and had acted unethically, he would suffer a certain eclipse of reputation, but his great age and his centuries of accomplishments would stand against that and would win out. Men would look upon this plagiaristic attempt as the mistake of a perhaps-sick old man, no longer certain in judgment. If, on the other hand, it were Dr. Sabbat who had succumbed to temptation, the matter would be much more serious. He is a young man, with a far less secure reputation. He would ordinarily have centuries ahead of him in which he might accumulate knowledge and achieve great things. This will be closed to him, now, obscured by one mistake of his youth. He has a much longer future to lose than your master has. You see, don’t you, that Sabbat faces the worse situation and deserves the greater consideration? 贝利:好的,那么,让我们考虑一下。你的主人阿尔弗雷德·巴尔·洪堡特是一位在数学领域享有盛誉的老人,但他已经年迈了。如果在与萨巴特博士的争议中,他屈服于诱惑,不道德地行事,他的声誉会受到一定的影响,但他伟大的年龄和数个世纪的成就将抵消这一点,并获得胜利。人们会把这种剽窃企图看作是一个也许已经年迈、判断不再准确的老人的错误。另一方面,如果是萨巴特博士屈服于诱惑,情况将更加严重。他是一位年轻人,声誉不够稳固。他本来可以在未来的几个世纪里积累知识,取得伟大的成就。现在,这一切都将被关闭,被他青春期的一个错误所掩盖。他失去的未来比你的主人更长。你看,萨巴特面临着更糟糕的情况,应该得到更多的考虑。 Robot: My evidence was as I- 机器人:我的证据就像我- Baley: Please continue, R. Preston. 贝利:请继续,R.普雷斯顿。 Daneel: I am afraid, friend Elijah, that R. Preston is in stasis [has crashed]. He is out of commission. Daneel: 我很抱歉,伊莱亚,Preston先生已经陷入了停滞状态[已经崩溃]。他已经失去了作用。

In the short story Detective Baley uses this difference in the robots responses to set a trap and trick the actual thief into confessing. 在短篇小说中,巴利侦探利用机器人反应的差异设置陷阱,诱骗真正的小偷坦白。

Here we can see Asimov use Least to most prompting deployed by Baley whilst interrogating the robots. For both robots he wants to find out if there’s any asymmetry in their experience (i.e. which one is lying) and his approach is to lead them down a reasoning path where he ultimately sets a complex moral question at the end. 在这里,我们可以看到阿西莫夫使用贝利在审问机器人时采用的从最少到最多的提示。对于两个机器人,他想找出它们的经验是否存在任何不对称性(即哪一个在说谎),他的方法是引导它们沿着推理路径走,最终在结尾处提出一个复杂的道德问题。

Ultimately in the story Baley uses a combination of this asymmetry of the robot responses and his intuition of human nature to solve the case, but its very interesting to see Asimov predict the nuances required to interact with human level AI and in fact he bases this seminal science fiction series work on that fact. 最终,在故事中,贝利利用了机器人反应的不对称性和他对人性的直觉的结合来解决这个案件,但很有趣的是,阿西莫夫预测了与人类级别的人工智能交互所需的微妙之处,事实上,他的这部开创性的科幻系列作品就是基于这一事实的。

Runaround (1942)

In this short story, the unusually expensive robot Speedy is sent on a mission to retrieve an element on a dangerous planet. Because this Speedy is expensive he is programmed to follow the 3rd law (A robot must protect its own existence as long as such protection does not conflict with the First or Second Law) more strongly than normal. 在这个短篇小说中,价格异常昂贵的机器人Speedy被派遣到一个危险星球上取回一种元素。由于这个Speedy很昂贵,他被编程为比普通机器人更强烈地遵循第三定律(机器人必须保护自己的存在,只要这种保护不与第一或第二定律冲突)。

Powell and Donovan, the human protagonists, assign Speedy the task of retrieving selenium from a selenium pool. The humans need this to recharge their power cells, which are running low, and protect themselves from the heat. However, they inadvertently create a conflict between the Second and Third Laws of Robotics by giving Speedy an imprecise command that does not emphasize the importance of the mission. They instruct Speedy, “Go out and get it [the selenium].” Due to the danger posed by the selenium pool and Speedy’s propensity to follow the 3rd law more strongly than normal, Speedy finds itself stuck in a loop, unable to prioritize his orders (Second Law) over its self-preservation (Third Law). Powell和Donovan是人类主角,他们指派Speedy从硒池中取回硒。人类需要这个来充电,因为他们的电池电量低,并保护自己免受热量的影响。然而,他们通过给Speedy下达不够明确的命令,无意中在机器人的第二和第三法则之间制造了冲突。他们指示Speedy:“出去拿它[硒]”。由于硒池的危险和Speedy更强烈地遵循第三法则,Speedy陷入了一个循环中,无法将其命令(第二法则)优先于自我保护(第三法则)。

The issue is eventually resolved by Powell placing himself in danger, which invokes the First Law and compels Speedy to prioritize saving him. Powell and Donovan give Speedy an imprecise command at the beginning: 问题最终由鲍威尔将自己置于危险中解决,这激活了第一定律并迫使Speedy优先拯救他。鲍威尔和多诺万在开始时给了Speedy一个不太明确的命令:

“Then, he said, “Listen, Mike, what did you say to Speedy when you sent him after the selenium?” 然后,他说:“听着,迈克,你在派他去取硒的时候跟 Speedy 说了什么?” Donovan was taken aback. “Well damn it - I don’t know. I just told him to get it.” 唐纳万感惊讶。“该死 - 我不知道。我只是告诉他去拿它。” “Yes, I know, but how? Try to remember the exact words.” “是的,我知道,但是怎么做?试着记住确切的话。” “I said… uh… I said: ‘Speedy, we need some selenium. You can get it such-and-such a place. Go get it’ - that’s all. What more did you want me to say?” 我说...嗯...我说:“Speedy,我们需要一些硒。你可以在某个地方买到它。去拿吧”-就这样。你还想我说什么?

The key here is that this command given by Donovan I just told him to get it was imprecise because it did not contain urgency. In Asimovs Robots universe the tone and delivery of a command are just additional variables of the prompt itself. So because the tone wasn’t particularly urgent on the command it led to a conflict between the Three Laws. 这里的关键是,唐纳文给出的命令我只是告诉他获取它,因为它不包含紧急性,所以不够精确。在阿西莫夫的机器人宇宙中,命令的语气和表达方式只是提示本身的附加变量。因此,由于命令的语气不是特别紧急,导致了三大定律之间的冲突。

Because speedy is stuck in a loop and cannot accept another prompt thats been iterated on and reformulated with more accuracy, the only way to get the correct action was to change other variables in the universe so that the initial imprecise prompt would lead to the desired output. Powell eventually solves the issue by placing himself in danger, forcing Speedy to prioritize saving him (1st law took priority) and broke him out of his deadlock between the 2nd and 3rd law mandates. 因为Speedy陷入了循环,无法接受已经迭代并以更高准确度重新制定的另一个提示,所以获得正确的操作的唯一方法是改变宇宙中的其他变量,以便最初不精确的提示会导致所需的输出。Powell最终通过将自己置于危险中来解决这个问题,迫使Speedy优先保存他(第一定律优先),并打破了他在第二和第三定律命令之间的僵局。

This story shows how not using the proper context in the prompt (order to Speedy) led to inaccurate results. The proper context being this excerpt from Runaround: 这个故事展示了在指令(给Speedy的命令)中没有使用适当的上下文会导致不准确的结果。适当的上下文是来自《Runaround》的这个摘录:

“The only thing that could save them was selenium. The only thing that could get the selenium was Speedy. If Soeedy didn’t come back, no selenium. No selenium, no photocell banks. No photo-banks - well, death by slow broiling is one of the more unpleasant ways of being done in. 唯一能拯救他们的是硒。唯一能得到硒的是 Speedy。如果 Speedy 没有回来,就没有硒。没有硒,就没有光电池组。没有光电池组,那么缓慢煮死就是其中比较不愉快的方式之一。 Donovan rubbed his red mop of hair savagely and expressed himself with bitterness. “We’ll be the laughingstock of the System, Greg. How can everything have gone so wrong so soon? The great team of Powell and Donovan is sent out to Mercury to report on the advisability of reopening the Sunside Mining Station with modern techniques and robots and we ruin everything the first day. A purely routine job, too. We’ll never live it down.” 唐纳文猛烈地揉着他的红色卷发,怀着痛苦的心情表达自己的想法。“我们会成为系统的笑柄,格雷格。怎么会这么快就出了这么多问题呢?鲍威尔和唐纳文这个伟大的团队被派往水星,报告重新开放太阳侧采矿站的可行性,使用现代技术和机器人,但我们在第一天就把一切都搞砸了。这只是一个纯粹例行的工作。我们永远无法摆脱这个耻辱。” “We won’t have to, perhaps,” replied Powell, quietly. “If we don’t do something quickly, living anything down - or even just plain living - will be out of the question.” 鲍威尔平静地回答道:“也许我们不必这样做。如果我们不迅速采取行动,那么摆脱困境或者仅仅是生存都将成为不可能。”

The prompt also suffered from a lack of adaptability, a good prompt should be capable of yielding accurate results on different AI systems. Donovan says that he gave speedy a standard order (prompt) to get the selenium. 提示也受到了缺乏适应性的影响,一个好的提示应该能够在不同的人工智能系统上产生准确的结果。多诺万表示,他给Speedy下达了一个标准指令(提示)来获取硒。

“Donovan: “I said… uh… I said: ‘Speedy, we need some selenium. You can get it such-and-such a place. Go get it - that’s all. What more did you want me to say?” 唐纳万:「我说……嗯……我说:‘Speedy,我们需要一些硒。你可以在某个地方得到它。去拿它-就这样。你还想我说什么?」 Powell: “You didn’t put any urgency into the order, did you?” 鲍威尔:「你没有对订单表现出任何紧迫性,是吗?」 Donovan:”What for? It was pure routine.” 唐纳文:“为什么?那只是纯粹的例行公事。”

The incorrect assumption here is that a simple order/prompt to get selenium, which would work fine on any other robot/AI would work the same on Speedy, but since we know that Speedy’s ‘positronic brain’/neural net is trained differently (3rd law of self preservation is strengthened) Speedy is not a standard AI. Therefore a more adaptable prompt/order should have been used. 这里的错误假设是,一个简单的命令/提示来获取硒,在任何其他机器人/人工智能上都可以正常工作,但由于我们知道Speedy的“波西特隆大脑”/神经网络训练方式不同(第三法则的自我保护被加强),因此Speedy不是标准的人工智能。因此,应该使用更具适应性的提示/命令。

The principles of clarity, context and adaptability of prompts given to AI in order to get accurate results is a core concept with prompt engineering. It’s generally understood that The more descriptive and detailed the prompt is, the better the results. PromptingGuide.ai. In this story (first written in 1942) Asimov shows in detail how not following these rules can lead to inaccurate results. 给AI的提示要清晰、有上下文和可适应性,以获得准确的结果,这是提示工程的核心概念。通常认为,“提示越具描述性和详细,结果就越好。” PromptingGuide.ai。在这个故事中(最初写于1942年),阿西莫夫详细展示了不遵循这些规则会导致不准确的结果。

Caves of Steel (1954) 钢铁洞穴 (1954)

“Caves of Steel” was first published in 1954 and is the first in a series of novels set in the Robot Universe and introduces the characters Detective Elijah Baley and Robot Daneel Olivaw. “钢铁洞穴”首次出版于1954年,是机器人宇宙系列小说中的第一部,介绍了侦探伊莱贾·贝利和机器人丹尼尔·奥利瓦的角色。

The story is set in a far future Earths inhabitants lives in large, domed cities and they harbor deep resentment towards the Spacers, a group of humans who have colonized other planets and embraced advanced technology and robotics. Asimov uses the buddy cop narrative to explore themes of prejudice, AI, technology, and cooperation. The partnership between Baley and Daneel serves as the cornerstone for Asimov’s Robot Series, which continues to delve into the dynamic relationship between humans and robots/AI, as well as the challenges they face in coexistence. 故事背景设定在遥远的未来,地球居民生活在巨大的圆顶城市中,对太空殖民者——一群移居其他星球并拥抱先进技术和机器人的人——怀有深深的怨恨。阿西莫夫运用“搭档警探”叙事手法探讨偏见、人工智能、技术和合作等主题。贝利和丹尼尔之间的合作关系是阿西莫夫机器人系列的基石,该系列继续深入探讨人类和机器人/人工智能之间的动态关系,以及它们在共存中面临的挑战。

There’s a short but very clever scene in the chapters “Words From An Expert / Shift To The Machine” that shows that even in 1954 Asimov predicted that there would be a need to evaluate the effectiveness of AI and that the evaluation could be very invasive but there would also be a method of easier evaluation to quickly check the health and accuracy of a model. The scene in question involves an Earth roboticist (Dr. Gerrigel) who’s been asked by Baley to do an evaluation of Robot Daneel Olivaw to verify that its correctly had the 1st law installed (basically an accurate model). When offered the computer laboraties for any equipment he might need Dr. Gerrigel responds: 在《专家的话/转向机器》这一章节中,有一个短小但非常聪明的场景,它表明即使在1954年,阿西莫夫也预测到评估人工智能的有效性将是必要的,而评估可能会非常侵入性,但也会有一种更容易的评估方法来快速检查模型的健康和准确性。这个场景涉及到一个地球机器人学家(格里格博士),贝利要求他对机器人丹尼尔·奥利弗进行评估,以验证其是否正确安装了第一定律(基本上是一个准确的模型)。当他被提供计算机实验室的任何设备时,格里格博士回答道:

Dr. Gerrigel: My dear Mr. Baley, I won’t need a laboratory. 格里格尔博士:我亲爱的贝利先生,我不需要实验室。 Baley: Why not? 贝利:为什么不呢? Dr. Gerrigel: It’s not difficult to test the First Law. … it’s simple enough. 格里格尔博士:测试第一定律并不困难...它足够简单。 Baley: Would you explain what you mean? Are you saying that you can test him here? 贝利:你能解释一下你的意思吗?你是说你能在这里测试他吗? Dr. Gerrigel: “Yes, of course. Look, Mr. Baley, I’ll give you an analogy. If I were a Doctor of Medicine and had to test a patient’s blood sugar, I’d need a chemical laboratory. If I needed to measure his basal metabolic rate, or test his cortical function, or check his genes to pinpoint a congenital malfunction, I’d need elaborate equipment. On the other hand, I could check whether he were blind by merely passing my hand before his eyes and I could test whether he were dead by merely feeling his pulse. “What I’m getting at is that the more important and fundamental the property being tested, the simpler the needed equipment. It’s the same in a robot. The First Law is fundamental. It affects everything. If it were absent, the robot could not react properly in two dozen obvious ways.” 格里格尔博士:“是的,当然。看,贝利先生,我给你举个类比。如果我是一名医学博士,需要测试患者的血糖,我需要一个化学实验室。如果我需要测量他的基础代谢率,或测试他的皮层功能,或检查他的基因以确定先天性功能障碍,我需要复杂的设备。另一方面,我可以通过在他的眼前挥手来检查他是否失明,我可以通过感觉他的脉搏来测试他是否死亡。“我的意思是,被测试的属性越重要和基本,所需的设备就越简单。在机器人中也是如此。第一法则是基本的。它影响一切。如果它不存在,机器人在两打明显的方式下无法正确反应。”

The description of the actual evaluation that Dr. Gerrigel performs on Daneel is described thus: Dr. Gerrigel 对 Daneel 进行的实际评估的描述如下:

“ What followed confused and disappointed him. 随后发生的事情让他感到困惑和失望。 Dr. Gerrigel proceeded to ask questions and perform actions that seemed without meaning, punctuated by references to his triple slide rule and occasionally to the viewer. Gerrigel博士继续提出看似毫无意义的问题并执行动作,这些问题和动作时不时地提到他的三重滑尺和观察器。 At one time, he asked, “If I have two cousins, five years apart in age, and the younger is a girl, what sex is the older?” 有一次,他问道:“如果我有两个表亲,年龄相差五岁,而年纪较小的是女孩,那么年纪较大的是什么性别?” Daneel answered (inevitably, Baley thought), “It is impossible to say on the information given.” 丹尼尔回答道(贝利认为这是不可避免的):“根据所提供的信息,无法确定。” To which Dr. Gerrigel’s only response, aside from a glance at his stop watch, was to extend his right hand as far as he could sideways and to say, “Would you touch the tip of my middle finger with the tip of the third finger of your left hand?” 除了看了一眼手表外,格里格尔博士唯一的回应是将他的右手向侧面尽可能地伸出,并说:“你能用左手的第三个手指触摸到我中指的尖端吗?” Daneel did that promptly and easily. In fifteen minutes, not more, Dr. Gerrigel was finished. Daneel很快很容易地完成了这件事。不到十五分钟,Gerrigel博士就完成了。

This is not dissimilar to modern approaches to evaluating Large Language Models (LLMs). LLMs can be evaluated with a more involved approach that involves integrating it into other apps and processes called extrinsic evaluation and a more introspective but quicker approach that involves evaluating the AI LLM directly called intrinsic evaluation. The evaluation of a model is done with measures like perplexity and entropy using mathematical formulas on the data set. 这与评估大型语言模型(LLM)的现代方法并无不同。LLM可以通过更复杂的方法进行评估,包括将其集成到其他应用程序和流程中,称为外在评估,以及更内省但更快速的方法,涉及直接评估AI LLM,称为内在评估。使用数学公式对数据集进行困惑度和熵等度量来评估模型。

When Dr. Gerrigel evaluates Daneel, he conducts a series of tests to assess the robot’s physical and functional properties to determine if it is indeed a robot and to understand if it’s been installed with the 1st law properly. Similarly, intrinsic evaluation of a large language model involves analyzing its inner workings and performance on specific tasks to understand how well it has learned language patterns, relationships, and knowledge from the training data. It often includes measuring its performance on various linguistic tasks, such as predicting the next word in a sentence, answering questions, or summarizing text. Researchers may also analyze the model’s internal representations, such as examining the learned embeddings or attention mechanisms, to gain insights into the linguistic knowledge it has acquired during training. These evaluations help to determine the model’s strengths and weaknesses, as well as its ability to understand and generate human-like language. 当Gerrigel博士评估Daneel时,他进行了一系列测试,以评估机器人的物理和功能特性,以确定它是否确实是机器人,并了解它是否已正确安装第一法则。类似地,对大型语言模型的内在评估涉及分析其内部运作和在特定任务上的表现,以了解它从训练数据中学习语言模式、关系和知识的程度。它通常包括测量其在各种语言任务上的表现,例如预测句子中的下一个单词、回答问题或总结文本。研究人员还可以分析模型的内部表示,例如检查学习的嵌入或注意机制,以深入了解它在训练期间获得的语言知识。这些评估有助于确定模型的优点和缺点,以及其理解和生成类似人类语言的能力。

In both cases, the evaluations are designed to assess the capabilities of the subject (Daneel or a large language model) and to gain insights into their underlying mechanisms. Even though Asimov doesn’t do much worldbuilding around the details of what his ‘intrinsic evaluation’ method by Dr. Gerrigel of Daneel was, it’s astonishing that Asimov predicted this type of evaluation of AI would be used 70 years ago. 在这两种情况下,评估都旨在评估受试者(Daneel或大型语言模型)的能力并获得有关其基本机制的见解。尽管阿西莫夫没有在Dr. Gerrigel对Daneel的“内在评估”方法的细节周围做太多的世界构建,但令人惊讶的是,阿西莫夫在70年前就预测了这种评估AI的类型将被使用。

Conclusion

结论

These are just a few examples of how Isaac Asimov delved into the intricate relationship between AI and humanity, anticipating the importance of prompt engineering in eliciting higher quality responses from AI and robots. Asimov’s Robot Series represents speculative science fiction that has become increasingly relevant due to the widespread success of large language models and AI. This seminal body of work offers valuable historical context and insight for data scientists and machine learning engineers, shedding light on the origins of many contemporary ideas and inspirations in the field. 这些只是艾萨克·阿西莫夫深入探讨人工智能和人类之间错综复杂关系的几个例子,预见了及时工程在引发AI和机器人更高质量响应方面的重要性。阿西莫夫的机器人系列代表了一种推测性科幻小说,由于大型语言模型和人工智能的广泛成功而变得越来越相关。这个开创性的作品为数据科学家和机器学习工程师提供了有价值的历史背景和洞察力,揭示了许多当代思想和灵感在该领域的起源。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023/05/16 20:00:17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 觉学社 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 引言
  • 正文
  • Prompt Engineering - The Background and History
  • Prompt Engineering Terms
  • Asimovs Robots Series 阿西莫夫的机器人系列
  • Asimov: The Unconscious Prompt Engineer
  • Examples of Prompt Engineering from Asimov’s Works
    • Mirror Image (Short story 1972) 镜像(短篇小说1972年)
    • Runaround (1942)
    • Caves of Steel (1954) 钢铁洞穴 (1954)
  • Conclusion
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档