Augmenting Language Models with Knowledge
用知识扩充语言模型
Use Operand search results to augment GPT-3 style prompts with additional, context-relevant knowledge. Help your pre-trained language models learn and get better over time, without having to do any additional training.
使用操作数搜索结果,使用附加的上下文相关知识来增强GPT-3样式提示。帮助您预先培训的语言模型学习并随着时间的推移变得更好,而无需进行任何额外的培训。
Large language models (LLMs), like GPT-3, are getting to the point where only a few select companies can afford to reliably train and deploy them.
大型语言模型(LLM),如GPT-3,已经到了只有少数公司能够负担得起可靠地培训和部署它们的地步。
The latest model from OpenAI is trained on data up until Jun 2021. If you wanted to use this model on per-user data, or data that’s been collected since Jun 2021, you’d have to retrain the model on this new data (which is expensive). The best alternative is using semantic search to augment the model with additional, context-relevant knowledge.
最新款来自 开放人工智能根据截至2021年6月的数据进行培训。如果您想对每个用户的数据或自2021年6月以来收集的数据使用此模型,则必须根据此新数据重新训练模型(代价高昂)。最好的替代方法是使用 语义检索以利用附加的、上下文相关的知识来扩充该模型。
Case Study: Leveraging Wikipedia to give GPT-3 Factual, Up-To-Date Knowledge on a Topic 案例研究:利用Wikipedia给予关于某个主题的GPT-3事实性最新知识 Riff allows anyone to have virtual “office hours” with an expert on a given topic. For example, if you wanted to learn about cellular biology, you could ask a virtual professor of cellular biology questions about the topic.
Riff 允许任何人与给定主题的专家进行虚拟“办公时间”。例如,如果你想学习细胞生物学,你可以向一位细胞生物学的虚拟教授提问。
To accomplish this, Riff uses a combination of OpenAI’s GPT-3 and Operand.
为了实现这一点,Riff使用了OpenAI的GPT-3和操作数的组合。
When the user asks a question, Riff uses a GPT-3 prompt to choose which Wikipedia article would be most relevant to the question. For example, if the user asks “What is the difference between a virus and a bacterium?”, Riff might choose the virus article.
当用户提问时,Riff使用GPT-3提示符来选择与该问题最相关的维基百科文章。例如,如果用户问“病毒和细菌有什么区别?“,Riff可能会选择病毒文章。
Riff indexes one or more relevant Wikipedia articles with Operand, and then uses search results to pass context relevant knowledge into a conversational GPT-3 prompt. For example, if the user asks “What is the difference between a virus and a bacterium?”, Riff might use the following prompt:
Riff使用Operand索引一个或多个相关的Wikipedia文章,然后使用搜索结果将上下文相关知识传递到会话GPT-3提示中。例如,如果用户问“病毒和细菌有什么区别?“,Riff可能会使用以下提示符:
Alice is a professor of cellular biology. She's holding office hours.
Relevant information Alice knows:
- Bacteriophages are a common and diverse group of viruses and are the most abundant biological entity in aquatic environments—there are up to ten times more of these viruses in the oceans than there are bacteria, [223] reaching levels of 250,000,000 bacteriophages per millilitre of seawater. [224] These viruses infect specific bacteria by binding to surface receptor molecules and then entering the cell.
- Viruses display a wide diversity of sizes and shapes, called ' morphologies '. In general, viruses are much smaller than bacteria and more than a thousand bacteriophage viruses would fit inside an Escherichia coli bacterium's cell. [47] Many viruses that have been studied are spherical and have a diameter between 20 and 300 nanometres.
- A virus is a submicroscopic infectious agent that replicates only inside the living cells of an organism . [1] Viruses infect all life forms , from animals and plants to microorganisms , including bacteria and archaea.
Student: Hello!
Alice: Hello! How can I help?
Student: What is the difference between a virus and a bacterium?
Alice:
Notice how this prompt is “augmented” with snippets pulled directly from the Wikipedia article. This is a great way to give GPT-3 factual, up-to-date knowledge on a topic. In this case, the prompt is augmented with search results from Operand, after indexing the article.
注意这个提示是如何用直接从Wikipedia文章中提取的片段“增强”的。这是向GPT-3提供关于某个主题的最新事实知识的好方法。在本例中,在索引文章后,提示将使用操作数的搜索结果进行扩充。
When executed, Alice responds with:
当执行时,Alice响应:
Viruses are much smaller than bacteria and more than a thousand bacteriophage viruses would fit inside an Escherichia coli bacterium’s cell. Viruses also infect all life forms, from animals and plants to microorganisms, including bacteria and archaea. Case Study: Adding Long-Term Memory to Chatbots 案例研究:为聊天机器人添加长期记忆 When using GPT-3 to create conversational experiences, it’s often important to develop a long-term relationship with the end-user. For example, as a user continues to converse with the chatbot, the chatbot should remember information that the user has told it. This is called “long-term memory”.
使用GPT-3创建会话体验时,与最终用户建立长期关系通常很重要。例如,当用户继续与聊天机器人匡威时,聊天机器人应该记住用户告诉它的信息,这被称为“长期记忆”。
Long-term memory is a key component of human-like conversational experiences, and it’s something that makes chatbots feel more “human”.
长时记忆是类人会话体验的关键组成部分,也是让聊天机器人感觉更“人性化”的东西。
Circle allows anyone to create virtual AI-powered NPC characters, with any personality and backstory they want. Each Circle chatbot comes equipped with long-term memory, powered by Operand.
Circle 允许任何人创建虚拟的人工智能驱动的NPC角色,拥有他们想要的任何个性和背景故事。每个Circle聊天机器人都配备了长期记忆,由操作数提供动力。
For each conversation between a user and a chatbot, Circle creates a corresponding Operand index, which stores the messages sent to and from the chatbot.
对于用户和聊天机器人之间的每个对话,Circle都会创建一个对应的操作数索引,用于存储发送到聊天机器人和从聊天机器人发送的消息。
When the user sends a message to the chatbot, Circle first does a search to find relevant messages from the conversation history. Circle then uses these messages to augment the GPT-3 prompt, to help the chatbot remember the conversation history.
当用户向聊天机器人发送消息时,Circle首先会进行搜索,从对话历史中查找相关消息。然后,Circle使用这些消息来增强GPT-3提示,以帮助聊天机器人记住对话历史。
An example prompt could be:
示例提示可能是:
The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Previously, the Human has told the AI that:
- My favorite drink at Starbucks is a Pumpkin Spice Latte.
Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: How basic am I?
AI:
Using the prompt above, the chatbot can respond with:
使用上面的提示,聊天机器人可以响应:
You are very basic. Conclusion 结语 Augmenting large-language models with semantic search results is a great way to leverage the latest, large models without having to retrain them on your own data, or even on a per-user basis. We’ve discussed a few use cases above, but there are many, many more. If you have any questions, or curious about how this technique could help out with your unique use case, reach out!
使用语义搜索结果扩充大型语言模型是利用最新的大型模型的一种很好的方法,而不必在您自己的数据上重新训练它们,甚至不必在每个用户的基础上重新训练它们。我们在上面讨论了一些用例,但还有很多很多。如果您有任何问题,或者对这种技术如何帮助您解决独特的用例感到好奇,请联系我们!
If you want to start augmenting large-language models today, follow our getting started guide. It’s entirely free to get going, no credit card required!
如果您想现在就开始扩充大型语言模型,请遵循我们的入门指南。完全免费,不需要信用卡!