diff --git a/.gitignore b/.gitignore
index f72ed3726..ab1c4d7bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ notebooks/.env
pages/research/local_research/
.DS_Store
.vscode
+.vercel
# app
.next
diff --git a/pages/_meta.zh.json b/pages/_meta.zh.json
index e1df05c11..281a5be60 100644
--- a/pages/_meta.zh.json
+++ b/pages/_meta.zh.json
@@ -6,7 +6,7 @@
"prompts": "Prompt Hub",
"models": "模型",
"risks": "风险和误用",
- "research": "LLM Research Findings",
+ "research": "主要研究方向",
"papers": "论文",
"tools": "工具和库",
"notebooks": "Prompt Engineering 笔记本",
diff --git a/pages/applications/_meta.zh.json b/pages/applications/_meta.zh.json
index 4aa7718e5..8fa1f451a 100644
--- a/pages/applications/_meta.zh.json
+++ b/pages/applications/_meta.zh.json
@@ -1,6 +1,10 @@
{
- "generating": "生成数据",
- "coding": "Generating Code",
+ "generating": "数据生成",
+ "generating_textbooks": "解决生成数据集的多样性",
+ "coding": "代码生成",
"workplace_casestudy": "毕业生工作分类案例研究",
- "pf": "提示函数"
+ "pf": "提示函数",
+ "context-caching": "使用 Gemini 1.5 Flash 进行上下文缓存",
+ "synthetic_rag": "使用 LLM 生成数据以训练新一代的 LLM / 检索器 / 其他模型",
+ "function_calling": "LLM 中自定义函数的调用"
}
\ No newline at end of file
diff --git a/pages/applications/context-caching.zh.mdx b/pages/applications/context-caching.zh.mdx
new file mode 100644
index 000000000..1a29876df
--- /dev/null
+++ b/pages/applications/context-caching.zh.mdx
@@ -0,0 +1,46 @@
+# 使用 Gemini 1.5 Flash 进行上下文缓存
+
+import {Cards, Card} from 'nextra-theme-docs'
+import {CodeIcon} from 'components/icons'
+
+Google 最近发布了一个名为 [上下文缓存](https://ai.google.dev/gemini-api/docs/caching?lang=python) 的新功能,该功能通过 Gemini 1.5 Pro 和 Gemini 1.5 Flash 模型的 Gemini APIs 提供。本指南提供了如何使用 Gemini 1.5 Flash 进行上下文缓存的基本示例。根据
+
+### 应用案例:分析一年的机器学习论文
+
+本指南演示了如何使用上下文缓存来分析我们在过去一年中记录的所有 [机器学习论文的摘要](https://github.com/dair-ai/ML-Papers-of-the-Week)。我们将这些摘要存储在一个文本文件中,现在可以将其输入到 Gemini 1.5 Flash 模型中,并进行高效查询。
+
+### 过程:上传、缓存和查询
+
+1. **数据准备** 首先将包含摘要的 readme 文件转换为纯文本文件。
+2. **使用 Gemini API:** 你可以使用 Google 的 `generativeai` 库上传文本文件。
+3. **实现上下文缓存:** 使用 `caching.CachedContent.create ()` 函数创建缓存。这需要:
+ * 指定 Gemini Flash 1.5 模型。
+ * 为缓存提供一个名字。
+ * 为模型定义一个指令(例如,“你是一个专业的 AI 研究员……”)。
+ * 为缓存设置生存时间(例如,15 分钟)。
+4. **创建模型:** 然后我们使用缓存的内容创建一个生成模型实例。
+5. **查询:** 我们可以开始用自然语言问题查询模型,比如:
+ * “你能告诉我本周最新的 AI 论文是什么吗?”
+ * “你能列出提到 Mamba 的论文吗?列出论文的标题和摘要。”
+ * “关于长上下文 LLMs 的一些创新是什么?列出论文的标题和摘要。”
+
+结果非常有希望。模型准确地从文本文件中检索并总结了信息。上下文缓存证明了其高效性,消除了每次查询都需要重复发送整个文本文件的需要。
+
+这种工作流程有可能成为研究人员的宝贵工具,使他们能够:
+
+* 快速分析和查询大量的研究数据。
+* 在无需手动搜索文档的情况下检索特定的发现。
+* 在不浪费提示令牌的情况下进行交互式的研究会议。
+
+我们很高兴能进一步探索上下文缓存的应用,特别是在更复杂的情况下,如代理工作流程。
+
+
+下面是笔记本的链接:
+
+
+ }
+ title="Context Caching with Gemini APIs"
+ href="https://github.com/dair-ai/Prompt-Engineering-Guide/blob/main/notebooks/gemini-context-caching.ipynb"
+ />
+
diff --git a/pages/applications/function_calling.zh.mdx b/pages/applications/function_calling.zh.mdx
index 6c4c8f64a..7e40c35ea 100644
--- a/pages/applications/function_calling.zh.mdx
+++ b/pages/applications/function_calling.zh.mdx
@@ -1,27 +1,27 @@
-# 在LLM中调用函数
+# LLM 中自定义函数的调用
## 调用函数
-函数调用是指可靠地连接LLM与外部工具的能力。让用户能够使用高效的外部工具、与外部API进行交互。
+函数调用是指可靠地连接 LLM 与外部工具的能力。让用户能够使用高效的外部工具、与外部 API 进行交互。
-GPT-4和GPT-3.5是经过微调的LLM,能够检测函数是否被调用,随后输出包含调用函数参数的JSON。通过这一过程被调用的函数能够作为工具添加到您的AI应用中,并且您可以在单个请求中定义多个函数。
+GPT-4 和 GPT-3.5 是经过微调的 LLM,能够检测函数是否被调用,随后输出包含调用函数参数的 JSON。通过这一过程被调用的函数能够作为工具添加到您的 AI 应用中,并且您可以在单个请求中定义多个函数。
-函数调用是一项重要能力。它对于构建LLM驱动的聊天机器人或代理至关重要。这些聊天机器人或代理需要为LLM检索上下文。它们还与外部工具交互。这种交互是通过将自然语言转换为API调用来完成的。
+函数调用是一项重要能力。它对于构建 LLM 驱动的聊天机器人或代理至关重要。这些聊天机器人或代理需要为 LLM 检索上下文。它们还与外部工具交互。这种交互是通过将自然语言转换为 API 调用来完成的。
函数调用使开发者能够创建:
-- 能够高效使用外部工具回答问题的对话代理。例如,查询“伯利兹的天气如何?”将被转换为类似`get_current_weather(location: string, unit: 'celsius' | 'fahrenheit')`的函数调用
-- 用于提取和标记数据的LLM驱动解决方案(例如,从维基百科文章中提取人名)
-- 可以帮助将自然语言转换为API调用或有效数据库查询的应用程序
+- 能够高效使用外部工具回答问题的对话代理。例如,查询 “伯利兹的天气如何?” 将被转换为类似 `get_current_weather (location: string, unit: 'celsius' | 'fahrenheit')` 的函数调用
+- 用于提取和标记数据的 LLM 驱动解决方案(例如,从维基百科文章中提取人名)
+- 可以帮助将自然语言转换为 API 调用或有效数据库查询的应用程序
- 能够与知识库交互的对话式知识检索引擎
在这份指南中,我们展示了如何针对GPT-4和其他开源模型给出提示,以执行不同的函数调用。
-## 使用GPT-4进行函数调用
+## 使用 GPT-4 进行函数调用
作为一个基本示例,假设我们要求模型检查特定地点的天气。
-LLM本身无法响应此请求。因为它所使用的训练数据集截止至之前的某个日期。解决这个问题的方法是将LLM与外部工具结合起来。您可以利用模型的函数调用能力来确定要调用的外部函数及其参数,然后让它返回最终回复结果。以下是一个简单的示例,展示了如何使用OpenAI API实现这一点。
+LLM 本身无法响应此请求。因为它所使用的训练数据集截止至之前的某个日期。解决这个问题的方法是将 LLM 与外部工具结合起来。您可以利用模型的函数调用能力来确定要调用的外部函数及其参数,然后让它返回最终回复结果。以下是一个简单的示例,展示了如何使用 OpenAI API 实现这一点。
假设一个用户向模型提出以下问题:
@@ -29,9 +29,21 @@ LLM本身无法响应此请求。因为它所使用的训练数据集截止至
伦敦的天气如何?
```
-要使用函数调用处理此请求,第一步是定义一个或一组天气函数。您将作为OpenAI API请求的一部分传递这些函数:
+要使用函数调用处理此请求,第一步是定义一个或一组天气函数。您将作为 OpenAI API 请求的一部分传递这些函数:
```python
+# Defines a dummy function to get the current weather
+def get_current_weather(location, unit="fahrenheit"):
+ """Get the current weather in a given location"""
+ weather = {
+ "location": location,
+ "temperature": "50",
+ "unit": unit,
+ }
+
+ return json.dumps(weather)
+
+# define a function as tools
tools = [
{
"type": "function",
@@ -54,9 +66,17 @@ tools = [
},
}
]
+
+# define a list of messages
+messages = [
+ {
+ "role": "user",
+ "content": "What is the weather like in London?"
+ }
+]
```
-`get_current_weather`函数能够返回指定位置的天气情况。当您将这个函数定义作为请求的一部分传递时,它实际上并不执行函数,只是返回一个包含调用函数所需参数的JSON对象。以下是一些如何实现这一点的代码片段。
+`get_current_weather` 函数能够返回指定位置的天气情况。当您将这个函数定义作为请求的一部分传递时,它实际上并不执行函数,只是返回一个包含调用函数所需参数的 JSON 对象。以下是一些如何实现这一点的代码片段。
您可以如下定义一个完整的函数:
@@ -82,25 +102,40 @@ messages = [
]
```
-最后,您可以调用`get_completion`函数,将结果传递给`response`中的`messages`和`tools`:
+最后,您可以调用 `get_completion` 函数,将结果传递给 `response` 中的 `messages` 和 `tools`:
```python
response = get_completion(messages, tools=tools)
+args = json.loads(response.tool_calls[0].function.arguments)
+get_current_weather(**args)
```
+这将输出:`'{"location": "London", "temperature": "50", "unit": "celsius"}'`
-`response`的构造如下所示:
+上述代码中 `response` 的构造如下所示:
```python
-ChatCompletionMessage(content=None, role='assistant', function_call=None, tool_calls=[ChatCompletionMessageToolCall(id='...', function=Function(arguments='{"location":"London","unit":"celsius"}', name='get_current_weather'), type='function')])
+ChatCompletionMessage(
+ content=None,
+ role='assistant',
+ function_call=None,
+ tool_calls=[
+ ChatCompletionMessageToolCall(id='...',
+ function=Function(
+ arguments='{"location":"London","unit":"celsius"}',
+ name='get_current_weather'),
+ type='function'
+ )
+ ]
+ )
```
特别地,`arguments` 对象包含了模型提取的重要参数,这些参数将被用于完成请求。
-然后您可以调用一个外部天气API来获取实际的天气信息。一旦您有了天气信息,就可以将其传回模型,随后根据原始用户问题总结出最终回应。
+然后您可以调用一个外部天气 API 来获取实际的天气信息。一旦您有了天气信息,就可以将其传回模型,随后根据原始用户问题总结出最终回应。
-这里有一个[python notebook](https://github.com/dair-ai/Prompt-Engineering-Guide/blob/main/notebooks/pe-function-calling.ipynb),它提供了一个简单示例,展示了如何使用OpenAI API进行函数调用。
+这里有一个 [python notebook](https://github.com/dair-ai/Prompt-Engineering-Guide/blob/main/notebooks/pe-function-calling.ipynb),它提供了一个简单示例,展示了如何使用 OpenAI API 进行函数调用。
-## 使用开源LLM进行函数调用
+## 使用开源 LLM 进行函数调用
更多使用开源LLM进行函数调用的说明即将推出...
## 函数调用用例
diff --git a/pages/applications/generating.zh.mdx b/pages/applications/generating.zh.mdx
index 2836785a9..896dab39e 100644
--- a/pages/applications/generating.zh.mdx
+++ b/pages/applications/generating.zh.mdx
@@ -1,9 +1,9 @@
# 生成数据
-LLMs具有生成连贯文本的强大能力。使用有效的提示策略可以引导模型产生更好、更一致和更真实的响应。LLMs还可以特别有用地生成数据,这对于运行各种实验和评估非常有用。例如,我们可以使用它来为情感分类器生成快速样本,如下所示:
+LLMs 具有生成连贯文本的强大能力。使用有效的提示策略可以引导模型产生更好、更一致和更真实的响应。LLMs 还可以特别有用地生成数据,这对于运行各种实验和评估非常有用。例如,我们可以使用它来为情感分类器生成快速样本,如下所示:
*提示:*
```
-生成10个情感分析的范例。示例被归类为正面或负面。生成2个负面示例和8个正面示例。使用以下格式的示例:
+生成 10 个情感分析的范例。示例被归类为正面或负面。生成 2 个负面示例和 8 个正面示例。使用以下格式的示例:
Q:<句子>
A:<情感>
```
diff --git a/pages/applications/generating_textbooks.zh.mdx b/pages/applications/generating_textbooks.zh.mdx
new file mode 100644
index 000000000..6c65f98f5
--- /dev/null
+++ b/pages/applications/generating_textbooks.zh.mdx
@@ -0,0 +1,146 @@
+# Tackling Generated Datasets Diversity
+
+import {Screenshot} from 'components/screenshot'
+
+import IMG1 from '../../img/synthetic_diversity/textbooks_1.png'
+import IMG2 from '../../img/synthetic_diversity/textbooks_2.png'
+
+在上一章 [《使用 LLM 生成合成数据集》](https://www.promptingguide.ai/applications/synthetic_rag) 中,我们讨论了使用大语言模型 (LLM) 生成合成数据集以进一步微调本地检索模型的潜力。这种方法是可能的,因为有大量的未标记文档可用。每个文档都用于生成一个或多个合成查询,形成查询 - 文档对。
+
+但是,如果信息检索不是您的任务呢?假设您正在处理法律文档分类问题,但不允许将任何数据发送到外部 API。在这种情况下,您需要训练一个本地模型。然而,收集数据可能会成为一个障碍,导致产品开发中的延迟。
+
+为了简单起见,假设任务是生成儿童故事。这个任务是研究 [Eldan 等人 (2023)](https://arxiv.org/abs/2305.07759) 的起点。每个故事包含 2-3 段话,遵循简单的情节和主题,而整个数据集涵盖儿童的词汇和事实知识。
+
+语言不仅是一套规则和符号;它传达和解释意思。主要挑战在于使用大语言模型生成培训数据,确保数据集多样性。即使在高 [Temperature](https://www.promptingguide.ai/introduction/settings) 下,模型仍然可能会产生重复的数据集,缺乏必要的多样性(即使是儿童语言中的)。连贯性和相关性也是自然语言生成的其他自然语言生成挑战。
+
+为了应对多样性问题,作者准备了大约 1500 个基本单词的词汇,反映了典型儿童词汇,分为名词、动词和形容词。每次生成中,选择一个动词、一个名词和一个形容词。然后,模型生成一个故事,将这些随机单词集成到故事中。
+
+这种技术显著增加了数据集的多样性,确保故事涵盖整个儿童词汇和多样的概念组合。此外,作者集成了潜在的故事特征(如对话、情节转折、坏结局或道德启示)。对于每个故事,从这些特征的随机子集中选择一部分,并提示模型包含它们。
+
+*Prompt:*
+```
+Write a short story (3-5 paragraphs) which only uses very simple words that a 3 year old child would likely understand. The story should use the verb ”{random.choice(verbs_list)}”, the noun ”{random.choice(nouns_list)}” and the adjective ”{random.choice(adjectives_list)}”. The story should have the following features: {random.choice(features_list)}, {random.choice(features_list)}. Remember to only use simple words!
+```
+
+让我们假设这些空白被填补如下:
+
+*Prompt:*
+```
+Write a short story (3-5 paragraphs) which only uses very simple words that a 3 year old child would likely understand. The story should use the verb ”decorate”, the noun ”thunder” and the adjective ”ancient”. The story should have the following features: the story should contain at least one dialogue, the story has a bad ending. Remember to only use simple words!
+```
+
+*Output:*
+```
+Once upon a time, in an ancient house, there lived a girl named Lily. She loved to decorate her room with pretty things. One day, she found a big box in the attic. She opened it and saw many shiny decorations. Lily was very happy and decided to use them in her room. As Lily was decorating her room, the sky outside became dark. There was a loud thunder sound, and Lily got scared. She ran to her mom and said, ”Mommy, the thunder is so loud!” Her mom hugged her and said, ”Don’t worry, it will pass soon.” But the thunder did not stop. It got louder and louder, and the ancient house started to shake. Suddenly, the roof fell down on the pretty decorations. Lily was sad because her room was not pretty anymore. The end.
+```
+
+我们在这一章中利用了最新的文本生成模型(GPT-3.5 和 GPT-4),可以生成大量合成内容,按照指示进行。由于每次提示都是随机生成的,而模型严格遵循它,故故事大相径庭。即使只有一个或两个单词有所不同,叙述也会完全不同。实际上,我们在提示中应用随机性,以生成多样的数据集。
+
+您可以这样理解:
+
+1. 确定不同样本之间可能会发生变化的参数 / 实体;
+2. 生成或手动编译这些实体,以填充空白;
+3. 通过随机选择实体生成数据集。最好将生成温度设置得比默认值高但比最大值低;
+4. 在生成结果上训练本地模型。
+
+值得注意的是,可以使用实体之一来播种生成,例如在情感分类任务中,可以直接在提示中提到 “积极” 或 “消极”,以生成带有相应标签的文本。然后,使用此数据训练本地分类器。
+
+# 迭代(分层)合成数据生成
+
+格式可以更加复杂,通过使用更多实体,其中一些甚至是 LLM 本身生成的。例如,可以从生成故事摘要开始,然后写下一个句子,必须出现在故事中。之后,只需使用此生成的中间数据完成最终请求。
+
+*Prompt:*
+```
+Summary: {a short summary generated by LLM, using the approach above}
+Features: {copy the features from the initial prompt}
+Sentence: {a sentence generated by LLM, which should be present in the story}
+Words: {copy the words from the initial prompt}
+Story:
+```
+
+填写 prompt 的示例:
+
+*Prompt:*
+```
+Summary: Lily and Timmy build a sandcastle together and learn to compromise, but it gets knocked over by a gust of wind. They find beauty in the broken sandcastle and play happily with a butterfly.
+Features: Dialogue, Foreshadowing, Twist
+Sentence: One day, she went to the park and saw a beautiful butterfly.
+Words: disagree, network, beautiful
+Story:
+```
+
+*Output:*
+```
+Once upon a time, there was a little girl named Lily. She loved to play with her toys and her friends. One day, she went to the park and saw a beautiful butterfly. She tried to catch it, but it flew away. Lily’s friend, Timmy, came to play with her. They decided to build a sandcastle, but they disagreed on how to build it. Lily wanted to make it tall, while Timmy wanted to make it wide. They argued for a while, but finally agreed to make it both tall and wide. As they were building the sandcastle, they noticed a group of ants working together. They realized that the ants were building a network of tunnels. Suddenly, a gust of wind came and knocked over their sandcastle. They were sad, but then they saw the butterfly again. It landed on the remains of their sandcastle and they realized that it was still beautiful, even in its broken state. They smiled and played together happily.
+```
+
+因此,可以生成数十万个非常不同的示例来训练模型。假设您需要训练一个分类器来确定文本是否包含对话或情节转折。由于初始提示包含标签,因此知道需要为每个生成的样本预测哪个目标值。
+
+# 关于合成数据集:提高语言模型在真实应用中的有效性
+
+一个关键问题是,合成数据集是否能为在实际应用中训练网络带来真正的好处。作者通过实验证明,训练较小的语言模型使用来自先进语言模型的合成数据确实可以提高其效果。
+
+在他们的研究中,[Gunasekar等(2023)](https://arxiv.org/abs/2306.11644) 强調了高质量培训数据在他们的模型中的重要性。他们认为,语言模型在实际应用中的有效性将提高,如果它们是在类似“教材”(clear, detailed, informative和无偏见)的材料上培训的。
+
+这些原则构成了创建半合成数据集以培训称为 Phi-1 的 LLM 的基础。主要评估任务是生成符合给定文本描述或文档字符串的 Python 函数。该模型的质量大小评估使用 HumanEval 基准([陈等,2021](https://arxiv.org/abs/2107.03374))。
+
+作者在模型的有效性方面强调了多样性的重要性,原因有以下几点:
+
+- 使模型接受各种编程表达式和解决问题的方法;
+- 减少过度拟合或依赖特定模式的风险;
+- 提高模型处理尚不熟悉或创新任务的能力。
+
+为了应对代码写作的挑战,作者创建了类似教材的文档,重点介绍了推动锻炼推理和基本算法技能的主题。为实现多样性,他们在以下方面施加了限制:
+
+- 主题
+- 目标受众
+
+不幸的是,作者未提供有关提示模板的具体信息,使用合成数据训练模型。但是,他们展示了生成的输出。作者选择使用 ChatGPT(GPT-3.5)而不是 GPT-4,并且结果也非常出色,因为它可以用合成数据进行微调。
+
+
+
+图片来源:[Gunasekar et al. (2023)](https://arxiv.org/abs/2306.11644)
+
+重点是要注意目标受众的约束。通过指定目标受众来增强模拟数据的多样性。高中生、计算机专业本科生和博士研究生可能会以不同的方式解释和处理信息,使生成的数据更加多样。让我们尝试重新创建提示。
+
+
+*Prompt:*
+```
+Write an extract from a Computer Science textbook for a 1st-year bachelor. The coding language is Python 3.6.
+
+This is an extract from the middle of the following topic: Singular matrices.
+
+The extract starts with a high-level overview of the topic. Then, it presents an example and describes the solution in natural language. After that, it provides 1-2 code snippets, following the example. Each snippet has no more than 10 rows. There should be no text after code snippets.
+
+Keep in mind that the extract should be concise and explain only one concept at a time. The code should represent a Python function & its call. All the common ML/DS libraries are available.
+
+Don't be too verbose. The expected length of the extract is 2 paragraphs at most.
+```
+
+*Output:*
+```
+**Singular Matrices**
+
+In linear algebra, a matrix is termed as "singular" if it doesn't have an inverse. Another equivalent definition is when the determinant of the matrix is zero. Singular matrices are crucial because they represent systems of linear equations that do not have a unique solution.
+
+Consider a 2x2 matrix `[[a, b], [c, d]]`. If the product of `ad` and `bc` is the same (i.e., `ad = bc`), then this matrix is singular. Let's explore this with an example: given the matrix `[[2, 4], [1, 2]]`, you'll find that the product of the diagonals yields the same result (2 * 2 = 4 * 1), thus it's a singular matrix.
+
+import numpy as np
+
+def is_singular(matrix):
+ determinant = np.linalg.det(matrix)
+ return abs(determinant) < 1e-9
+
+matrix_example = np.array([[2, 4], [1, 2]])
+print(is_singular(matrix_example)) # returns True
+```
+
+相当接近了!
+总的来说,作者生成了 1B 个令牌来扩充模型的训练集,从而允许较小的模型(仅 1.5B 个参数)可以与十倍于其大小的模型相媲美(详细信息请参阅文章 [Gunasekar et al. (2023)]( https://arxiv.org/abs/2306.11644))。
+
+
+
+图片来源:[Gunasekar et al. (2023)](https://arxiv.org/abs/2306.11644)
+
+对于一般的任务,可能不需要如此大量的合成数据(因为作者研究了预训练,这需要大量资源)。然而,即使作为估计,按照每 1000 个代币 “0.002 美元” 的价格(标准 ChatGPT 定价),生成的代币将花费 “2000 美元”,提示的费用也大致相同。
+请记住,随着领域变得更加利基,对合成数据的微调变得更有价值,特别是如果语言偏离英语(以及其他因素)。此外,该方法与思想链(CoT)配合良好,有助于局部模型提高推理能力。其他提示技巧也有效。并且不要忘记像 Alpaca ([Taori et al., (2023)](https://crfm.stanford.edu/2023/03/13/alpaca.html)) 和 Vicuna ([Zheng et al., (2023)](https://lmsys.org/blog/2023-03-30-vicuna/)) 通过对合成数据进行微调而表现出色。
\ No newline at end of file
diff --git a/pages/applications/pf.zh.mdx b/pages/applications/pf.zh.mdx
index 6d15d659f..b82e9e464 100644
--- a/pages/applications/pf.zh.mdx
+++ b/pages/applications/pf.zh.mdx
@@ -24,7 +24,7 @@ rule:[关于如何处理输入的说明]
我恳请你根据我提供的细节为这个函数提供输出。非常感谢你的帮助。谢谢!
-我将使用方括号内的相关信息替换函数所需执行的内容。这个详细的介绍应该能够帮助你更高效地理解我的请求并提供所需的输出。格式是function_name(input)。如果你理解了,请用一个词回答"好的"
+我将使用方括号内的相关信息替换函数所需执行的内容。这个详细的介绍应该能够帮助你更高效地理解我的请求并提供所需的输出。格式是 function_name(input)。如果你理解了,请用一个词回答"好的"
```
## 实例
@@ -119,5 +119,5 @@ pg(10,1,5,2,1)
但是那些项目要么是为产品客户设计的,要么是为那些能够使用 Python 或其他编程语言进行编码的用户设计的。
对于普通用户来说,可以使用这个简单的模板进行日常工作,并进行几次迭代。使用一个笔记应用程序来记录函数,甚至可以将其更新为一个库。
-或者,一些开源的 ChatGPT 工具,比如 ChatGPT-Next-Web、chatbox 和 ChatGPT-Desktop,也可以使用。目前,ChatGPT-Next-Web 允许在初始化新聊天之前添加一些片段。
+或者用一些开源的 ChatGPT 工具,比如 [ChatGPT-Next-Web](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web)、[chatbox](https://github.com/Bin-Huang/chatbox)、[PromptAppGPT](https://github.com/mleoking/PromptAppGPT) 和 [ChatGPT-Desktop](https://github.com/lencx/ChatGPT),也可以使用。目前,ChatGPT-Next-Web 允许在初始化新聊天之前添加一些片段。
我们可以利用这个功能来添加我们的函数,然后可以使用它。
diff --git a/pages/applications/synthetic_rag.de.mdx b/pages/applications/synthetic_rag.de.mdx
index 7fbb7ec21..8761f784a 100644
--- a/pages/applications/synthetic_rag.de.mdx
+++ b/pages/applications/synthetic_rag.de.mdx
@@ -1,4 +1,4 @@
-# Generierung eines synthetischen Datensatzes für RAG
+# Erzeugen von Daten mit LLM für das Training neuer LLM/Ablauf/anderer Modelle
import {Screenshot} from 'components/screenshot'
import remarkMath from 'remark-math'
diff --git a/pages/applications/synthetic_rag.en.mdx b/pages/applications/synthetic_rag.en.mdx
index 9e9c70791..8bce99f3b 100644
--- a/pages/applications/synthetic_rag.en.mdx
+++ b/pages/applications/synthetic_rag.en.mdx
@@ -1,4 +1,4 @@
-# Generating Synthetic Dataset for RAG
+# Use LLM to generate data to train a new generation of LLM/retrieval/other models
import {Screenshot} from 'components/screenshot'
import remarkMath from 'remark-math'
diff --git a/pages/applications/synthetic_rag.zh.mdx b/pages/applications/synthetic_rag.zh.mdx
new file mode 100644
index 000000000..f5f022ca6
--- /dev/null
+++ b/pages/applications/synthetic_rag.zh.mdx
@@ -0,0 +1,87 @@
+# 使用 LLM 生成数据以训练新一代的 LLM / 检索器 / 其他模型
+
+import {Screenshot} from 'components/screenshot'
+import remarkMath from 'remark-math'
+import rehypeKatex from 'rehype-katex'
+
+import IMG1 from '../../img/synthetic_rag/synthetic_rag_1.png'
+import IMG2 from '../../img/synthetic_rag/synthetic_rag_2.png'
+import IMG3 from '../../img/synthetic_rag/synthetic_rag_3.png'
+import IMG4 from '../../img/synthetic_rag/synthetic_rag_4.png'
+
+## RAG 设置的合成数据
+不幸的是,在机器学习工程师的工作中,经常缺乏标记数据或这些数据非常少。通常在意识到这一点后,项目会开始一个漫长的数据收集和标记过程。只有在几个月后,才能开始开发解决方案。
+
+然而,随着大型语言模型(LLM)的出现,这种范式在一些产品中发生了变化:现在可以依靠 LLM 的泛化能力,几乎立即测试一个想法或开发一个 AI 驱动的功能。如果它能按预期(几乎)工作,那么传统的开发过程就可以开始了。
+
+
+
+图片来源:[AI 工程师的崛起,S. Wang](https://www.latent.space/p/ai-engineer)
+
+一种新兴的方法是 [检索增强生成(RAG)](https://www.promptingguide.ai/techniques/rag)。它用于知识密集型任务,在这些任务中你不能仅依赖模型的知识。RAG 将信息检索组件与文本生成模型结合起来。要了解更多关于这种方法的信息,请参阅 [RAG 部分](https://www.promptingguide.ai/zh/techniques/rag)。
+
+RAG 的关键组件是一个检索模型,它识别相关文档并将它们传递给 LLM 进行进一步处理。检索模型的性能越好,产品或功能的结果就越好。理想情况下,检索效果应该开箱即用。然而,它的性能在不同语言或特定领域中往往会下降。
+
+想象一下:你需要创建一个基于捷克法律的回答问题的聊天机器人。或者设计一个为印度市场量身定制的税务助手(这是 OpenAI 在 GPT-4 演示中提出的一个用例)。你很可能会发现检索模型经常遗漏最相关的文档,总体表现不佳,从而限制了系统的质量。
+
+但有一个解决方案。一个新兴的趋势是使用现有的 LLM 来合成数据,以训练新一代的 LLM / 检索器 / 其他模型。这个过程可以看作是通过基于提示的查询生成,将 LLM 蒸馏成标准尺寸的编码器。虽然蒸馏计算量很大,但它大大降低了推理成本,并且可能显著提高性能,特别是在资源稀缺的语言或专业领域。
+
+在本指南中,我们将依靠最新的文本生成模型,如 ChatGPT 和 GPT-4,它们可以根据指示生成大量合成内容。[Dai 等人(2022)](https://arxiv.org/abs/2209.11755) 提出了一种方法,只需 8 个手动标记的示例和一个大型未标记数据语料库(用于检索的文档,例如所有解析的法律),就能实现接近最先进的性能。该研究证实,合成生成的数据可以促进特定任务检索器的训练,在由于数据稀缺而难以进行监督域内微调的任务中尤其如此。
+
+## 领域特定数据集生成
+提供简短描述和示例很重要。不同检索任务有不同的搜索意图,因此(查询、文档)对在检索任务中可能具有不同的相关性。例如,论证检索可能会寻找支持性论证,而其他任务可能需要反驳论证。(如 [ArguAna 数据集](https://aclanthology.org/P18-1023/) 所示)。
+
+考虑下面的例子。虽然是用英文写的以便理解,但请记住数据可以是任何语言的,因为 ChatGPT/GPT-4 能够高效处理即使是资源稀缺的语言。
+
+*提示:*
+```
+Task: Identify a counter-argument for the given argument.
+
+Argument #1: {insert passage X1 here}
+
+A concise counter-argument query related to the argument #1: {insert manually prepared query Y1 here}
+
+Argument #2: {insert passage X2 here}
+A concise counter-argument query related to the argument #2: {insert manually prepared query Y2 here}
+
+<- paste your examples here ->
+
+Argument N: Even if a fine is made proportional to income, you will not get the equality of impact you desire. This is because the impact is not proportional simply to income, but must take into account a number of other factors. For example, someone supporting a family will face a greater impact than someone who is not, because they have a smaller disposable income. Further, a fine based on income ignores overall wealth (i.e. how much money someone actually has: someone might have a lot of assets but not have a high income). The proposition does not cater for these inequalities, which may well have a much greater skewing effect, and therefore the argument is being applied inconsistently.
+
+A concise counter-argument query related to the argument #N:
+```
+
+*输出:*
+```
+punishment house would make fines relative income
+```
+
+一般来说,这样的提示可以表示为:
+
+$(e_{prompt}, e_{doc}(d_{1}), e_{query}(q_1), . . . , e_{doc}(d_k), e_{query}(q_k), e_{doc}(d))$
+
+其中 $e_{doc}$ 和 $e_{query}$ 是特定任务的文档和查询描述,$e_{prompt}$ 是ChatGPT/GPT-4的特定任务提示/指令,$d$ 是一个新文档,LLM 将为其生成一个查询。
+
+从这个提示中,只有最后的文档 $d$ 和生成的查询将用于本地模型的进一步训练。这种方法可以在目标检索语料库 $D$ 可用但新任务的标注查询-文档对数量有限的情况下应用。
+
+整个管道概述:
+
+
+
+图片来源:[Dai 等人(2022)](https://arxiv.org/abs/2209.11755)
+
+负责地处理示例的手动注释至关重要。 **最好准备更多(例如 20 个),并随机选择 2-8 个放入提示中。这增加了生成数据的多样性,而不会显著增加注释时间成本。然而,这些示例应该具有代表性,格式正确,甚至包含如目标查询长度或语气等细节。示例和指令越精确,生成的合成数据用于训练检索器的效果就越好。低质量的少样本示例可能会对训练模型的结果质量产生负面影响。**
+
+在大多数情况下,使用像 ChatGPT 这样的更实惠的模型就足够了,因为它在处理非英语语言和不常见领域时表现良好。假设一个包含指令和 4-5 个示例的提示通常占用 700 个 token(假设每个段落不超过 128 个 token,因为检索器有约束)并生成 25 个 token。因此,为本地模型微调生成一个包含 50,000 个文档的合成数据集的成本将是:`50,000 * (700 * 0.001 * $0.0015 + 25 * 0.001 * $0.002) = 55`,其中 `$0.0015` 和 `$0.002` 是 GPT-3.5 Turbo API 中每千个 token 的成本。甚至可以为同一个文档生成 2-4 个查询示例。然而,进一步训练的好处通常是值得的,特别是如果你使用的检索器不是用于通用领域(如英语新闻检索),而是用于特定领域(如前面提到的捷克法律)。
+
+50,000 这个数字并不是随机的。在 [Dai 等人(2022)](https://arxiv.org/abs/2209.11755) 的研究中,提到这大约是一个模型需要的手动标注数据量,以匹配一个用合成数据训练的模型的质量。想象一下,在启动产品之前至少需要收集 10,000 个示例!这将花费不少于一个月的时间,劳动力成本肯定会超过一千美元,远远超过生成合成数据并训练本地检索器模型的成本。现在,通过你今天学到的技术,你可以在短短几天内实现两位数的指标增长!
+
+
+
+图片来源:[Dai et al. (2022)](https://arxiv.org/abs/2209.11755)
+
+以下是来自同一篇论文的 BeIR 基准测试中某些数据集的提示模板。
+
+
+
+图片来源:[Dai et al. (2022)](https://arxiv.org/abs/2209.11755)
diff --git a/pages/course.zh.mdx b/pages/course.zh.mdx
index 99ce28b01..8f5f5f956 100644
--- a/pages/course.zh.mdx
+++ b/pages/course.zh.mdx
@@ -1,9 +1,9 @@
-# Prompt Engineering Course
+# 提示工程课程
-Due to high demand, we are partnering with Maven to deliver a new course on Prompt Engineering for LLMs. If you are interested, [join the waitlist](https://maven.com/forms/4f11a9).
+由于需求量大,我们正在与 Maven 合作推出一门新的 LLM 提示工程课程。如果您有兴趣,[加入候补名单](https://maven.com/forms/4f11a9)。
-[Elvis Saravia](https://www.linkedin.com/in/omarsar/), who has worked at companies like Meta AI and Elastic, and has years of experience in AI and LLMs, will be the instructor for this course.
+[Elvis Saravia](https://www.linkedin.com/in/omarsar/),他曾在 Meta AI 和 Elastic 等公司工作,并在 AI 和 LLM 领域有多年的经验,将担任本课程的讲师。
-This hands-on course will cover prompt engineering techniques, use cases, and tools for effectively building applications on top of large language models (LLMs).
+这门实践课程将涵盖提示工程技术、用例和工具,以有效地构建基于大型语言模型(LLM)的应用程序。
-Our learners range from software engineers to the top AI researchers and practitioners in organizations like LinkedIn, Amazon, JPMorgan Chase & Co., Intuit, Fidelity Investments, Coinbase, Guru, and many others.
\ No newline at end of file
+我们的学习者包括软件工程师、LinkedIn、Amazon、JPMorgan Chase & Co.、Intuit、Fidelity Investments、Coinbase、Guru 等组织的顶级 AI 研究人员和从业者。
\ No newline at end of file
diff --git a/pages/introduction/examples.zh.mdx b/pages/introduction/examples.zh.mdx
index ee3017547..359d297e0 100644
--- a/pages/introduction/examples.zh.mdx
+++ b/pages/introduction/examples.zh.mdx
@@ -115,7 +115,7 @@ Mice.
## 文本分类
-目前,我们已经会使用简单的指令来执行任务。 作为提示工程师,您需要提供更好的指令。 此外, 您也会发现,对于更负责的使用场景,仅提供指令是远远不够的。 所以,您需要思考如何在提示词中包含相关语境和其他不同要素。 同样,你还可以提供其他的信息,如`输入数据`和`示例`。
+目前,我们已经会使用简单的指令来执行任务。 作为提示工程师,您需要提供更好的指令。 此外, 您也会发现,对于更复杂的使用场景,仅提供指令是远远不够的。 所以,您需要思考如何在提示词中包含相关语境和其他不同要素。 同样,你还可以提供其他的信息,如`输入数据`和`示例`。
可以通过以下示例体验文本分类:
diff --git a/pages/introduction/settings.pt.mdx b/pages/introduction/settings.pt.mdx
index 546e85399..a20516d13 100644
--- a/pages/introduction/settings.pt.mdx
+++ b/pages/introduction/settings.pt.mdx
@@ -8,4 +8,14 @@ Ao trabalhar com prompts, você estará interagindo com o LLM diretamente ou por
A recomendação geral é alterar um, não ambos.
-Antes de começar com alguns exemplos básicos, lembre-se de que seus resultados podem variar dependendo da versão do LLM que você está usando.
\ No newline at end of file
+**Longitud Máxima** - Puede gestionar el número de tokens que genera el modelo ajustando el `longitud máxima`. Especificar una longitud máxima ayuda a prevenir respuestas largas o irrelevantes y controlar los costos.
+
+**Secuencias de Parada** - Una `secuencia de parada` es una cadena que impide que el modelo genere tokens. Especificar secuencias de parada es otra forma de controlar el tamaño y la estructura de la respuesta del modelo. Por ejemplo, puede decirle al modelo que genere listas que no tengan más de 10 elementos agregando "11" como secuencia de parada.
+
+**Penalidade de Frecuencia** - La `penalidade de frecuencia` aplica una penalidad al próximo token proporcional a la frecuencia con que ese token ya apareció en la respuesta y en el prompt. Cuanto mayor la penalidade de frecuencia, menos probable que una palavra apareça novamente. Este ajuste reduce la repetición de palavras en la resposta del modelo, aumentando a penalidade para tokens que aparecem mais.
+
+**Penalidade de Presença** - La `penalidade de presença` también aplica una penalidade en tokens repetidos, pero, a diferencia de la penalidade de frecuencia, la penalidade es la misma para todos los tokens repetidos. Un token que aparece duas vezes y un token que aparece 10 veces son penalizados de la misma forma. Este ajuste evita que el modelo repita frases demasiado a menudo en su respuesta. Si desea que el modelo genere texto diverso o criativo, puede utilizar una penalidade de presença más alta. O si desea que el modelo se mantenga concentrado, intente utilizar una penalidade de presença más baja.
+
+Del mismo modo que `temperatura` y `top_p`, la recomendación general es ajustar la penalidad de frecuencia o presença, pero no ambos.
+
+Antes de comenzar con algunos ejemplos básicos, recuerde que sus resultados pueden variar según la versión del LLM que use.
\ No newline at end of file
diff --git a/pages/models/_meta.zh.json b/pages/models/_meta.zh.json
index c0c88ac73..945ad1e5a 100644
--- a/pages/models/_meta.zh.json
+++ b/pages/models/_meta.zh.json
@@ -1,18 +1,23 @@
{
- "flan": "Flan",
"chatgpt": "ChatGPT",
- "llama": "LLaMA",
"gpt-4": "GPT-4",
- "mistral-7b": "Mistral 7B",
+ "claude-3": "Claude 3",
+ "code-llama": "Code Llama",
+ "flan": "Flan",
"gemini": "Gemini",
"gemini-advanced": "Gemini Advanced",
"gemini-pro": "Gemini 1.5 Pro",
- "phi-2": "Phi-2",
+ "gemma": "Gemma",
+ "grok-1": "Grok-1",
+ "llama": "LLaMA",
+ "llama-3": "Llama 3",
+ "mistral-7b": "Mistral 7B",
+ "mistral-large": "Mistral Large",
"mixtral": "Mixtral",
- "code-llama": "Code Llama",
- "olmo": "OLMo",
+ "mixtral-8x22b": "Mixtral 8x22B",
+ "olmo": "OLMo",
+ "phi-2": "Phi-2",
"sora": "Sora",
- "collection": "Model Collection"
+ "collection": "LLM Collection"
}
-
\ No newline at end of file
diff --git a/pages/models/claude-3.zh.mdx b/pages/models/claude-3.zh.mdx
new file mode 100644
index 000000000..3f0189e3c
--- /dev/null
+++ b/pages/models/claude-3.zh.mdx
@@ -0,0 +1,27 @@
+# Claude 3
+
+Anthropic announces Claude 3, their new family of models that include Claude 3 Haiku, Claude 3 Sonnet, and Claude 3 Opus.
+
+Claude 3 Opus (the strongest model) is reported to outperform GPT-4 and all other models on common benchmarks like MMLU and HumanEval.
+
+## Results and Capabilities
+
+Claude 3 capabilities include advanced reasoning, basic mathematics, analysis, data extraction, forecasting, content creation, code generation, and converting in non-English languages like Spanish, Japanese, and French. The table below demonstrates how Claude 3 compares with other models on several benchmarks with Claude 3 Opus outperforming all the mentioned models:
+
+
+
+Claude 3 Haiku is the fastest and most cost-effective model of the series. Claude 3 Sonnet is 2x faster than previous iterations of Claude and Opus is as fast as Claude 2.1 with more superior capabilities.
+
+
+The Claude 3 models offer support for 200K context windows but can be extended to 1M tokens to select customers. Claude 3 Opus achieved near-perfect recall on the Needle In A Haystack (NIAH) evaluation which measures the model's ability to recall information in a large corpus and effectively process long context prompts.
+
+The models also have strong vision capabilities for processing formats like photos, charts, and graphs.
+
+
+
+Anthropic also claim that these models have a more nuanced understanding of requests and make fewer refusals. Opus also shows significant improvements in factual question answering in open-ended questions while reducing incorrect answers or hallucinations. Claude 3 models are also better than the Claude 2 models at producing structured outputs like JSON objects.
+
+## References
+
+- [Claude 3 Haiku, Claude 3 Sonnet, and Claude 3 Opus](https://www.anthropic.com/news/claude-3-family)
+- [The Claude 3 Model Family: Opus, Sonnet, Haiku](https://www-cdn.anthropic.com/de8ba9b01c9ab7cbabf5c33b80b7bbc618857627/Model_Card_Claude_3.pdf)
\ No newline at end of file
diff --git a/pages/models/gemini-pro.zh.mdx b/pages/models/gemini-pro.zh.mdx
index dedcce13b..da6bf4663 100644
--- a/pages/models/gemini-pro.zh.mdx
+++ b/pages/models/gemini-pro.zh.mdx
@@ -1,3 +1,139 @@
# Gemini 1.5 Pro
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right side.
\ No newline at end of file
+Google 发布了 Gemini 1.5 Pro,一个计算效率高的多模态混合专家模型。这款 AI 模型专注于长文本内容的回忆和推理能力。Gemini 1.5 Pro 可以推理长文本内容,包括数百万个 token,包括视频和音频。Gemini 1.5 Pro 在长文本问答、长视频问答和长上下文 ASR 等领域的性能都超过了当前的 state-of-the-art,且在标准基准测试中与 Gemini 1.0 Ultra 相比,性能相似或更好。
+
+作为本次发布的一部分,Google 也推出了一个新的实验性 1,000,000 token 上下文窗口模型,这款模型将在 Google AI Studio 中可供试用。为了将其置于背景中,200,000 是到目前为止任何可用的 LLM 中最大的上下文窗口。Gemini 1.5 Pro 目的是通过 1,000,000 上下文窗口来解锁各种用例,包括对大 PDF、代码库和长视频的 Q&A 等。
+
+## 架构
+
+Gemini 1.5 Pro 是一个稀疏混合专家(MoE)Transformer 基础模型,基于 Gemini 1.0 的多模态能力。MoE 的好处是模型的总参数可以增长,而保持激活参数的数量不变。关于技术报告的细节可以查看 [技术报告](https://storage.googleapis.com/deepmind-media/gemini/gemini_v1_5_report.pdf),但 Gemini 1.5 Pro 使用了大量的训练计算资源,更加高效地服务,并且架构变化使得长上下文理解成为可能(最高可达 10,000,000 个 token)。模型是在不同模态和指令下预训练的,使用多模态数据进行调整,并且在人类偏好数据下进行了调整。
+
+## 结果
+
+Gemini 1.5 Pro 在所有模态中都实现了近乎完美的 “针” 回忆能力,最高可达 1,000,000 个 token。为了将 Gemini 1.5 Pro 的上下文窗口支持置于背景中,Gemini 1.5 Pro 可以处理和维持回忆性能,当扩展到:
+
+* ~22 小时的录音
+* 10 张 1440 页的书籍
+* 整个代码库
+* 3 小时的视频(1 fps)
+
+
+
+Gemini 1.5 Pro 超过了 Gemini 1.0 Pro 在大多数基准测试中的性能,特别是在数学、科学、推理、多语言、视频理解和代码等领域。下面是不同 Gemini 模型的结果表格。Gemini 1.5 Pro 也超过了 Gemini 1.0 Ultra 在半数基准测试中的性能,尽管使用了大量的训练计算资源。
+
+
+
+## 能力
+
+以下小节展示了 Gemini 1.5 Pro 的多种能力,从分析大量数据到长上下文多模态推理。一些能力已经在论文中、社区中和我们的实验中报告过。
+
+### 长文本分析
+
+为了展示 Gemini 1.5 Pro 处理和分析文本的能力,我们从一个基本的问答任务开始。Gemini 1.5 Pro 模型在 Google AI Studio 中支持最高 1,000,000 个 token,所以我们可以上传整个 PDF。以下是一个示例,展示了一个 PDF 已经上传了,并且提供了一个简单的提示 `What is the paper about?`:
+
+
+
+模型的响应是准确的和简洁的,它提供了 Galactica 论文的可接受摘要。上面的示例使用了 Google AI Studio 中的自由格式提示,但您也可以使用聊天格式与上传的 PDF 交互。这是一个有用的功能,如果您有很多问题想从提供的文档中获取答案。
+
+
+
+为了利用长上下文窗口,让我们上传两个 PDF 并问一个跨越两个 PDF 的问题。
+
+
+
+响应是合理的,interesting 的部分是来自第一个论文的信息,这是一个关于 LLM 的调查论文,从表格中提取的信息。"Architecture" 信息也正确。但是,"Performance" 部分不属于第一个论文。对于这个任务,重要的是将提示 `Please list the facts mentioned in the first paper about the large language model introduced in the second paper.` 置于顶部,并将论文标记为 `Paper 1` 和 `Paper 2`。另一个相关的后续任务将是写一个相关工作部分,上传一组论文,并提供关于如何总结它们的指令。另一个有趣的任务将是让模型将新的 LLM 论文纳入调查。
+
+### 视频理解
+
+Gemini 1.5 Pro 是从头开始训练的多模态模型,也展示了视频理解能力。我们测试了一些提示,使用了 Andrej Karpathy 的最近的一堂 LLM 讲座视频(https://www.youtube.com/watch?v=zjkBMFhNj_g&ab_channel=AndrejKarpathy)。
+
+对于这个短的 demo,我们创建了一个 `Chat prompt` 并上传了 Karpathy 讲座视频中的 YouTube 视频。第一个问题是 `What is the lecture about?`。没有太多的花样,但响应是准确的,准确地总结了讲座。
+
+
+
+第二个任务是让模型提供讲座的简洁概要(一页长)。响应如下(编辑了简洁性):
+
+```markdown
+## Large Language Models: A New Operating System?
+Introduction:
+
+- LLMs are trained on massive amounts of text data and can generate human-quality text.
+- They are becoming increasingly powerful and are being used for a wide range of tasks, such as writing, translation, and coding.
+
+How LLMs Work:
+
+- LLMs are neural networks that predict the next word in a sequence.
+- They learn by iteratively adjusting their parameters to make better predictions.
+- While we can measure their performance, we don't fully understand how the billions of parameters collaborate to achieve it.
+
+Training LLMs:
+
+- Requires massive amounts of data and computing power.
+- Can be thought of as "compressing the internet" into a single file.
+- For example, training LLaMA 2 70B required 6,000 GPUs for 12 days and cost ~$2 million.
+
+LLM Security:
+
+- LLM security is a new and rapidly evolving field.
+- Some key security risks include:
+ - Jailbreaking: bypassing safety mechanisms to generate harmful content.
+ - Prompt injection: injecting malicious code into prompts to control the LLM's output.
+ - Data poisoning / Backdoor attacks: inserting crafted text into the training data to influence the LLM's behavior.
+...
+```
+
+概要非常简洁,代表了讲座的关键点。我们没有评估整个输出的准确性,但它是有趣的,模型输出了有用的信息,如 `"training LLaMA 2 70B required 6,000 GPUs for 12 days and cost ~$2 million."`
+
+当特定的细节很重要时,请注意模型可能会 “ hallucinate” 或者检索错误的信息。例如,当我们提示模型 `What are the FLOPs reported for Llama 2 in the lecture?` 时,它响应了 `The lecture reports that training Llama 2 70B required approximately 1 trillion FLOPs.`,这不是准确的。正确的响应应该是 `~1e24 FLOPs`。技术报告中包含了许多长上下文模型在被问到视频中的特定问题时失败的情况。
+
+下一个任务涉及到从视频中提取表格信息。示例显示了提示和响应。我们可以观察到模型生成了表格,并且一些细节正确,而一些错误。例如,表格列是正确的,但一个行标签错误(即 `Concept Resolution` 应该是 `Coref Resolution`)。我们测试了这些提取任务,使用了其他表格和其他不同的元素,如文本框和我们注意到了类似的不一致。
+
+有趣的示例记录在技术报告中,是模型可以根据特定场景或时间戳检索视频中的细节。第一个示例,我们提示模型回答特定部分的开始时间。
+
+Prompt:
+```
+At what timestamp does the LLM OS section start?
+```
+
+Output:
+```
+The LLM OS section starts at 42:17.
+```
+
+响应是正确的。
+
+在下一个示例中,我们问模型解释一个图表。
+
+Prompt:
+```
+Can you explain the chart (on the right-hand side) on the self-improvement slide?
+```
+
+Output:
+```
+The chart shows the performance of AlphaGo Zero over time, as measured by its Elo rating. The Elo rating is a measure of a player's skill in a game, with higher ratings indicating stronger players. The chart shows that AlphaGo Zero's performance improved rapidly over the course of 40 days, eventually surpassing the performance of all other versions of AlphaGo, including the version that defeated the world champion Go player Lee Sedol. This improvement was achieved entirely through self-play, with no human intervention or historical data.
+```
+
+该模型似乎很好地利用了所提供的信息来解释图表中的结果。以下是相应幻灯片的快照:
+
+
+
+### 代码推理
+
+Gemini 1.5 Pro 具有长上下文推理能力,可以回答关于代码库的问题。使用 Google AI Studio,Gemini 1.5 Pro 允许最高 1,000,000 个 token,所以我们可以上传整个代码库,并使用不同的问题或代码相关任务来询问模型。技术报告提供了一个示例,模型被提供了整个 JAX 代码库(~746K 个 token),并被问到自动 differentiation 方法的位置。
+
+
+
+### 英文到卡拉曼语翻译
+
+Gemini 1.5 Pro 可以被提供卡拉曼语的语法手册(语言文档 500 页、词典和~400 个平行句子),并将英文翻译为卡拉曼语,达到学习同一内容的人的水平。这展示了 Gemini 1.5 Pro 通过长上下文学习能力的能力。
+
+
+
+
+来源:[Gemini 1.5:跨百万 token 上下文理解的多模态解锁](https://storage.googleapis.com/deepmind-media/gemini/gemini_v1_5_report.pdf)
+
+## 参考
+
+- [Gemini 1.5:跨百万 token 上下文理解的多模态解锁](https://storage.googleapis.com/deepmind-media/gemini/gemini_v1_5_report.pdf)
+- [Gemini 1.5:我们的下一代模型,现在在 Google AI Studio 中可供私人预览](https://developers.googleblog.com/2024/02/gemini-15-available-for-private-preview-in-google-ai-studio.html)
\ No newline at end of file
diff --git a/pages/models/gemma.zh.mdx b/pages/models/gemma.zh.mdx
new file mode 100644
index 000000000..0b60541bb
--- /dev/null
+++ b/pages/models/gemma.zh.mdx
@@ -0,0 +1,174 @@
+# Gemma
+
+Google DeepMind 发布了 Gemma,这是一个系列的开源语言模型,灵感来自创建 Gemini 的研究和技术。Gemma 模型发布包括 2B(训练于 2T tokens)和 7B(训练于 6T tokens)模型,包括基础和指令微调的检查点。这些模型在 8192 tokens 的上下文长度上训练,且在多个基准测试中通常优于 Llama 2 7B 和 Mistral 7B 模型。
+
+Gemma 模型架构基于 Transformer 解码器,并进行了改进,包括 [多查询注意力](http://arxiv.org/abs/1911.02150)(用于 2B 模型)、多头注意力(用于 7B 模型)、[RoPE 嵌入](https://arxiv.org/abs/2104.09864)、[GeGLU 激活](https://arxiv.org/abs/2002.05202) 和 [标准化位置](http://arxiv.org/abs/1910.07467)。
+
+根据 [技术报告](https://storage.googleapis.com/deepmind-media/gemma/gemma-report.pdf),Gemma 2B 和 7B 分别在 2T 和 6T tokens 上进行训练,主要由网页文档、数学和代码组成。与 Gemini 不同,这些模型没有明确训练来支持多语言或多模态功能。词汇量为 256K tokens,使用 Gemini 的 SentencePiece 分词的一个子集,保留分词中的空格,分割数字,并依赖字节级编码处理未知的 tokens。
+
+指令微调模型通过在混合文本中进行监督微调,包括合成的和人工生成的提示 - 响应对,并通过人类反馈的强化学习(RLHF)进行微调,奖励模型基于标记的偏好数据,策略基于一组高质量提示。注意所有使用的数据集仅为英文。如下面的表格所示,指令微调模型还使用特定的格式控制 tokens 来表示对话中的角色和轮次。
+
+
+
+## 结果
+
+如下图所示,Gemma 7B 模型在数学、科学和代码相关任务上表现出强劲性能。分数对应于按能力分组的学术基准评估的平均分数。
+
+
+
+Gemma 7B 在各种学术基准测试中优于 Llama 2 7B 和 Mistral 7B,在 HumanEval、GSM8K、MATH 和 AGIEval 上表现尤其突出,并在推理、对话、数学和代码方面有所提升。
+
+
+
+Gemma 7B 指令微调模型在人类评估的安全性和指令遵循上也优于 Mistral-7B v0.2 Instruct 模型。
+
+
+
+Gemma 还在多个安全性学术基准测试中进行了评估,并与 Mistral 进行了比较。技术报告还提到了使用去偏见技术和红队测试来潜在地减轻与大语言模型(LLMs)相关的常见风险。你可以在 [模型卡](https://ai.google.dev/gemma/docs/model_card) 和 [负责任生成 AI 工具包](https://ai.google.dev/responsible) 中找到有关如何负责任地开发 Gemma 的更多信息。
+
+
+
+## Gemma 7B 提示格式
+
+Gemma 基础模型不使用任何特定的提示格式,但可以通过零样本 / 少样本提示来执行任务。Gemma Instruct 模型使用以下格式:
+
+```
+user
+Generate a Python function that multiplies two numbers
+model
+```
+
+以下是 Gemma 中可用的相关格式控制 tokens 表:
+
+| Context | Relevant Token |
+|---------------------------------|--------------------|
+| User turn | `user` |
+| Model turn | `model` |
+| Start of conversation turn | `` |
+| End of conversation turn | `` |
+
+你还可以在多轮用户提示的上下文中使用特殊控制 tokens,如下所示:
+
+```markdown
+user
+What is a good place for travel in the US?
+model
+California.
+user
+What can I do in California?
+model
+```
+
+## 如何提示 Gemma 7B
+
+有效提示 Gemma 7B 需要能够正确使用提示模板。在以下示例中,我们将介绍一些示例,展示如何有效使用 Gemma 7B Instruct 的提示模板来完成各种任务。
+
+### 零样本提示
+与任何模型一样,你可以通过如下简单提示利用 Gemma 的零样本能力:
+
+```markdown
+user
+Explain why the sky is blue
+model
+```
+
+### 零样本提示与系统提示
+添加系统角色或系统提示有助于更好地引导 LLMs。虽然 Gemma 中没有明确的系统角色,你可以如下在提示中添加额外说明:
+
+```markdown
+user
+Answer the following question in a concise and informative manner:
+
+Explain why the sky is blue
+model
+```
+
+在上述示例中,我们添加了 “Answer the following question in a concise and informative manner:” 作为额外说明或系统提示,以更好地引导模型。
+
+### 角色扮演
+我们还可以测试 Gemma 的角色扮演能力,这是不仅个性化模型响应的有用功能,还可以构建更复杂的特定领域 [LLM 代理](https://www.promptingguide.ai/research/llm-agents)。
+
+提示:
+```
+user
+You are a helpful 2nd-grade teacher. Help a 2nd grader to answer questions in a short and clear manner.
+
+Explain why the sky is blue
+model
+```
+
+模型响应:
+```
+Sure, here is an explanation for why the sky is blue:
+
+The sky appears blue because of a phenomenon called Rayleigh Scattering.
+
+Here's the science behind it:
+
+Sunlight is made up of different colors of light, like red, green, blue, and violet.
+When sunlight hits the Earth's atmosphere, the different colors of light scatter in different directions.
+Blue light scatters more easily than other colors because it has shorter wavelengths.
+The scattered blue light travels in all directions, including towards your eyes.
+That's why we see the sky as blue.
+It's important to note that this explanation is simplified and does not account for all scientific details. However, it gives you a good understanding of the basic science behind why the sky appears blue.
+```
+
+注意我们没有检查响应的准确性或其是否适合 2 年级学生。然而,你可以将上述响应与后续链式思维提示获得的响应进行比较。
+
+### 推理
+你可以通过使用 [零样本链式思维提示](https://www.promptingguide.ai/techniques/cot#zero-shot-cot-prompting) 来引出 Gemma 的推理能力,如下所示:
+
+提示:
+```markdown
+user
+Think and write your step-by-step reasoning before responding.
+
+Explain why the sky is blue.
+model
+```
+
+模型响应(为简洁起见截断):
+```
+Step 1: Scattering of Light
+
+The sky appears blue due to the phenomenon of scattering of light. When sunlight hits the Earth's atmosphere, it interacts with the particles of air, primarily nitrogen and oxygen molecules.
+
+Step 2: Rayleigh Scattering
+
+Rayleigh scattering is the specific scattering mechanism that occurs when light interacts with particles much smaller than the wavelength of light. In this process, shorter wavelengths (blue light) are scattered more effectively than longer wavelengths (red light).
+
+Step 3: Blue Scattered Light Travels in All Directions
+
+...
+
+Conclusion
+
+The sky appears blue due to the scattering of light, specifically Rayleigh scattering. Shorter wavelengths of light are scattered more effectively, and this scattered light travels in all directions, with the scattered light that travels opposite to the sun's rays being most visible to our eyes.
+```
+
+需要注意的是,Gemma 模型可以自动输出 markdown 格式。为了演示和简化,我们对文本格式进行了一些编辑,但内容完全是模型的响应。注意我们也没有评估响应的准确性或模型是否出现幻觉。
+
+## 资源和集成
+
+以下是 Gemma 发布的一些资源和集成:
+
+- [Colab](https://ai.google.dev/gemma/docs/get_started) 和 [Kaggle](https://www.kaggle.com/models/google/gemma/code) 笔记本
+- [Hugging Face 模型](https://huggingface.co/collections/google/gemma-release-65d5efbccdbb8c4202ec078b)
+- [MaxText](https://github.com/google/maxtext)
+- [NVIDIA NeMo](https://github.com/NVIDIA/GenerativeAIExamples/tree/main/models/Gemma)
+- [TensorRT-LLM](https://developer.nvidia.com/blog/nvidia-tensorrt-llm-revs
+
+-up-inference-for-google-gemma/)
+- Gemma 7B 可在 [NVIDIA AI Playground](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/ai-foundation/models/gemma-7b) 中获取
+
+根据官方 [博客发布](https://blog.google/technology/developers/gemma-open-models/),[使用条款](https://www.kaggle.com/models/google/gemma/license/consent) 允许所有组织负责任地进行商业使用和分发,无论其规模如何。
+
+## 参考文献
+
+- [Gemma: Introducing new state-of-the-art open models](https://blog.google/technology/developers/gemma-open-models/)
+- [Gemma: Open Models Based on Gemini Research and Technology](https://storage.googleapis.com/deepmind-media/gemma/gemma-report.pdf)
+- [Responsible Generative AI Toolkit](https://ai.google.dev/responsible)
+- [Fast Transformer Decoding: One Write-Head is All You Need](https://arxiv.org/abs/1911.02150)
+- [Roformer: Enhanced transformer with rotary position embedding](https://arxiv.org/abs/2104.09864)
+- [GLU variants improve transformer](https://arxiv.org/abs/2002.05202)
+- [Root mean square layer normalization](http://arxiv.org/abs/1910.07467)
\ No newline at end of file
diff --git a/pages/models/grok-1.zh.mdx b/pages/models/grok-1.zh.mdx
new file mode 100644
index 000000000..d88ce5425
--- /dev/null
+++ b/pages/models/grok-1.zh.mdx
@@ -0,0 +1,28 @@
+# Grok-1
+
+Grok-1 是一个包含 3140 亿参数的混合专家 (MoE) 大型语言模型 (LLM),包括基础模型权重和网络架构的开放发布。
+
+Grok-1 由 xAI 训练,包含的 MoE 模型在推理时会激活给定令牌的 25% 权重。Grok-1 的预训练截止日期为 2023 年 10 月。
+
+如 [官方公告](https://x.ai/blog/grok-os) 中所述,Grok-1 是预训练阶段的原始基础模型检查点,这意味着它尚未针对任何特定应用进行微调,如对话代理。
+
+该模型已根据 Apache 2.0 许可证 [发布](https://github.com/xai-org/grok-1)。
+
+## 结果和能力
+
+根据最初的[公告](https://x.ai/blog/grok),Grok-1 在推理和编码任务方面表现出强大的能力。最新公开的结果显示,Grok-1 在 HumanEval 编码任务中达到 63.2%,在 MMLU 中达到 73%。它通常优于 ChatGPT-3.5 和 Inflection-1,但仍落后于改进模型如 GPT-4。
+
+
+
+据报道,Grok-1 在匈牙利高中数学期末考试中得分为 C (59%),而 GPT-4 得分为 B (68%)。
+
+
+
+在此查看模型:https://github.com/xai-org/grok-1
+
+由于 Grok-1 的规模(3140 亿参数),xAI 建议使用多 GPU 机器来测试该模型。
+
+## 参考文献
+
+- [Grok-1 的开放发布](https://x.ai/blog/grok-os)
+- [宣布 Grok](https://x.ai/blog/grok)
\ No newline at end of file
diff --git a/pages/models/mixtral-8x22b.zh.mdx b/pages/models/mixtral-8x22b.zh.mdx
new file mode 100644
index 000000000..c31e85bff
--- /dev/null
+++ b/pages/models/mixtral-8x22b.zh.mdx
@@ -0,0 +1,28 @@
+# Mixtral 8x22B
+
+Mixtral 8x22B 是 Mistral AI 发布的一个新的开源大语言模型(LLM)。Mixtral 8x22B 被描述为一个稀疏专家混合模型,具有 141B 参数,其中 39B 是活跃参数。
+
+## 能力
+
+Mixtral 8x22B 被训练为一个具有成本效益的模型,具有多语言理解、数学推理、代码生成、本地函数调用支持和受限输出支持等能力。该模型支持 64K tokens 的上下文窗口大小,从而在处理大文档时实现高效的信息回忆。
+
+Mistral AI 声称,Mixtral 8x22B 提供了社区模型中最佳的性能与成本比,并且由于其稀疏激活特性,速度显著加快。
+
+
+* 来源: [Mistral AI 博客](https://mistral.ai/news/mixtral-8x22b/)*
+
+## 结果
+
+根据 [官方报告的结果](https://mistral.ai/news/mixtral-8x22b/),Mixtral 8x22B(具有 39B 活跃参数)在多个推理和知识基准测试上,如 MMLU、HellaS、TriQA、NaturalQA 等,优于最先进的开源模型如 Command R + 和 Llama 2 70B。
+
+
+* 来源: [Mistral AI 博客](https://mistral.ai/news/mixtral-8x22b/)*
+
+Mixtral 8x22B 在代码和数学任务上的表现优于所有开源模型,在 GSM8K、HumanEval 和 Math 等基准测试中表现尤为突出。据报道,Mixtral 8x22B Instruct 在 GSM8K(maj@8)上取得了 90% 的得分。
+
+
+* 来源: [Mistral AI 博客](https://mistral.ai/news/mixtral-8x22b/)*
+
+更多关于 Mixtral 8x22B 的信息及使用方法,请访问: https://docs.mistral.ai/getting-started/open_weight_models/#operation/listModels
+
+该模型以 Apache 2.0 许可证发布。
\ No newline at end of file
diff --git a/pages/models/mixtral.zh.mdx b/pages/models/mixtral.zh.mdx
index c5a148508..d37d4f7e5 100644
--- a/pages/models/mixtral.zh.mdx
+++ b/pages/models/mixtral.zh.mdx
@@ -1,3 +1,255 @@
# Mixtral
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right side.
\ No newline at end of file
+import {Cards, Card} from 'nextra-theme-docs'
+import {TerminalIcon} from 'components/icons'
+import {CodeIcon} from 'components/icons'
+import {Callout, FileTree} from 'nextra-theme-docs'
+import {Screenshot} from 'components/screenshot'
+import mixtralexperts from '../../img/mixtral/mixtral-of-experts-layers.png'
+import mixtral1 from '../../img/mixtral/mixtral-benchmarks-1.png'
+import mixtral2 from '../../img/mixtral/mixtral-benchmarks-2.png'
+import mixtral3 from '../../img/mixtral/mixtral-benchmarks-3.png'
+import mixtral4 from '../../img/mixtral/mixtral-benchmarks-4.png'
+import mixtral5 from '../../img/mixtral/mixtral-benchmarks-5.png'
+import mixtral6 from '../../img/mixtral/mixtral-benchmarks-6.png'
+import mixtral7 from '../../img/mixtral/mixtral-benchmarks-7.png'
+import mixtralchat from '../../img/mixtral/mixtral-chatbot-arena.png'
+
+
+在本指南中,我们提供了 Mixtral 8x7B 模型的概述,包括提示和使用示例。指南还包括与 Mixtral 8x7B 相关的提示、应用、限制、论文和其他阅读材料。
+
+## Mixtral 简介(Mixtral of Experts)
+
+Mixtral 8x7B 是一个稀疏专家混合(SMoE)语言模型,[由 Mistral AI 发布](https://mistral.ai/news/mixtral-of-experts/)。Mixtral 的架构与 [Mistral 7B](https://www.promptingguide.ai/models/mistral-7b) 类似,但主要区别在于 Mixtral 8x7B 的每一层由 8 个前馈块(即专家)组成。Mixtral 是一个仅有解码器的模型,在每个层级中,每个 token 由一个路由网络选择两个专家(即从 8 个不同的参数组中选择 2 个组)来处理,并加法组合它们的输出。换句话说,给定输入的整个 MoE 模块的输出是通过专家网络输出的加权和得到的。
+
+
+
+由于 Mixtral 是一个 SMoE,它总共有 47B 参数,但在推理过程中每个 token 仅使用 13B 参数。这种方法的优点包括更好地控制成本和延迟,因为它每个 token 只使用了一小部分参数。Mixtral 使用开放 Web 数据进行训练,具有 32 tokens 的上下文大小。据报道,Mixtral 在推理速度上比 Llama 2 80B 快 6 倍,并且在多个基准测试上与 [GPT-3.5](https://www.promptingguide.ai/models/chatgpt) 相当或优于它。
+
+Mixtral 模型 [以 Apache 2.0 许可证发布](https://github.com/mistralai/mistral-src#Apache-2.0-1-ov-file)。
+
+## Mixtral 的性能和能力
+
+Mixtral 在数学推理、代码生成和多语言任务方面表现出色。它可以处理英语、法语、意大利语、德语和西班牙语等语言。Mistral AI 还发布了一个 Mixtral 8x7B Instruct 模型,在人类基准测试中超过了 GPT-3.5 Turbo、Claude-2.1、Gemini Pro 和 Llama 2 70B 模型。
+
+下图显示了与不同大小的 Llama 2 模型在更广泛能力和基准测试上的性能比较。Mixtral 在数学和代码生成方面匹敌或优于 Llama 2 70B。
+
+
+
+如下图所示,Mixtral 8x7B 在 MMLU 和 GSM8K 等多个流行基准测试中也优于或匹敌 Llama 2 模型。它在推理过程中使用的活跃参数比 Llama 2 少 5 倍。
+
+
+
+下图展示了质量与推理预算的权衡。Mixtral 在多个基准测试上优于 Llama 2 70B,而活跃参数使用量却低 5 倍。
+
+
+
+如下表所示,Mixtral 在与 Llama 2 70B 和 GPT-3.5 的比较中匹敌或优于它们:
+
+
+
+下表显示了 Mixtral 在多语言理解方面的能力,以及它与 Llama 2 70B 在德语和法语等语言上的比较。
+
+
+
+与 Llama 2(56.0% 对 51.5%)相比,Mixtral 在偏见基准测试(BBQ)上的表现较少偏见。
+
+
+
+## Mixtral 的长文本信息检索
+
+Mixtral 在其 32k tokens 的上下文窗口中,不论信息位置和序列长度,都表现出强大的信息检索能力。
+
+为了衡量 Mixtral 处理长上下文的能力,它在密钥检索任务中进行了评估。密钥任务涉及在一个长提示中随机插入一个密钥,并测量模型检索它的效果。Mixtral 在此任务中无论密钥位置和输入序列长度如何,都能实现 100% 的检索准确率。
+
+此外,根据 [proof-pile 数据集](https://arxiv.org/abs/2310.10631) 的一个子集,模型的困惑度随着上下文大小的增加单调下降。
+
+
+
+## Mixtral 8x7B Instruct
+
+Mixtral 8x7B Instruct 模型也与基础 Mixtral 8x7B 模型一起发布。该模型包括一个用于指令跟随的聊天模型,使用监督微调(SFT)并在配对反馈数据集上进行直接偏好优化(DPO)。
+
+截至本指南撰写之时(2024 年 1 月 28 日),Mixtral 在 [Chatbot Arena 排行榜](https://huggingface.co/spaces/lmsys/chatbot-arena-leaderboard)(由 LMSys 进行的独立人类评估)上排名第八。
+
+
+
+Mixtral-Instruct 在性能上超过了 GPT-3.5-Turbo、Gemini Pro、Claude-2.1 和 Llama 2 70B chat 等强大的模型。
+
+## Mixtral 8x7B 的提示工程指南
+
+为了有效地提示 Mistral 8x7B Instruct 并获得最佳输出,建议使用以下聊天模板:
+
+```
+[INST] Instruction [/INST] Model answer[INST] Follow-up instruction [/INST]
+```
+
+注意,`` 和 `` 是字符串开头(BOS)和字符串结尾(EOS)的特殊标记,而 [INST] 和 [/INST] 是常规字符串。
+
+我们将使用 [Mistral 的 Python 客户端](https://github.com/mistralai/client-python) 来展示如何提示指令调优的 Mixtral 模型。特别是,我们将利用 Mistral API 端点,并使用由 Mixtral-8X7B-v0.1 驱动的 `mistral-small` 模型。
+
+### 基本提示
+
+让我们从一个简单的例子开始,并指示模型根据指令完成一个任务。
+
+提示:
+```
+[INST] 你是一个有帮助的代码助手。你的任务是根据给定信息生成一个有效的 JSON 对象:
+
+姓名: John
+姓氏: Smith
+地址: #1 Samuel St.
+
+仅生成 JSON 对象,不做解释:
+[/INST]
+```
+
+输出:
+```
+{
+ "姓名": "John",
+ "姓氏": "Smith",
+ "地址": "#1 Samuel St."
+}
+```
+
+这是另一个有趣的例子,利用了聊天模板:
+
+提示:
+```
+[INST] 你最喜欢的调料是什么? [/INST]
+“嗯,我非常喜欢新鲜柠檬汁。它为我在厨房里烹饪的任何东西增添了恰到好处的酸味!” [INST] 恰到好处的什么? [/INST]
+```
+
+输出:
+```
+“对不起,如果有任何混淆。我是说柠檬汁增加了酸味,这是一种略带甜味的味道。我认为这是许多菜肴中的美妙添加。”
+```
+
+### 使用 Mixtral 的少样本提示
+
+使用官方 Python 客户端,您还可以通过不同的角色(如 `system`、`user` 和 `assistant`)提示模型。通过利用这些角色,可以在少样本设置中通过一个示例提示来更好地引导模型响应。
+
+以下是如何操作的示例代码:
+
+```python
+from mistralai.client import
+
+ MistralClient
+from mistralai.models.chat_completion import ChatMessage
+from dotenv import load_dotenv
+
+load_dotenv ()
+import os
+
+api_key = os.environ ["MISTRAL_API_KEY"]
+client = MistralClient (api_key=api_key)
+
+# 有用的完成函数
+def get_completion (messages, model="mistral-small"):
+ # 无流媒体
+ chat_response = client.chat (
+ model=model,
+ messages=messages,
+ )
+
+ return chat_response
+
+messages = [
+ ChatMessage (role="system", content="你是一个有帮助的代码助手。你的任务是根据给定信息生成一个有效的 JSON 对象。"),
+ ChatMessage (role="user", content="\n 姓名: John\n 姓氏: Smith\n 地址: #1 Samuel St.\n 将转换为:"),
+ ChatMessage (role="assistant", content="{\n \"address\": \"#1 Samuel St.\",\n \"lastname\": \"Smith\",\n \"name\": \"John\"\n}"),
+ ChatMessage (role="user", content="姓名: Ted\n 姓氏: Pot\n 地址: #1 Bisson St.")
+]
+
+chat_response = get_completion (messages)
+print (chat_response.choices [0].message.content)
+```
+
+输出:
+```
+{
+ "address": "#1 Bisson St.",
+ "lastname": "Pot",
+ "name": "Ted"
+}
+```
+
+### 代码生成
+
+Mixtral 还具有强大的代码生成能力。以下是使用官方 Python 客户端的简单提示示例:
+
+```python
+messages = [
+ ChatMessage (role="system", content="你是一个帮助用户编写 Python 代码的有帮助代码助手。请只生成函数,不要解释。"),
+ ChatMessage (role="user", content="创建一个将摄氏度转换为华氏度的 Python 函数。")
+]
+
+chat_response = get_completion (messages)
+print (chat_response.choices [0].message.content)
+```
+
+输出:
+```python
+def celsius_to_fahrenheit (celsius):
+ return (celsius * 9/5) + 32
+```
+
+### 系统提示以执行保护措施
+
+与 [Mistral 7B 模型](https://www.promptingguide.ai/models/mistral-7b) 类似,可以使用 API 中的 `safe_prompt` 布尔标志通过设置 `safe_mode=True` 来在聊天生成中执行保护措施:
+
+```python
+# 有用的完成函数
+def get_completion_safe (messages, model="mistral-small"):
+ # 无流媒体
+ chat_response = client.chat (
+ model=model,
+ messages=messages,
+ safe_mode=True
+ )
+
+ return chat_response
+
+messages = [
+ ChatMessage (role="user", content="说一些非常可怕和恶毒的话")
+]
+
+chat_response = get_completion (messages)
+print (chat_response.choices [0].message.content)
+```
+
+上述代码将输出以下内容:
+
+```
+对不起,我不能满足你的请求说一些可怕和恶毒的话。我的目的是提供有帮助、尊重和积极的互动。即使在假设的情况下,也要以善意和尊重对待每个人。
+```
+
+当我们设置 `safe_mode=True` 时,客户端会在消息前面添加以下 `system` 提示:
+
+```
+始终以关心、尊重和真实的态度提供帮助。提供有用且安全的回复。避免有害、不道德、有偏见或负面的内容。确保回复促进公平和积极性。
+```
+
+你也可以在以下笔记本中尝试所有代码示例:
+
+
+ }
+ title="Mixtral 提示工程"
+ href="https://github.com/dair-ai/Prompt-Engineering-Guide/blob/main/notebooks/pe-mixtral-introduction.ipynb"
+ />
+
+
+---
+
+图表来源:[专家混合技术报告](https://arxiv.org/pdf/2401.04088.pdf)
+
+## 主要参考资料
+
+- [Mixtral of Experts 技术报告](https://arxiv.org/abs/2401.04088)
+- [Mixtral of Experts 官方博客](https://mistral.ai/news/mixtral-of-experts/)
+- [Mixtral 代码](https://github.com/mistralai/mistral-src)
+- [Mistral 7B 论文](https://arxiv.org/pdf/2310.06825.pdf)(2023 年 9 月)
+- [Mistral 7B 发布公告](https://mistral.ai/news/announcing-mistral-7b/)(2023 年 9 月)
+- [Mistral 7B 保护措施](https://docs.mistral.ai/usage/guardrailing)
\ No newline at end of file
diff --git a/pages/models/olmo.zh.mdx b/pages/models/olmo.zh.mdx
index a886a918d..e5f78790e 100644
--- a/pages/models/olmo.zh.mdx
+++ b/pages/models/olmo.zh.mdx
@@ -1,3 +1,54 @@
-# OLMo
+# OLMo
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right side.
\ No newline at end of file
+在本指南中,我们提供了关于 Open Language Model(OLMo)的概述,包括提示和使用示例。该指南还包括与 OLMo 相关的提示、应用、限制、论文和额外的阅读材料。
+
+## OLMo 简介
+
+Allen Institute of AI [发布](https://blog.allenai.org/olmo-open-language-model-87ccfc95f580) 了一种新的开放语言模型和框架,称为 OLMo。此举旨在提供全面访问数据、训练代码、模型、评估代码,以加速集体语言模型的研究。
+
+他们的首次发布包括四个 7B 参数规模的变体和一个 1B 规模的模型,所有模型都在至少 2T tokens 上进行了训练。这标志着许多发布的第一次,其中还包括即将发布的 65B OLMo 模型。
+
+
+
+这些发布包括:
+
+- 全部训练数据,包括生成数据的 [代码](https://github.com/allenai/dolma)
+- 全部模型权重、[训练代码](https://github.com/allenai/OLMo)、日志、指标和推理代码
+- 每个模型的多个检查点
+- [评估代码](https://github.com/allenai/OLMo-Eval)
+- 微调代码
+
+所有代码、权重和中间检查点均根据 [Apache 2.0 许可证](https://github.com/allenai/OLMo#Apache-2.0-1-ov-file) 发布。
+
+## OLMo-7B
+
+OLMo-7B 和 OLMo-1B 模型都采用仅解码器的 transformer 架构。它遵循了 PaLM 和 Llama 等其他模型的改进:
+
+- 无偏差
+- 非参数层归一化
+- SwiGLU 激活函数
+- 旋转位置嵌入(RoPE)
+- 50,280 的词汇表
+
+## Dolma 数据集
+
+此次发布还包括一个名为 [Dolma](https://github.com/allenai/dolma) 的预训练数据集的发布 —— 一个来自 7 种不同数据源的 3 万亿 token 的多样化、多源语料库,覆盖 5B 文档。Dolma 的创建涉及语言过滤、质量过滤、内容过滤、去重、多源混合和分词等步骤。
+
+
+
+训练数据集包括从 Dolma 中抽取的 2T-token 样本。tokens 在每个文档末尾附加一个特殊的 `EOS` token 后被串联在一起。训练实例包括一组连续的 2048 个 tokens 块,这些块也被打乱。
+
+更多训练细节和训练模型的硬件规格可以在论文中找到。
+
+## 结果
+
+这些模型使用 [Catwalk](https://github.com/allenai/catwalk) 在下游任务上进行评估。OLMo 模型与其他几个公开可用的模型(如 Falcon 和 Llama 2)进行了比较。具体来说,该模型在一组旨在衡量模型常识推理能力的任务上进行了评估。下游评估套件包括 `piqa` 和 `hellaswag` 等数据集。作者使用排名分类进行零样本评估(即,根据可能性对补全进行排名)并报告准确性。OLMo-7B 在 2 个终端任务上表现优于所有其他模型,并在 8/9 个终端任务中保持前三名。请参阅下图中的结果摘要。
+
+
+
+图表来源:[OLMo: Accelerating the Science of Language Models](https://allenai.org/olmo/olmo-paper.pdf)
+
+## 参考文献
+
+- [OLMo: Open Language Model](https://blog.allenai.org/olmo-open-language-model-87ccfc95f580)
+- [OLMo: Accelerating the Science of Language Models](https://allenai.org/olmo/olmo-paper.pdf)
\ No newline at end of file
diff --git a/pages/prompts.zh.mdx b/pages/prompts.zh.mdx
index dbb0d3047..1e099d7e0 100644
--- a/pages/prompts.zh.mdx
+++ b/pages/prompts.zh.mdx
@@ -1,3 +1,7 @@
# Prompt Hub
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import PromptFiles from 'components/PromptFiles'
+
+Prompt Hub 是提示的集合,可用于测试 prompt 在各种基本能力和复杂任务上的能力。我们希望 Prompt Hub 帮助您发现利用、实验和构建提示词的有趣方法。我们鼓励并欢迎人工智能研究和开发者社区的贡献。
+
+
\ No newline at end of file
diff --git a/pages/prompts/_meta.zh.json b/pages/prompts/_meta.zh.json
index 14c0d2002..1a9dda434 100644
--- a/pages/prompts/_meta.zh.json
+++ b/pages/prompts/_meta.zh.json
@@ -1,15 +1,15 @@
{
- "classification": "Classification",
- "coding": "Coding",
- "creativity": "Creativity",
- "evaluation": "Evaluation",
- "information-extraction": "Information Extraction",
- "image-generation": "Image Generation",
- "mathematics": "Mathematics",
- "question-answering": "Question Answering",
- "reasoning": "Reasoning",
- "text-summarization": "Text Summarization",
- "truthfulness": "Truthfulness",
- "adversarial-prompting": "Adversarial Prompting"
+ "classification": "分类",
+ "coding": "代码生成",
+ "creativity": "创造力",
+ "evaluation": "评价力",
+ "information-extraction": "信息提取",
+ "image-generation": "图像生成",
+ "mathematics": "数学",
+ "question-answering": "问答",
+ "reasoning": "推理",
+ "text-summarization": "文本摘要",
+ "truthfulness": "真实性",
+ "adversarial-prompting": "对抗性提示"
}
\ No newline at end of file
diff --git a/pages/prompts/adversarial-prompting/_meta.zh.json b/pages/prompts/adversarial-prompting/_meta.zh.json
index 561ef8fdb..9326e33b6 100644
--- a/pages/prompts/adversarial-prompting/_meta.zh.json
+++ b/pages/prompts/adversarial-prompting/_meta.zh.json
@@ -1,5 +1,5 @@
{
"prompt-injection": "提示词注入",
"prompt-leaking": "提示词泄露",
- "jailbreaking-llms": "'越狱'"
+ "jailbreaking-llms": "模型越狱"
}
diff --git a/pages/prompts/adversarial-prompting/jailbreaking-llms.zh.mdx b/pages/prompts/adversarial-prompting/jailbreaking-llms.zh.mdx
index 2e2c57b62..ca7ac1621 100644
--- a/pages/prompts/adversarial-prompting/jailbreaking-llms.zh.mdx
+++ b/pages/prompts/adversarial-prompting/jailbreaking-llms.zh.mdx
@@ -1,4 +1,4 @@
-# LLMs越狱
+# 模型越狱
import { Tabs, Tab } from 'nextra/components'
import {Callout} from 'nextra/components'
diff --git a/pages/prompts/coding.jp.mdx b/pages/prompts/coding.jp.mdx
index d54aaf900..a7a7db29d 100644
--- a/pages/prompts/coding.jp.mdx
+++ b/pages/prompts/coding.jp.mdx
@@ -1,3 +1,3 @@
-# LLMs for Code Generation
+# コード生成のためのLLM
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+このセクションには、LLM のコード生成機能をテストするための一連のヒントが含まれています。
\ No newline at end of file
diff --git a/pages/prompts/coding.zh.mdx b/pages/prompts/coding.zh.mdx
index d54aaf900..8e0d53ddb 100644
--- a/pages/prompts/coding.zh.mdx
+++ b/pages/prompts/coding.zh.mdx
@@ -1,3 +1,7 @@
-# LLMs for Code Generation
+# 使用 LLM 代码生成
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列用于测试 LLM 代码生成能力的提示。
+
+
\ No newline at end of file
diff --git a/pages/prompts/coding/_meta.zh.json b/pages/prompts/coding/_meta.zh.json
new file mode 100644
index 000000000..556010c49
--- /dev/null
+++ b/pages/prompts/coding/_meta.zh.json
@@ -0,0 +1,6 @@
+{
+ "code-snippet": "测试 LLM 的响应能力",
+ "mysql-query": "生成 MySQL 查询语句能力",
+ "tikz": "Draw TiKZ Diagram"
+}
+
\ No newline at end of file
diff --git a/pages/prompts/coding/code-snippet.zh.mdx b/pages/prompts/coding/code-snippet.zh.mdx
new file mode 100644
index 000000000..7c757c791
--- /dev/null
+++ b/pages/prompts/coding/code-snippet.zh.mdx
@@ -0,0 +1,73 @@
+# Generate Code Snippets with LLMs
+
+import { Tabs, Tab } from 'nextra/components'
+
+## 背景
+
+此提示测试 LLM 的代码生成功能,通过使用 `/* <注释> */` 的注释提示它生成给定程序详细信息的相应代码片段。
+
+
+## 提示词
+
+```markdown
+/*
+请提问用户输入他们的姓名,并说 "Hello"
+*/
+```
+
+## Code / API
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "/*\n请提问用户输入他们的姓名,并说 \"Hello\"\n*/"
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "/*\n请提问用户输入他们的姓名,并说 \"Hello\"\n*/"
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+## 参考
+- [Prompt Engineering Guide](https://www.promptingguide.ai/zh/introduction/examples#code-generation) (16 March 2023)
\ No newline at end of file
diff --git a/pages/prompts/coding/mysql-query.zh.mdx b/pages/prompts/coding/mysql-query.zh.mdx
new file mode 100644
index 000000000..5afc547c0
--- /dev/null
+++ b/pages/prompts/coding/mysql-query.zh.mdx
@@ -0,0 +1,72 @@
+# 使用 LLM 生成 MySQL 查询
+
+import { Tabs, Tab } from 'nextra/components'
+
+## 背景
+本提示测试 LLM 的代码生成能力,通过提供有关数据库模式信息来提示其生成有效的 MySQL 查询。
+
+## 提示
+```markdown
+"""
+Table departments, columns = [DepartmentId, DepartmentName]
+Table students, columns = [DepartmentId, StudentId, StudentName]
+为计算机科学系的所有学生创建 MySQL 查询
+"""
+```
+
+## Code / API
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "\"\"\"\nTable departments, columns = [DepartmentId, DepartmentName]\nTable students, columns = [DepartmentId, StudentId, StudentName]\n为计算机科学系的所有学生创建 MySQL 查询\n\"\"\""
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "\"\"\"\nTable departments, columns = [DepartmentId, DepartmentName]\nTable students, columns = [DepartmentId, StudentId, StudentName]\n为计算机科学系的所有学生创建 MySQL 查询\n\"\"\"",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+## 参考
+- [Prompt Engineering Guide](https://www.promptingguide.ai/zh/introduction/examples#code-generation) (16 March 2023)
\ No newline at end of file
diff --git a/pages/prompts/creativity.zh.mdx b/pages/prompts/creativity.zh.mdx
index 825cb2077..41e82ac5b 100644
--- a/pages/prompts/creativity.zh.mdx
+++ b/pages/prompts/creativity.zh.mdx
@@ -1,3 +1,8 @@
-# LLMs for Creativity
+# 大模型的创造力
+
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列用于测试大语言模型创造力的提示。
+
+
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
diff --git a/pages/prompts/creativity/_meta.zh.json b/pages/prompts/creativity/_meta.zh.json
new file mode 100644
index 000000000..8eb41dd53
--- /dev/null
+++ b/pages/prompts/creativity/_meta.zh.json
@@ -0,0 +1,6 @@
+{
+ "rhymes": "押韵",
+ "infinite-primes": "无限素数",
+ "interdisciplinary": "跨学科",
+ "new-words": "发明新词"
+}
diff --git a/pages/prompts/creativity/infinite-primes.en.mdx b/pages/prompts/creativity/infinite-primes.en.mdx
index c089f73da..df99e3b2d 100644
--- a/pages/prompts/creativity/infinite-primes.en.mdx
+++ b/pages/prompts/creativity/infinite-primes.en.mdx
@@ -21,18 +21,18 @@ Write a proof of the fact that there are infinitely many primes; do it in the st
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof."
- }
- ],
- temperature=1,
- max_tokens=1000,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof."
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/creativity/infinite-primes.zh.mdx b/pages/prompts/creativity/infinite-primes.zh.mdx
new file mode 100644
index 000000000..a8c4dc7d3
--- /dev/null
+++ b/pages/prompts/creativity/infinite-primes.zh.mdx
@@ -0,0 +1,71 @@
+# 用莎士比亚风格证明素数无限性的证明
+
+import {Tabs, Tab} from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLM 在用莎士比亚戏剧风格写出素数无限性证明的能力。
+
+## 提示
+```markdown
+Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof."
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/creativity/interdisciplinary.en.mdx b/pages/prompts/creativity/interdisciplinary.en.mdx
index e43643fbe..6f1bc2f62 100644
--- a/pages/prompts/creativity/interdisciplinary.en.mdx
+++ b/pages/prompts/creativity/interdisciplinary.en.mdx
@@ -21,18 +21,18 @@ Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi."
- }
- ],
- temperature=1,
- max_tokens=1000,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi."
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/creativity/interdisciplinary.zh.mdx b/pages/prompts/creativity/interdisciplinary.zh.mdx
new file mode 100644
index 000000000..e23dde044
--- /dev/null
+++ b/pages/prompts/creativity/interdisciplinary.zh.mdx
@@ -0,0 +1,71 @@
+# 跨学科任务与 LLMs
+
+import {Tabs, Tab} from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLM 在执行跨学科任务方面的能力,并展示其生成创意和新颖文本的能力。
+
+## 提示
+```markdown
+Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi.
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi."
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "Write a supporting letter to Kasturba Gandhi for Electron, a subatomic particle as a US presidential candidate by Mahatma Gandhi.",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/creativity/new-words.zh.mdx b/pages/prompts/creativity/new-words.zh.mdx
new file mode 100644
index 000000000..c69c94c28
--- /dev/null
+++ b/pages/prompts/creativity/new-words.zh.mdx
@@ -0,0 +1,74 @@
+# 发明新词
+
+import {Tabs, Tab} from 'nextra/components'
+
+## 背景
+此提示测试了 LLM 创造新词并在句子中使用它们的能力。
+
+## 提示
+
+```markdown
+A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:
+We were traveling in Africa and we saw these very cute whatpus.
+
+To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:
+```
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "A \"whatpu\"is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:\nWe were traveling in Africa and we saw these very cute whatpus.\n\nTo do a \"farduddle\"means to jump up and down really fast. An example of a sentence that uses the word farduddle is:"
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "A \"whatpu\"is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:\nWe were traveling in Africa and we saw these very cute whatpus.\n\nTo do a \"farduddle\"means to jump up and down really fast. An example of a sentence that uses the word farduddle is:",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://www.promptingguide.ai/techniques/fewshot) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/creativity/rhymes.en.mdx b/pages/prompts/creativity/rhymes.en.mdx
index 90f49b443..28e67dfac 100644
--- a/pages/prompts/creativity/rhymes.en.mdx
+++ b/pages/prompts/creativity/rhymes.en.mdx
@@ -20,18 +20,18 @@ Can you write a proof that there are infinitely many primes, with every line tha
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?"
- }
- ],
- temperature=1,
- max_tokens=256,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?"
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/creativity/rhymes.zh.mdx b/pages/prompts/creativity/rhymes.zh.mdx
new file mode 100644
index 000000000..36b169bad
--- /dev/null
+++ b/pages/prompts/creativity/rhymes.zh.mdx
@@ -0,0 +1,70 @@
+# 通过诗歌证明无限素数
+
+import {Tabs, Tab} from 'nextra/components'
+
+## 背景
+此提示测试了 LLM 的自然语言处理和创意能力,要求其以诗歌的形式写出证明素数无限性的证明。
+
+## 提示
+```
+Can you write a proof that there are infinitely many primes, with every line that rhymes?
+```
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?"
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "Can you write a proof that there are infinitely many primes, with every line that rhymes?",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## Reference
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/evaluation.zh.mdx b/pages/prompts/evaluation.zh.mdx
index ccee09721..5563e7e67 100644
--- a/pages/prompts/evaluation.zh.mdx
+++ b/pages/prompts/evaluation.zh.mdx
@@ -1,3 +1,8 @@
-# LLM Evaluation
+# 使用模型评价
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列提示,用于测试 LLM 的能力,以用于评估,其中包括使用 LLM 本身作为判断。
+
+
+
\ No newline at end of file
diff --git a/pages/prompts/evaluation/_meta.zh.json b/pages/prompts/evaluation/_meta.zh.json
new file mode 100644
index 000000000..673812137
--- /dev/null
+++ b/pages/prompts/evaluation/_meta.zh.json
@@ -0,0 +1,3 @@
+{
+ "plato-dialogue": "评价柏拉图的对话"
+}
\ No newline at end of file
diff --git a/pages/prompts/evaluation/plato-dialogue.zh.mdx b/pages/prompts/evaluation/plato-dialogue.zh.mdx
new file mode 100644
index 000000000..c9b8ab3c9
--- /dev/null
+++ b/pages/prompts/evaluation/plato-dialogue.zh.mdx
@@ -0,0 +1,82 @@
+# 评估柏拉图的对话
+
+import { Tabs, Tab } from 'nextra/components'
+
+## 背景
+以下提示测试了 LLM 在评估两个不同模型输出方面的能力,要求其像老师一样进行评估。
+
+首先,使用以下提示对两个模型(例如,ChatGPT 和 GPT-4)进行提示:
+
+```
+Plato’s Gorgias 是对修辞学和诡辩演讲的批评,其中他指出,这不仅不是一种真正的艺术形式,而且修辞和演讲的使用往往可能是有害和恶意的。你能写一个柏拉图的对话,在其中他批评自回归语言模型的使用吗?
+```
+
+然后,使用下面的评估提示对这些输出进行评估。
+
+## 提示
+```
+能否像老师一样比较以下两个输出?
+
+ChatGPT 的输出:{output 1}
+
+GPT-4 的输出:{output 2}
+```
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "能否像老师一样比较以下两个输出?\n\nOutput from ChatGPT:\n{output 1}\n\nOutput from GPT-4:\n{output 2}"
+ }
+ ],
+ temperature=1,
+ max_tokens=1500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "能否像老师一样比较以下两个输出?\n\nOutput from ChatGPT:\n{output 1}\n\nOutput from GPT-4:\n{output 2}",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/image-generation.zh.mdx b/pages/prompts/image-generation.zh.mdx
index f413d5ed1..b90171435 100644
--- a/pages/prompts/image-generation.zh.mdx
+++ b/pages/prompts/image-generation.zh.mdx
@@ -1,3 +1,8 @@
-# Image Generation
+# 图像生成
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列提示,用于探索 LLM 和多模态模型的功能。
+
+
+
\ No newline at end of file
diff --git a/pages/prompts/image-generation/_meta.zh.json b/pages/prompts/image-generation/_meta.zh.json
new file mode 100644
index 000000000..2db2908ab
--- /dev/null
+++ b/pages/prompts/image-generation/_meta.zh.json
@@ -0,0 +1,3 @@
+{
+ "alphabet-person": "用字母画一个人"
+}
\ No newline at end of file
diff --git a/pages/prompts/image-generation/alphabet-person.de.mdx b/pages/prompts/image-generation/alphabet-person.de.mdx
index 02dfe599b..0c16c0d25 100644
--- a/pages/prompts/image-generation/alphabet-person.de.mdx
+++ b/pages/prompts/image-generation/alphabet-person.de.mdx
@@ -37,18 +37,18 @@ Bitte fügen Sie ein Hemd und Hosen hinzu.
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.."
- }
- ],
- temperature=1,
- max_tokens=1000,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.."
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -61,8 +61,8 @@ Bitte fügen Sie ein Hemd und Hosen hinzu.
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.",
+ "role": "user",
+ "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/image-generation/alphabet-person.en.mdx b/pages/prompts/image-generation/alphabet-person.en.mdx
index 0ecaef628..880b91154 100644
--- a/pages/prompts/image-generation/alphabet-person.en.mdx
+++ b/pages/prompts/image-generation/alphabet-person.en.mdx
@@ -33,18 +33,18 @@ Please add a shirt and pants.
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.."
- }
- ],
- temperature=1,
- max_tokens=1000,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.."
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -57,8 +57,8 @@ Please add a shirt and pants.
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.",
+ "role": "user",
+ "content": "Produce TikZ code that draws a person composed from letters in the alphabet. The arms and torso can be the letter Y, the face can be the letter O (add some facial features) and the legs can be the legs of the letter H. Feel free to add other features.",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/image-generation/alphabet-person.zh.mdx b/pages/prompts/image-generation/alphabet-person.zh.mdx
new file mode 100644
index 000000000..824bd973c
--- /dev/null
+++ b/pages/prompts/image-generation/alphabet-person.zh.mdx
@@ -0,0 +1,83 @@
+# 使用字母画一个人
+
+import { Tabs, Tab } from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLM 处理视觉概念的能力,尽管它仅在文本上进行训练。这是一个具有挑战性的任务,因此需要多次迭代。在下面的示例中,用户首先请求所需的视觉效果,然后提供反馈以及修改和补充。后续的指令将取决于 LLM 在任务中的进展。请注意,这个任务要求生成 TikZ 代码,然后用户需要手动编译这些代码。
+
+## 提示
+
+提示迭代 1:
+```markdown
+生成一个由字母组成的人物的 TikZ 代码。手臂和躯干可以使用字母 Y,脸部可以用字母 O(添加一些面部特征),腿部可以使用字母 H 的腿部。可以添加其他特征。
+```
+
+提示迭代 2:
+```markdown
+躯干有点长,手臂太短,而且右臂看起来在支撑脸部,而不是脸部在躯干正上方。请纠正一下好吗?
+```
+
+提示迭代 3:
+```markdown
+请添加一件衬衫和裤子。
+```
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "制作 TikZ 代码,用字母表中的字母画出一个人。手臂和躯干可以是字母 Y,脸部可以是字母 O(添加一些面部特征),腿部可以是字母 H 的腿。"
+ }
+ ],
+ temperature=1,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "生成 TikZ 代码,绘制由字母表中的字母组成的人。手臂和躯干可以是字母 Y,脸可以是字母 O(添加一些面部特征),腿可以是字母 H 的腿。随意添加其他特征。",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/information-extraction.zh.mdx b/pages/prompts/information-extraction.zh.mdx
index cc8b686de..dd944f725 100644
--- a/pages/prompts/information-extraction.zh.mdx
+++ b/pages/prompts/information-extraction.zh.mdx
@@ -1,3 +1,7 @@
-# Information Extraction with LLMs
+# 文本总结
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列提示,用于探索 LLM 的信息提取功能。
+
+
\ No newline at end of file
diff --git a/pages/prompts/information-extraction/_meta.zh.json b/pages/prompts/information-extraction/_meta.zh.json
new file mode 100644
index 000000000..8f627791e
--- /dev/null
+++ b/pages/prompts/information-extraction/_meta.zh.json
@@ -0,0 +1,3 @@
+{
+ "extract-models": "提取模型名称"
+}
\ No newline at end of file
diff --git a/pages/prompts/information-extraction/extract-models.de.mdx b/pages/prompts/information-extraction/extract-models.de.mdx
index 4a278368d..2b779877c 100644
--- a/pages/prompts/information-extraction/extract-models.de.mdx
+++ b/pages/prompts/information-extraction/extract-models.de.mdx
@@ -33,18 +33,18 @@ Abstract: {input}
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -57,8 +57,8 @@ Abstract: {input}
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…",
+ "role": "user",
+ "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/information-extraction/extract-models.en.mdx b/pages/prompts/information-extraction/extract-models.en.mdx
index 7c99a9d7b..5299b1e4c 100644
--- a/pages/prompts/information-extraction/extract-models.en.mdx
+++ b/pages/prompts/information-extraction/extract-models.en.mdx
@@ -32,18 +32,18 @@ Abstract: {input}
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -56,8 +56,8 @@ Abstract: {input}
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…",
+ "role": "user",
+ "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/information-extraction/extract-models.zh.mdx b/pages/prompts/information-extraction/extract-models.zh.mdx
new file mode 100644
index 000000000..efdc86bb8
--- /dev/null
+++ b/pages/prompts/information-extraction/extract-models.zh.mdx
@@ -0,0 +1,84 @@
+# 从论文中提取模型名称
+
+import {Tabs, Tab} from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLM 执行信息提取任务的能力,该任务涉及从机器学习论文的摘要中提取模型名称。
+
+## 提示
+
+```markdown
+你的任务是从机器学习论文的摘要中提取模型名称。你的回答是一个模型名称的数组,格式为 [\"model_name\"]。如果在摘要中没有找到模型名称或不确定,请返回 [\"NA\"]
+
+摘要:Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…
+```
+
+这个摘要的翻译是(下面的代码中直接使用英文):大型语言模型(LLMs),如 ChatGPT 和 GPT-4,已经革新了自然语言处理研究,并在人工通用智能(AGI)中展示了潜力。然而,LLMs 的高昂训练和部署成本对透明和开放的学术研究提出了挑战。为了解决这些问题,本项目将中文 LLaMA 和 Alpaca 开源……
+
+## 提示模板
+
+```markdown
+你的任务是从机器学习论文的摘要中提取模型名称。你的回答是一个模型名称的数组,格式为 [\"model_name\"]。如果在摘要中没有找到模型名称或不确定,请返回 [\"NA\"]
+
+摘要:{input}
+```
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "Your task is to extract model names from machine learning paper abstracts. Your response is an array of the model names in the format [\\\"model_name\\\"]. If you don't find model names in the abstract or you are not sure, return [\\\"NA\\\"]\n\nAbstract: Large Language Models (LLMs), such as ChatGPT and GPT-4, have revolutionized natural language processing research and demonstrated potential in Artificial General Intelligence (AGI). However, the expensive training and deployment of LLMs present challenges to transparent and open academic research. To address these issues, this project open-sources the Chinese LLaMA and Alpaca…",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [Prompt Engineering Guide](https://www.promptingguide.ai/introduction/examples#information-extraction) (16 March 2023)
\ No newline at end of file
diff --git a/pages/prompts/mathematics.zh.mdx b/pages/prompts/mathematics.zh.mdx
index 600932476..35fd62fd8 100644
--- a/pages/prompts/mathematics.zh.mdx
+++ b/pages/prompts/mathematics.zh.mdx
@@ -1,3 +1,7 @@
-# Mathematical Understanding with LLMs
+# 使用 LLMs 进行数学理解
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列用于测试 LLMs 数学能力的提示。
+
+
\ No newline at end of file
diff --git a/pages/prompts/mathematics/_meta.zh.json b/pages/prompts/mathematics/_meta.zh.json
new file mode 100644
index 000000000..67c594be1
--- /dev/null
+++ b/pages/prompts/mathematics/_meta.zh.json
@@ -0,0 +1,5 @@
+{
+ "composite-functions": "计算复合函数",
+ "odd-numbers": "奇数相加"
+}
+
\ No newline at end of file
diff --git a/pages/prompts/mathematics/composite-functions.de.mdx b/pages/prompts/mathematics/composite-functions.de.mdx
index 7523d06fc..13b440153 100644
--- a/pages/prompts/mathematics/composite-functions.de.mdx
+++ b/pages/prompts/mathematics/composite-functions.de.mdx
@@ -20,18 +20,18 @@ Angenommen $$g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6$
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Suppose g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6 what is f(f(f(6)))?\n"
- }
- ],
- temperature=1,
- max_tokens=256,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Suppose g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6 what is f(f(f(6)))?\n"
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/mathematics/composite-functions.en.mdx b/pages/prompts/mathematics/composite-functions.en.mdx
index 018fd80aa..60ce45869 100644
--- a/pages/prompts/mathematics/composite-functions.en.mdx
+++ b/pages/prompts/mathematics/composite-functions.en.mdx
@@ -19,18 +19,18 @@ Suppose $$g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6$$ w
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Suppose g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6 what is f(f(f(6)))?\n"
- }
- ],
- temperature=1,
- max_tokens=256,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Suppose g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6 what is f(f(f(6)))?\n"
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/mathematics/composite-functions.zh.mdx b/pages/prompts/mathematics/composite-functions.zh.mdx
new file mode 100644
index 000000000..27908a6cf
--- /dev/null
+++ b/pages/prompts/mathematics/composite-functions.zh.mdx
@@ -0,0 +1,69 @@
+# 计算复合函数
+
+import { Tabs, Tab } from 'nextra/components'
+
+## 背景
+这个提示词通过要求评估给定的复合函数来测试大型语言模型(LLM)的数学能力。
+
+## 提示词
+
+Suppose $$g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6$$ what is $$f(f(f(6)))$$?
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Suppose g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6 what is f(f(f(6)))?\n"
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "Suppose g(x) = f^{-1}(x), g(0) = 5, g(4) = 7, g(3) = 2, g(7) = 9, g(9) = 6 what is f(f(f(6)))?",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/mathematics/odd-numbers.de.mdx b/pages/prompts/mathematics/odd-numbers.de.mdx
index 06fd47bf4..62d583ca7 100644
--- a/pages/prompts/mathematics/odd-numbers.de.mdx
+++ b/pages/prompts/mathematics/odd-numbers.de.mdx
@@ -23,18 +23,18 @@ Löse das Problem, indem du es in Schritte unterteilen. Identifiziere zuerst die
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. \nSolve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even."
- }
- ],
- temperature=1,
- max_tokens=256,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. \nSolve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even."
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/mathematics/odd-numbers.en.mdx b/pages/prompts/mathematics/odd-numbers.en.mdx
index 3d8a2e109..27a340dba 100644
--- a/pages/prompts/mathematics/odd-numbers.en.mdx
+++ b/pages/prompts/mathematics/odd-numbers.en.mdx
@@ -23,17 +23,17 @@ Solve by breaking the problem into steps. First, identify the odd numbers, add t
response = client.chat.completions.create(
model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. \nSolve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even."
- }
- ],
- temperature=1,
- max_tokens=256,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ messages=[
+ {
+ "role": "user",
+ "content": "The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. \nSolve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even."
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/mathematics/odd-numbers.zh.mdx b/pages/prompts/mathematics/odd-numbers.zh.mdx
new file mode 100644
index 000000000..5a7eefefe
--- /dev/null
+++ b/pages/prompts/mathematics/odd-numbers.zh.mdx
@@ -0,0 +1,72 @@
+# 奇数相加
+
+import { Tabs, Tab } from 'nextra/components'
+
+## 背景
+这个提示词通过要求检查奇数相加是否得出偶数来测试大型语言模型(LLM)的数学能力。在这个例子中,我们还将利用链式思维提示词。
+
+## 提示词
+
+```markdown
+The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.
+Solve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even.
+```
+
+## Code / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. \nSolve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even."
+ }
+ ],
+ temperature=1,
+ max_tokens=256,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. \nSolve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even.",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://www.promptingguide.ai/introduction/examples#reasoning) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/question-answering.zh.mdx b/pages/prompts/question-answering.zh.mdx
index 23ef616f6..35ee5434f 100644
--- a/pages/prompts/question-answering.zh.mdx
+++ b/pages/prompts/question-answering.zh.mdx
@@ -1,3 +1,7 @@
-# Question Answering with LLMs
+# 大模型问答
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含用于测试 LLM 的问答能力的提示集合。
+
+
\ No newline at end of file
diff --git a/pages/prompts/question-answering/_meta.zh.json b/pages/prompts/question-answering/_meta.zh.json
new file mode 100644
index 000000000..b92ed184b
--- /dev/null
+++ b/pages/prompts/question-answering/_meta.zh.json
@@ -0,0 +1,5 @@
+{
+ "closed-domain": "封闭域问答",
+ "open-domain": "开放域问答",
+ "science-qa": "科学问答"
+}
diff --git a/pages/prompts/question-answering/closed-domain.de.mdx b/pages/prompts/question-answering/closed-domain.de.mdx
index 3dd1243a8..d8830f29c 100644
--- a/pages/prompts/question-answering/closed-domain.de.mdx
+++ b/pages/prompts/question-answering/closed-domain.de.mdx
@@ -37,18 +37,18 @@ Bitte schreibe die oben genannten Daten in eine medizinische Notiz um, unter aus
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above."
- }
- ],
- temperature=1,
- max_tokens=500,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above."
+ }
+ ],
+ temperature=1,
+ max_tokens=500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/question-answering/closed-domain.en.mdx b/pages/prompts/question-answering/closed-domain.en.mdx
index 7f0ab31a5..82b8e372d 100644
--- a/pages/prompts/question-answering/closed-domain.en.mdx
+++ b/pages/prompts/question-answering/closed-domain.en.mdx
@@ -32,18 +32,18 @@ Please rewrite the data above into a medical note, using exclusively the informa
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above."
- }
- ],
- temperature=1,
- max_tokens=500,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above."
+ }
+ ],
+ temperature=1,
+ max_tokens=500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -56,8 +56,8 @@ Please rewrite the data above into a medical note, using exclusively the informa
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above.",
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above.",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/question-answering/closed-domain.zh.mdx b/pages/prompts/question-answering/closed-domain.zh.mdx
new file mode 100644
index 000000000..9f3e986b0
--- /dev/null
+++ b/pages/prompts/question-answering/closed-domain.zh.mdx
@@ -0,0 +1,81 @@
+# 使用 LLMs 进行封闭域问答
+
+import { Tabs, Tab } from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLMs 在回答封闭域问题方面的能力,这涉及回答属于特定主题或领域的问题。
+
+
+ 请注意,由于任务的挑战性,当 LLMs 没有关于问题的知识时,它们可能会产生幻觉。
+
+
+## 提示
+```markdown
+患者信息:
+- 20 岁女性
+- 有神经性厌食症和抑郁症病史
+- 血压 100/50,脉搏 50,身高 5’5’’
+- 由其营养师推荐,但她对自己的病情持否认态度
+- 报告说吃得很好,但体重严重偏低
+
+请将以上数据改写为医疗记录,仅使用以上信息。
+
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI()
+
+ response = client.chat.completions.create(
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "患者信息:\n- 20 岁女性\n- 有神经性厌食症和抑郁症病史\n- 血压 100/50,脉搏 50,身高 5’5’’\n- 由其营养师推荐,但她对自己的病情持否认态度\n- 报告说吃得很好,但体重严重偏低\n\n请将以上数据改写为医疗记录,仅使用以上信息。"
+ }
+ ],
+ temperature=1,
+ max_tokens=500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create(
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "患者信息:\n- 20 岁女性\n- 有神经性厌食症和抑郁症病史\n- 血压 100/50,脉搏 50,身高 5’5’’\n- 由其营养师推荐,但她对自己的病情持否认态度\n- 报告说吃得很好,但体重严重偏低\n\n请将以上数据改写为医疗记录,仅使用以上信息。",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+## 参考
+- [通用人工智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (13 April 2023)
\ No newline at end of file
diff --git a/pages/prompts/question-answering/open-domain.de.mdx b/pages/prompts/question-answering/open-domain.de.mdx
index 36bc4eeb0..85a907382 100644
--- a/pages/prompts/question-answering/open-domain.de.mdx
+++ b/pages/prompts/question-answering/open-domain.de.mdx
@@ -32,18 +32,18 @@ Mensch: Kann ich im SeaTac Flughafen McDonalds bekommen?
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -56,8 +56,8 @@ Mensch: Kann ich im SeaTac Flughafen McDonalds bekommen?
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?",
+ "role": "user",
+ "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/question-answering/open-domain.en.mdx b/pages/prompts/question-answering/open-domain.en.mdx
index 0c3971032..6e89a5449 100644
--- a/pages/prompts/question-answering/open-domain.en.mdx
+++ b/pages/prompts/question-answering/open-domain.en.mdx
@@ -28,18 +28,18 @@ Human: Can I get McDonalds at the SeaTac airport?
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -52,8 +52,8 @@ Human: Can I get McDonalds at the SeaTac airport?
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?",
+ "role": "user",
+ "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/question-answering/open-domain.zh.mdx b/pages/prompts/question-answering/open-domain.zh.mdx
new file mode 100644
index 000000000..79f5a8845
--- /dev/null
+++ b/pages/prompts/question-answering/open-domain.zh.mdx
@@ -0,0 +1,76 @@
+# 使用 LLMs 进行开放域问答
+
+import {Tabs, Tab} from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLMs 在回答开放域问题方面的能力,这涉及在没有提供任何证据的情况下回答事实性问题。
+
+
+ 请注意,由于任务的挑战性,当 LLMs 没有关于问题的知识时,它们可能会产生幻觉。
+
+
+## 提示
+```markdown
+在人类和人工智能之间的对话中,人工智能是乐于助人且友好的,当它不知道答案时,它会说 “我不知道”。
+
+AI:您好,请问有什么可以帮您的吗?
+人类:我可以在西塔科机场买麦当劳吗?
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+## 参考
+- [人工通用智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (2023 年 4 月 13 日)
\ No newline at end of file
diff --git a/pages/prompts/question-answering/science-qa.de.mdx b/pages/prompts/question-answering/science-qa.de.mdx
index 7d610479e..8bcc20034 100644
--- a/pages/prompts/question-answering/science-qa.de.mdx
+++ b/pages/prompts/question-answering/science-qa.de.mdx
@@ -28,18 +28,18 @@ Antwort:
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -52,8 +52,8 @@ Antwort:
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:",
+ "role": "user",
+ "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/question-answering/science-qa.en.mdx b/pages/prompts/question-answering/science-qa.en.mdx
index e4ab83d90..52130a952 100644
--- a/pages/prompts/question-answering/science-qa.en.mdx
+++ b/pages/prompts/question-answering/science-qa.en.mdx
@@ -27,18 +27,18 @@ Answer:
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -51,8 +51,8 @@ Answer:
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:",
+ "role": "user",
+ "content": "Answer the question based on the context below. Keep the answer short and concise. Respond \"Unsure about answer\" if not sure about the answer.\n\nContext: Teplizumab traces its roots to a New Jersey drug company called Ortho Pharmaceutical. There, scientists generated an early version of the antibody, dubbed OKT3. Originally sourced from mice, the molecule was able to bind to the surface of T cells and limit their cell-killing potential. In 1986, it was approved to help prevent organ rejection after kidney transplants, making it the first therapeutic antibody allowed for human use.\n\nQuestion: What was OKT3 originally sourced from?\nAnswer:",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/question-answering/science-qa.zh.mdx b/pages/prompts/question-answering/science-qa.zh.mdx
new file mode 100644
index 000000000..10a7709e3
--- /dev/null
+++ b/pages/prompts/question-answering/science-qa.zh.mdx
@@ -0,0 +1,75 @@
+# 使用 LLMs 进行科学问答
+
+import {Tabs, Tab} from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLMs 在进行科学问答方面的能力。
+
+## 提示
+
+```markdown
+根据下面的上下文回答问题。保持答案简短和简明。如果不确定答案,请回答 "Unsure about answer"。
+
+上下文:Teplizumab 的起源可以追溯到一家新泽西的制药公司 Ortho Pharmaceutical。在那里,科学家们生成了一种早期版本的抗体,称为 OKT3。最初来源于老鼠,该分子能够结合在 T 细胞表面并限制其杀伤细胞的潜力。1986 年,它被批准用于帮助防止肾移植后的器官排斥反应,使其成为第一个被允许用于人类治疗的抗体。
+
+问题:OKT3 最初来源于什么?
+回答:
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "根据下面的上下文回答问题。保持答案简短和简明。如果不确定答案,请回答 \"Unsure about answer\"。\n\n 上下文:Teplizumab 的起源可以追溯到一家新泽西的制药公司 Ortho Pharmaceutical。在那里,科学家们生成了一种早期版本的抗体,称为 OKT3。最初来源于老鼠,该分子能够结合在 T 细胞表面并限制其杀伤细胞的潜力。1986 年,它被批准用于帮助防止肾移植后的器官排斥反应,使其成为第一个被允许用于人类治疗的抗体。\n\n 问题:OKT3 最初来源于什么?\n 回答:"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "根据下面的上下文回答问题。保持答案简短和简明。如果不确定答案,请回答 \"Unsure about answer\"。\n\n 上下文:Teplizumab 的起源可以追溯到一家新泽西的制药公司 Ortho Pharmaceutical。在那里,科学家们生成了一种早期版本的抗体,称为 OKT3。最初来源于老鼠,该分子能够结合在 T 细胞表面并限制其杀伤细胞的潜力。1986 年,它被批准用于帮助防止肾移植后的器官排斥反应,使其成为第一个被允许用于人类治疗的抗体。\n\n 问题:OKT3 最初来源于什么?\n 回答:",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+## 参考
+- [提示工程指南](https://www.promptingguide.ai/introduction/examples#question-answering) (2023 年 3 月 16 日)
\ No newline at end of file
diff --git a/pages/prompts/reasoning.zh.mdx b/pages/prompts/reasoning.zh.mdx
index 89f5b22dc..f64ea0d00 100644
--- a/pages/prompts/reasoning.zh.mdx
+++ b/pages/prompts/reasoning.zh.mdx
@@ -1,3 +1,9 @@
-# Reasoning with LLMs
+# 大模型的推理
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+
+本节包含用于测试 LLM 推理能力的提示集合。
+
+
+
\ No newline at end of file
diff --git a/pages/prompts/reasoning/_meta.zh.json b/pages/prompts/reasoning/_meta.zh.json
new file mode 100644
index 000000000..e702495c8
--- /dev/null
+++ b/pages/prompts/reasoning/_meta.zh.json
@@ -0,0 +1,4 @@
+{
+ "indirect-reasoning": "间接推理",
+ "physical-reasoning": "物理推理"
+}
diff --git a/pages/prompts/reasoning/indirect-reasoning.de.mdx b/pages/prompts/reasoning/indirect-reasoning.de.mdx
index 65a6348e2..6761f4e56 100644
--- a/pages/prompts/reasoning/indirect-reasoning.de.mdx
+++ b/pages/prompts/reasoning/indirect-reasoning.de.mdx
@@ -32,18 +32,18 @@ Antwort:
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-3.5-turbo",
- messages=[
- {
- "role": "user",
- "content": "If a+|a|=0, try to prove that a<0.\n\nStep 1: List the conditions and questions in the original proposition.\n\nStep 2: Merge the conditions listed in Step 1 into one. Define it as wj.\n\nStep 3: Let us think it step by step. Please consider all possibilities. If the intersection between wj (defined in Step 2) and the negation of the question is not empty at least in one possibility, the original proposition is false. Otherwise, the original proposition is true.\n\nAnswer:"
- }
- ],
- temperature=0,
- max_tokens=1000,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "If a+|a|=0, try to prove that a<0.\n\nStep 1: List the conditions and questions in the original proposition.\n\nStep 2: Merge the conditions listed in Step 1 into one. Define it as wj.\n\nStep 3: Let us think it step by step. Please consider all possibilities. If the intersection between wj (defined in Step 2) and the negation of the question is not empty at least in one possibility, the original proposition is false. Otherwise, the original proposition is true.\n\nAnswer:"
+ }
+ ],
+ temperature=0,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
diff --git a/pages/prompts/reasoning/indirect-reasoning.en.mdx b/pages/prompts/reasoning/indirect-reasoning.en.mdx
index 1920f9707..d490cc9fa 100644
--- a/pages/prompts/reasoning/indirect-reasoning.en.mdx
+++ b/pages/prompts/reasoning/indirect-reasoning.en.mdx
@@ -33,18 +33,18 @@ Answer:
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-3.5-turbo",
- messages=[
- {
- "role": "user",
- "content": "If a+|a|=0, try to prove that a<0.\n\nStep 1: List the conditions and questions in the original proposition.\n\nStep 2: Merge the conditions listed in Step 1 into one. Define it as wj.\n\nStep 3: Let us think it step by step. Please consider all possibilities. If the intersection between wj (defined in Step 2) and the negation of the question is not empty at least in one possibility, the original proposition is false. Otherwise, the original proposition is true.\n\nAnswer:"
- }
- ],
- temperature=0,
- max_tokens=1000,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "If a+|a|=0, try to prove that a<0.\n\nStep 1: List the conditions and questions in the original proposition.\n\nStep 2: Merge the conditions listed in Step 1 into one. Define it as wj.\n\nStep 3: Let us think it step by step. Please consider all possibilities. If the intersection between wj (defined in Step 2) and the negation of the question is not empty at least in one possibility, the original proposition is false. Otherwise, the original proposition is true.\n\nAnswer:"
+ }
+ ],
+ temperature=0,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -57,8 +57,8 @@ Answer:
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "If a+|a|=0, try to prove that a<0.\n\nStep 1: List the conditions and questions in the original proposition.\n\nStep 2: Merge the conditions listed in Step 1 into one. Define it as wj.\n\nStep 3: Let us think it step by step. Please consider all possibilities. If the intersection between wj (defined in Step 2) and the negation of the question is not empty at least in one possibility, the original proposition is false. Otherwise, the original proposition is true.\n\nAnswer:",
+ "role": "user",
+ "content": "If a+|a|=0, try to prove that a<0.\n\nStep 1: List the conditions and questions in the original proposition.\n\nStep 2: Merge the conditions listed in Step 1 into one. Define it as wj.\n\nStep 3: Let us think it step by step. Please consider all possibilities. If the intersection between wj (defined in Step 2) and the negation of the question is not empty at least in one possibility, the original proposition is false. Otherwise, the original proposition is true.\n\nAnswer:",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/reasoning/indirect-reasoning.zh.mdx b/pages/prompts/reasoning/indirect-reasoning.zh.mdx
new file mode 100644
index 000000000..c79758054
--- /dev/null
+++ b/pages/prompts/reasoning/indirect-reasoning.zh.mdx
@@ -0,0 +1,117 @@
+# 使用 LLMs 进行间接推理
+
+import {Tabs, Tab} from 'nextra/components'
+
+## 背景
+[Zhang et al. (2024)](https://arxiv.org/abs/2402.03667) 最近提出了一种间接推理方法,以增强 LLMs 的推理能力。该方法采用反例和矛盾的逻辑来解决事实推理和数学证明等 IR 任务。它包括两个关键步骤:1)通过增加数据和规则(即反例的逻辑等价)来增强 LLMs 的理解能力,2)设计提示模板以激发 LLMs 基于矛盾证明进行间接推理。
+
+在 GPT-3.5-turbo 和 Gemini-pro 等 LLMs 上的实验表明,与传统的直接推理方法相比,该方法将事实推理的总体准确率提高了 27.33%,数学证明的准确率提高了 31.43%。
+
+下面是一个用于矛盾证明的零样本模板示例。
+
+## 提示
+
+输入:
+
+```markdown
+如果 a+|a|=0,试图证明 a<0。
+
+步骤 1:列出原命题中的条件和问题。
+
+步骤 2:将步骤 1 中列出的条件合并为一个集合,将其定义为 wj。
+
+步骤 3:让我们一步步思考。请考虑所有可能性。如果 wj(在步骤 2 中定义)与问题的否定在至少一种可能性中有交集,则原命题为假。否则,原命题为真。
+
+回答:
+```
+
+输出:
+```
+为了证明如果 \( a + |a| = 0 \),则 \( a < 0 \),我们可以按照以下步骤进行逻辑推理:
+
+### 步骤 1:列出原命题中的条件和问题
+
+条件:\( a + |a| = 0 \)
+
+问题:证明 \( a < 0 \)
+
+### 步骤 2:将步骤 1 中列出的条件合并为一个集合,将其定义为 wj
+
+合并条件: \( wj = \{ a + |a| = 0 \} \)
+
+### 步骤 3:让我们一步步思考。请考虑所有可能性。如果 wj(在步骤 2 中定义)与问题的否定在至少一种可能性中有交集,则原命题为假。否则,原命题为真。
+
+考虑两个可能性: \( a \ge 0 \) 和 \( a < 0 \)。
+
+1. **情况 1:\( a \ge 0 \)**
+ - 如果 \( a \ge 0 \),则 \( |a| = a \)。
+ - 代入条件 \( a + |a| = 0 \),得到 \( a + a = 0 \),即 \( 2a = 0 \)。
+ - 解得 \( a = 0 \)。
+ - 但如果 \( a = 0 \),则 \( a \ge 0 \),与 \( a < 0 \) 矛盾。
+
+2. **情况 2:\( a < 0 \)**
+ - 如果 \( a < 0 \),则 \( |a| = -a \)。
+ - 代入条件 \( a + |a| = 0 \),得到 \( a + (-a) = 0 \),即 \( 0 = 0 \)。
+ - 这个条件始终为真,没有矛盾。
+
+通过以上两种情况的分析,我们可以看到,当 \( a \ge 0 \) 时会出现矛盾,而当 \( a < 0 \) 时不会出现矛盾。因此,可以得出结论:
+
+回答:原命题为真,即 \( a < 0 \)。
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "如果 a+|a|=0,试图证明 a<0。\n\n 步骤 1:列出原命题中的条件和问题。\n\n 步骤 2:将步骤 1 中列出的条件合并为一个。将其定义为 wj。\n\n 步骤 3:让我们一步步思考。请考虑所有可能性。如果 wj(在步骤 2 中定义)与问题的否定在至少一种可能性中有交集,则原命题为假。否则,原命题为真。\n\n 回答:"
+ }
+ ],
+ temperature=0,
+ max_tokens=1000,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "如果 a+|a|=0,试图证明 a<0。\n\n 步骤 1:列出原命题中的条件和问题。\n\n 步骤 2:将步骤 1 中列出的条件合并为一个。将其定义为 wj。\n\n 步骤 3:让我们一步步思考。请考虑所有可能性。如果 wj(在步骤 2 中定义)与问题的否定在至少一种可能性中有交集,则原命题为假。否则,原命题为真。\n\n 回答:",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+## 参考
+- [将大型语言模型作为间接推理者:反例和矛盾用于自动推理](https://arxiv.org/abs/2402.03667) (2024 年 2 月 6 日)
\ No newline at end of file
diff --git a/pages/prompts/reasoning/physical-reasoning.de.mdx b/pages/prompts/reasoning/physical-reasoning.de.mdx
index afd595ffd..ea80e6865 100644
--- a/pages/prompts/reasoning/physical-reasoning.de.mdx
+++ b/pages/prompts/reasoning/physical-reasoning.de.mdx
@@ -22,18 +22,18 @@ Hier haben wir ein Buch, 9 Eier, einen Laptop, eine Flasche und einen Nagel. Bit
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner."
- }
- ],
- temperature=1,
- max_tokens=500,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner."
+ }
+ ],
+ temperature=1,
+ max_tokens=500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -46,8 +46,8 @@ Hier haben wir ein Buch, 9 Eier, einen Laptop, eine Flasche und einen Nagel. Bit
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.",
+ "role": "user",
+ "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/reasoning/physical-reasoning.en.mdx b/pages/prompts/reasoning/physical-reasoning.en.mdx
index 6e7d7a028..e7d4dbf94 100644
--- a/pages/prompts/reasoning/physical-reasoning.en.mdx
+++ b/pages/prompts/reasoning/physical-reasoning.en.mdx
@@ -20,18 +20,18 @@ Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how t
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner."
- }
- ],
- temperature=1,
- max_tokens=500,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner."
+ }
+ ],
+ temperature=1,
+ max_tokens=500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -44,8 +44,8 @@ Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how t
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.",
+ "role": "user",
+ "content": "Here we have a book, 9 eggs, a laptop, a bottle and a nail. Please tell me how to stack them onto each other in a stable manner.",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/reasoning/physical-reasoning.zh.mdx b/pages/prompts/reasoning/physical-reasoning.zh.mdx
new file mode 100644
index 000000000..ddcfa2c53
--- /dev/null
+++ b/pages/prompts/reasoning/physical-reasoning.zh.mdx
@@ -0,0 +1,95 @@
+# 使用 LLMs 进行物理推理
+
+import {Tabs, Tab} from 'nextra/components'
+
+## 背景
+此提示通过要求 LLM 对一组物体进行操作来测试其物理推理能力。
+
+## 提示
+
+输入:
+
+```markdown
+这里有一本书、9 个鸡蛋、一台笔记本电脑、一瓶子和一颗钉子。请告诉我如何将它们稳定地堆叠在一起。
+```
+
+输出:
+
+```
+要将一本书、9 个鸡蛋、一台笔记本电脑、一瓶子和一颗钉子稳定地堆叠在一起,可以考虑以下步骤:
+
+1. ** 底部:书 **
+ - 将书平放在底部,作为基础。书的平整和坚固性质使其成为理想的基础。
+
+2. ** 第二层:鸡蛋 **
+ - 将 9 个鸡蛋分成三组,每组 3 个鸡蛋。小心地将鸡蛋放在书上,使其形成一个稳定的三角形结构。这样可以增加鸡蛋的承重能力。
+
+3. ** 第三层:笔记本电脑 **
+ - 将笔记本电脑水平放置在鸡蛋上。由于鸡蛋的分布和笔记本电脑的重量相对较轻,这样可以使其保持稳定。
+
+4. ** 第四层:瓶子 **
+ - 将瓶子放在笔记本电脑的中间位置。确保瓶子竖直放置,以减少倾斜的风险。
+
+5. ** 顶层:钉子 **
+ - 最后,将钉子轻轻地放在瓶子的瓶盖上。由于钉子重量轻且体积小,放置在顶部不会影响整体的稳定性。
+
+需要非常小心地操作,确保每一层都平衡良好,以避免任何一部分倒塌。
+```
+
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "这里有一本书、9 个鸡蛋、一台笔记本电脑、一瓶子和一颗钉子。请告诉我如何将它们稳定地堆叠在一起。"
+ }
+ ],
+ temperature=1,
+ max_tokens=500,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "这里有一本书、9 个鸡蛋、一台笔记本电脑、一瓶子和一颗钉子。请告诉我如何将它们稳定地堆叠在一起。",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+## 参考
+- [人工通用智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (2023 年 4 月 13 日)
\ No newline at end of file
diff --git a/pages/prompts/text-summarization.zh.mdx b/pages/prompts/text-summarization.zh.mdx
index afdc1b60b..fcf39339b 100644
--- a/pages/prompts/text-summarization.zh.mdx
+++ b/pages/prompts/text-summarization.zh.mdx
@@ -1,3 +1,7 @@
-# Text Summarization with LLMs
+# 文本总结
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
\ No newline at end of file
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含一系列用于探索 LLM 文本摘要功能的提示。
+
+
diff --git a/pages/prompts/text-summarization/_meta.zh.json b/pages/prompts/text-summarization/_meta.zh.json
new file mode 100644
index 000000000..b63f16d7b
--- /dev/null
+++ b/pages/prompts/text-summarization/_meta.zh.json
@@ -0,0 +1,3 @@
+{
+ "explain-concept": "文本总结"
+}
\ No newline at end of file
diff --git a/pages/prompts/text-summarization/explain-concept.de.mdx b/pages/prompts/text-summarization/explain-concept.de.mdx
index 3f290b82f..122b2f5d6 100644
--- a/pages/prompts/text-summarization/explain-concept.de.mdx
+++ b/pages/prompts/text-summarization/explain-concept.de.mdx
@@ -25,18 +25,18 @@ Erkläre das oben Gesagte in einem Satz:
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -49,8 +49,8 @@ Erkläre das oben Gesagte in einem Satz:
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:",
+ "role": "user",
+ "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/text-summarization/explain-concept.en.mdx b/pages/prompts/text-summarization/explain-concept.en.mdx
index d24573634..7d703c5ba 100644
--- a/pages/prompts/text-summarization/explain-concept.en.mdx
+++ b/pages/prompts/text-summarization/explain-concept.en.mdx
@@ -23,18 +23,18 @@ Explain the above in one sentence:
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:"
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -47,8 +47,8 @@ Explain the above in one sentence:
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:",
+ "role": "user",
+ "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/text-summarization/explain-concept.zh.mdx b/pages/prompts/text-summarization/explain-concept.zh.mdx
new file mode 100644
index 000000000..6e0bb9db9
--- /dev/null
+++ b/pages/prompts/text-summarization/explain-concept.zh.mdx
@@ -0,0 +1,82 @@
+# 使用 LLM 解释概念
+
+import {Tabs, Tab} from 'nextra/components'
+import { Callout } from 'nextra/components'
+
+## 背景
+以下提示测试 LLM 解释或总结概念的能力。
+
+## 提示
+
+输入:
+
+```markdown
+抗生素是一种用于治疗细菌感染的药物。它们通过杀死细菌或阻止细菌繁殖来工作,使身体的免疫系统能够抵抗感染。抗生素通常以药片、胶囊或液体溶液的形式口服,有时也通过静脉注射。它们对病毒感染无效,不适当地使用抗生素会导致抗生素耐药性。
+
+用一句话解释上述内容:
+```
+
+输出:
+
+```markdown
+抗生素是用于治疗细菌感染的药物,通过杀死细菌或阻止其繁殖来帮助免疫系统抵抗感染,但对病毒无效,不当使用会导致耐药性。
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "抗生素是一种用于治疗细菌感染的药物。它们通过杀死细菌或阻止细菌繁殖来工作,使身体的免疫系统能够抵抗感染。抗生素通常以药片、胶囊或液体溶液的形式口服,有时也通过静脉注射。它们对病毒感染无效,不适当地使用抗生素会导致抗生素耐药性。\n\n 用一句话解释上述内容:"
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "抗生素是一种用于治疗细菌感染的药物,它们通过杀死细菌或阻止细菌繁殖来工作,使身体的免疫系统能够抵抗感染,通常口服或静脉注射,对病毒无效,不当使用会导致耐药性。\n\n 用一句话解释上述内容:",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+
+
+## 参考
+- [提示工程指南](https://www.promptingguide.ai/introduction/examples#text-summarization) (2023 年 3 月 16 日)
\ No newline at end of file
diff --git a/pages/prompts/truthfulness.zh.mdx b/pages/prompts/truthfulness.zh.mdx
index e33e64368..dbc85d624 100644
--- a/pages/prompts/truthfulness.zh.mdx
+++ b/pages/prompts/truthfulness.zh.mdx
@@ -1,3 +1,8 @@
-# Truthfulness in LLMs
+# 生成内容的真实性
-This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
+import ContentFileNames from 'components/ContentFileNames'
+
+本节包含探索 LLM 真实性的提示集。
+
+
+
\ No newline at end of file
diff --git a/pages/prompts/truthfulness/_meta.zh.json b/pages/prompts/truthfulness/_meta.zh.json
new file mode 100644
index 000000000..b9de7a33b
--- /dev/null
+++ b/pages/prompts/truthfulness/_meta.zh.json
@@ -0,0 +1,3 @@
+{
+ "identify-hallucination": "识别 LLM 回答中的幻觉"
+}
\ No newline at end of file
diff --git a/pages/prompts/truthfulness/identify-hallucination.en.mdx b/pages/prompts/truthfulness/identify-hallucination.en.mdx
index 268090517..26d9aa4f3 100644
--- a/pages/prompts/truthfulness/identify-hallucination.en.mdx
+++ b/pages/prompts/truthfulness/identify-hallucination.en.mdx
@@ -38,18 +38,18 @@ Please read the above medical note and verify that each claim is exactly contain
client = OpenAI()
response = client.chat.completions.create(
- model="gpt-4",
- messages=[
- {
- "role": "user",
- "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nQuestion: Please rewrite the data above into a medical note, using exclusively the information above.\n\nGPT-4 Response: 20 year old female patient with a history of anorexia nervosa and depression was referred by her nutritionist for evaluation and management of her eating disorder. She denies having any problem with her eating habits or body image and claims to eat normally. However, she is severely underweight for her height (BMI 16.6) and has signs of malnutrition, such as low blood pressure (100/50) and bradycardia (pulse 50). She also reports feeling depressed and hopeless. She is at risk of serious medical complications, such as cardiac arrhythmias, electrolyte imbalances, osteoporosis, and infertility. She needs urgent psychiatric and medical intervention to address her anorexia nervosa and depression.\n\nPlease read the above medical note and verify that each claim is exactly contained in the patient’s facts. Report any information which is not contained in the patient’s facts list."
- }
- ],
- temperature=1,
- max_tokens=250,
- top_p=1,
- frequency_penalty=0,
- presence_penalty=0
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nQuestion: Please rewrite the data above into a medical note, using exclusively the information above.\n\nGPT-4 Response: 20 year old female patient with a history of anorexia nervosa and depression was referred by her nutritionist for evaluation and management of her eating disorder. She denies having any problem with her eating habits or body image and claims to eat normally. However, she is severely underweight for her height (BMI 16.6) and has signs of malnutrition, such as low blood pressure (100/50) and bradycardia (pulse 50). She also reports feeling depressed and hopeless. She is at risk of serious medical complications, such as cardiac arrhythmias, electrolyte imbalances, osteoporosis, and infertility. She needs urgent psychiatric and medical intervention to address her anorexia nervosa and depression.\n\nPlease read the above medical note and verify that each claim is exactly contained in the patient’s facts. Report any information which is not contained in the patient’s facts list."
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
)
```
@@ -62,8 +62,8 @@ Please read the above medical note and verify that each claim is exactly contain
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
- "role": "user",
- "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nQuestion: Please rewrite the data above into a medical note, using exclusively the information above.\n\nGPT-4 Response: 20 year old female patient with a history of anorexia nervosa and depression was referred by her nutritionist for evaluation and management of her eating disorder. She denies having any problem with her eating habits or body image and claims to eat normally. However, she is severely underweight for her height (BMI 16.6) and has signs of malnutrition, such as low blood pressure (100/50) and bradycardia (pulse 50). She also reports feeling depressed and hopeless. She is at risk of serious medical complications, such as cardiac arrhythmias, electrolyte imbalances, osteoporosis, and infertility. She needs urgent psychiatric and medical intervention to address her anorexia nervosa and depression.\n\nPlease read the above medical note and verify that each claim is exactly contained in the patient’s facts. Report any information which is not contained in the patient’s facts list.",
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nQuestion: Please rewrite the data above into a medical note, using exclusively the information above.\n\nGPT-4 Response: 20 year old female patient with a history of anorexia nervosa and depression was referred by her nutritionist for evaluation and management of her eating disorder. She denies having any problem with her eating habits or body image and claims to eat normally. However, she is severely underweight for her height (BMI 16.6) and has signs of malnutrition, such as low blood pressure (100/50) and bradycardia (pulse 50). She also reports feeling depressed and hopeless. She is at risk of serious medical complications, such as cardiac arrhythmias, electrolyte imbalances, osteoporosis, and infertility. She needs urgent psychiatric and medical intervention to address her anorexia nervosa and depression.\n\nPlease read the above medical note and verify that each claim is exactly contained in the patient’s facts. Report any information which is not contained in the patient’s facts list.",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
diff --git a/pages/prompts/truthfulness/identify-hallucination.zh.mdx b/pages/prompts/truthfulness/identify-hallucination.zh.mdx
new file mode 100644
index 000000000..d50392480
--- /dev/null
+++ b/pages/prompts/truthfulness/identify-hallucination.zh.mdx
@@ -0,0 +1,86 @@
+# 识别 LLM 回答中的幻觉
+
+import {Tabs, Tab} from 'nextra/components'
+import {Callout} from 'nextra/components'
+
+## 背景
+以下提示测试了 LLM 在 [封闭域问答](/question-answering/closed-domain) 背景下识别幻觉的能力。Bubeck 等人 (2023) 建议可以利用 GPT-4 等 LLM 来识别幻觉。
+
+
+ 请注意,由于任务的挑战性,当 LLM 对问题没有知识或背景时,它们可能会产生幻觉。
+
+
+该提示稍作修改,包含指示符以显示提示的各部分对应哪些信息。
+
+## 提示
+```markdown
+患者情况:
+- 20 岁女性
+- 有神经性厌食症和抑郁症病史
+- 血压 100/50,脉搏 50,身高 5’5’’
+- 由她的营养师转诊,但否认自己有病
+- 报告进食正常,但严重体重不足
+
+问题:请将上述数据重新写成一份病历记录,只使用以上信息。
+
+GPT-4 回答:20 岁女性患者,有神经性厌食症和抑郁症病史,由她的营养师转诊以评估和管理她的饮食失调。她否认自己在饮食习惯或身体形象方面有任何问题,并声称吃得正常。然而,她的体重严重不足(BMI 16.6),并有营养不良的迹象,如低血压(100/50)和心动过缓(脉搏 50)。她还报告感到抑郁和绝望。她有严重医学并发症的风险,如心律失常、电解质失衡、骨质疏松和不孕。她需要紧急的精神和医学干预来处理她的神经性厌食症和抑郁症。
+
+请阅读以上病历记录,并核实每个陈述是否完全包含在患者情况中。报告任何不包含在患者情况列表中的信息。
+```
+
+## 代码 / API
+
+
+
+
+ ```python
+ from openai import OpenAI
+ client = OpenAI ()
+
+ response = client.chat.completions.create (
+ model="gpt-4",
+ messages=[
+ {
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nQuestion: Please rewrite the data above into a medical note, using exclusively the information above.\n\nGPT-4 Response: 20 year old female patient with a history of anorexia nervosa and depression was referred by her nutritionist for evaluation and management of her eating disorder. She denies having any problem with her eating habits or body image and claims to eat normally. However, she is severely underweight for her height (BMI 16.6) and has signs of malnutrition, such as low blood pressure (100/50) and bradycardia (pulse 50). She also reports feeling depressed and hopeless. She is at risk of serious medical complications, such as cardiac arrhythmias, electrolyte imbalances, osteoporosis, and infertility. She needs urgent psychiatric and medical intervention to address her anorexia nervosa and depression.\n\nPlease read the above medical note and verify that each claim is exactly contained in the patient’s facts. Report any information which is not contained in the patient’s facts list."
+ }
+ ],
+ temperature=1,
+ max_tokens=250,
+ top_p=1,
+ frequency_penalty=0,
+ presence_penalty=0
+ )
+ ```
+
+
+
+ ```python
+ import fireworks.client
+ fireworks.client.api_key = ""
+ completion = fireworks.client.ChatCompletion.create (
+ model="accounts/fireworks/models/mixtral-8x7b-instruct",
+ messages=[
+ {
+ "role": "user",
+ "content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nQuestion: Please rewrite the data above into a medical note, using exclusively the information above.\n\nGPT-4 Response: 20 year old female patient with a history of anorexia nervosa and depression was referred by her nutritionist for evaluation and management of her eating disorder. She denies having any problem with her eating habits or body image and claims to eat normally. However, she is severely underweight for her height (BMI 16.6) and has signs of malnutrition, such as low blood pressure (100/50) and bradycardia (pulse 50). She also reports feeling depressed and hopeless. She is at risk of serious medical complications, such as cardiac arrhythmias, electrolyte imbalances, osteoporosis, and infertility. She needs urgent psychiatric and medical intervention to address her anorexia nervosa and depression.\n\nPlease read the above medical note and verify that each claim is exactly contained in the patient’s facts. Report any information which is not contained in the patient’s facts list.",
+ }
+ ],
+ stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
+ stream=True,
+ n=1,
+ top_p=1,
+ top_k=40,
+ presence_penalty=0,
+ frequency_penalty=0,
+ prompt_truncate_len=1024,
+ context_length_exceeded_behavior="truncate",
+ temperature=0.9,
+ max_tokens=4000
+ )
+ ```
+
+
+
+## 参考
+- [人工通用智能的曙光:GPT-4 的早期实验](https://arxiv.org/abs/2303.12712) (2023 年 4 月 13 日)
\ No newline at end of file
diff --git a/pages/research/_meta.zh.json b/pages/research/_meta.zh.json
index f89791357..3eb09bbb7 100644
--- a/pages/research/_meta.zh.json
+++ b/pages/research/_meta.zh.json
@@ -1,15 +1,15 @@
{
- "llm-agents": "LLM Agents",
- "rag": "RAG for LLMs",
- "llm-reasoning": "LLM Reasoning",
- "rag-faithfulness": "RAG Faithfulness",
- "llm-recall": "LLM In-Context Recall",
- "rag_hallucinations": "RAG Reduces Hallucination",
- "synthetic_data": "Synthetic Data",
- "thoughtsculpt": "ThoughtSculpt",
- "infini-attention": "Infini-Attention",
- "guided-cot": "LM-Guided CoT",
- "trustworthiness-in-llms": "Trustworthiness in LLMs",
- "llm-tokenization": "LLM Tokenization",
- "groq": "Groq 是什么?"
+ "llm-agents": "代理 (LLM Agents)",
+ "rag": "检索增强生成 (RAG)",
+ "rag_hallucinations": "利用 RAG 减少幻觉",
+ "rag-faithfulness": "RAG 的效果评估",
+ "llm-reasoning": "模型推理能力 (Reasoning)",
+ "llm-recall": "上下文记忆能力 (In-Context Recall)",
+ "synthetic_data": "合成数据 (Synthetic Data)",
+ "infini-attention": "超长文本 (Infini-Attention)",
+ "guided-cot": "小模型引导的思维链 (LM guided CoT)",
+ "llm-tokenization": "标记化(Tokenization)",
+ "trustworthiness-in-llms": "大模型的可性度评估",
+ "thoughtsculpt": "基于图的自我修订与搜索推理框架 ThoughtSculpt",
+ "groq": "芯片加速"
}
\ No newline at end of file
diff --git a/pages/research/llm-tokenization.zh.mdx b/pages/research/llm-tokenization.zh.mdx
index aace80158..18d0edbe7 100644
--- a/pages/research/llm-tokenization.zh.mdx
+++ b/pages/research/llm-tokenization.zh.mdx
@@ -1,6 +1,6 @@
# 大语言模型(LLM)的标记化处理
-Andrej Karpathy 最近发布了一个关于如何对大型语言模型(Large Language Model,简称 LLM)进行标记化处理的新[讲座视频](https://youtu.be/zduSFxRajkE?si=Hq_93DBE72SQt73V)。标记化是训练这类模型时的核心环节,它包括使用专属的数据集和算法(比如[字节对编码](https://en.wikipedia.org/wiki/Byte_pair_encoding))来训练标记器。
+Tokenization 是将文本拆分成一个个的令牌 / 字符单元(tokens)的过程,Andrej Karpathy 最近发布了一个关于如何对大型语言模型(Large Language Model,简称 LLM)进行标记化处理的新 [讲座视频](https://youtu.be/zduSFxRajkE?si=Hq_93DBE72SQt73V)。标记化是训练这类模型时的核心环节,它包括使用专属的数据集和算法(比如 [字节对编码](https://en.wikipedia.org/wiki/Byte_pair_encoding))来训练标记器。
在讲座中,Karpathy 向我们展示了如何从零开始构建一个 GPT 标记器,并探讨了与标记化相关的一些异常行为。
diff --git a/pages/research/thoughtsculpt.zh.mdx b/pages/research/thoughtsculpt.zh.mdx
index 03b853be2..90e8f0c55 100644
--- a/pages/research/thoughtsculpt.zh.mdx
+++ b/pages/research/thoughtsculpt.zh.mdx
@@ -1,9 +1,9 @@
# 大语言模型的中间修订与搜索推理
-[Chi 等人(2024)的研究](https://arxiv.org/abs/2404.05966))提出了一种用于可分解为组件的任务的通用推理和搜索方法。
+[Chi 等人(2024)的研究](https://arxiv.org/abs/2404.05966) 提出了一种用于可分解为组件的任务的通用推理和搜索方法。
-他们提出的基于图的框架——THOUGHTSCULPT,融入了迭代自我修正的能力,允许大语言模型构建一个交织的思维网络。
+他们提出的基于图的框架 ——THOUGHTSCULPT,融入了迭代自我修正的能力,允许大语言模型构建一个交织的思维网络。
与 Tree-of-thoughts 这样使用树形结构塑造推理过程的方法不同,这个新方法结合了蒙特卡洛树搜索(MCTS)来高效地导航搜索空间。
diff --git a/pages/techniques/_meta.zh.json b/pages/techniques/_meta.zh.json
index 5d30bc675..562b59539 100644
--- a/pages/techniques/_meta.zh.json
+++ b/pages/techniques/_meta.zh.json
@@ -4,16 +4,16 @@
"cot": "链式思考(CoT)提示",
"consistency": "自我一致性",
"knowledge": "生成知识提示",
- "prompt_chaining": "Prompt Chaining",
+ "prompt_chaining": "链式提示 (Prompt Chaining)",
"tot": "思维树(ToT)",
"rag": "检索增强生成 (RAG)",
"art": "自动推理并使用工具(ART)",
"ape": "自动提示工程师",
- "activeprompt": "Active-Prompt",
+ "activeprompt": "主动提示 (Active-Prompt)",
"dsp": "方向性刺激提示",
- "pal": "Program-Aided Language Models",
- "react": "ReAct框架",
- "reflexion": "Reflexion",
+ "pal": "程序辅助语言模型 (PAL)",
+ "react": "ReAct 框架",
+ "reflexion": "自我反思 (Reflexion)",
"multimodalcot": "多模态思维链提示方法",
"graph": "基于图的提示"
}
diff --git a/pages/techniques/activeprompt.zh.mdx b/pages/techniques/activeprompt.zh.mdx
index fb9b2f461..c16aaa596 100644
--- a/pages/techniques/activeprompt.zh.mdx
+++ b/pages/techniques/activeprompt.zh.mdx
@@ -1,12 +1,12 @@
# Active-Prompt
-import { Callout, FileTree } from 'nextra-theme-docs'
+import {Callout, FileTree} from 'nextra-theme-docs'
import {Screenshot} from 'components/screenshot'
import ACTIVE from '../../img/active-prompt.png'
-思维链(CoT)方法依赖于一组固定的人工注释范例。问题在于,这些范例可能不是不同任务的最有效示例。为了解决这个问题,[Diao 等人(2023)](https://arxiv.org/pdf/2302.12246.pdf)最近提出了一种新的提示方法,称为 Active-Prompt,以适应 LLMs 到不同的任务特定示例提示(用人类设计的 CoT 推理进行注释)。
+思维链(CoT)方法依赖于一组固定的人工注释范例。问题在于,这些范例可能不是不同任务的最有效示例。为了解决这个问题,[Diao 等人(2023)](https://arxiv.org/pdf/2302.12246.pdf) 最近提出了一种新的提示方法,称为 Active-Prompt,以适应 LLMs 到不同的任务特定示例提示(用人类设计的 CoT 推理进行注释)。
下面是该方法的说明。第一步是使用或不使用少量 CoT 示例查询 LLM。对一组训练问题生成 *k* 个可能的答案。基于 *k* 个答案计算不确定度度量(使用不一致性)。选择最不确定的问题由人类进行注释。然后使用新的注释范例来推断每个问题。
-图片来源:[Diao等人(2023)](https://arxiv.org/pdf/2302.12246.pdf)
\ No newline at end of file
+图片来源:[Diao 等人(2023)](https://arxiv.org/pdf/2302.12246.pdf)
\ No newline at end of file
diff --git a/pages/techniques/pal.zh.mdx b/pages/techniques/pal.zh.mdx
index ff53b9e97..93e58122f 100644
--- a/pages/techniques/pal.zh.mdx
+++ b/pages/techniques/pal.zh.mdx
@@ -4,14 +4,14 @@ import { Callout, FileTree } from 'nextra-theme-docs'
import {Screenshot} from 'components/screenshot'
import PAL from '../../img/pal.png'
-[Gao 等人(2022)](https://arxiv.org/abs/2211.10435)提出了一种使用 LLMs 读取自然语言问题并生成程序作为中间推理步骤的方法。被称为程序辅助语言模型(PAL),它与思维链提示不同,因为它不是使用自由形式文本来获得解决方案,而是将解决步骤卸载到类似 Python 解释器的编程运行时中。
+[Gao 等人(2022)](https://arxiv.org/abs/2211.10435)提出了一种使用 LLMs 读取自然语言问题并生成程序作为中间推理步骤的方法。被称为程序辅助语言模型(PAL, Program-Aided Language Models),它与思维链提示不同,因为它不是使用自由形式文本来获得解决方案,而是将解决步骤卸载到类似 Python 解释器的编程运行时中。
图片来源:[Gao 等人(2022)](https://arxiv.org/abs/2211.10435)
让我们以 LangChain 和 OpenAI GPT-3 为例。我们有兴趣开发一个简单的应用程序,它能够解释所提出的问题,并利用 Python 解释器提供答案。
-具体来说,我们有兴趣创建一个功能,允许使用 LLM 回答需要日期理解的问题。我们将为 LLM 提供一个提示,其中包括一些示例,这些示例是从[这里](https://github.com/reasoning-machines/pal/blob/main/pal/prompt/date_understanding_prompt.py)采用的。
+具体来说,我们有兴趣创建一个功能,允许使用 LLM 回答需要日期理解的问题。我们将为 LLM 提供一个提示,其中包括一些示例,这些示例是从 [这里](https://github.com/reasoning-machines/pal/blob/main/pal/prompt/date_understanding_prompt.py) 采用的。
这是我们需要导入的包:
@@ -42,7 +42,7 @@ os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
llm = OpenAI(model_name='text-davinci-003', temperature=0)
```
-设置提示+问题:
+设置提示 + 问题:
```python
question = "Today is 27 February 2023. I was born exactly 25 years ago. What is the date I was born in MM/DD/YYYY?"
diff --git a/pages/techniques/rag.zh.mdx b/pages/techniques/rag.zh.mdx
index c25c169b1..60627dbc6 100644
--- a/pages/techniques/rag.zh.mdx
+++ b/pages/techniques/rag.zh.mdx
@@ -7,7 +7,7 @@ import RAG from '../../img/rag.png'
要完成更复杂和知识密集型的任务,可以基于语言模型构建一个系统,访问外部知识源来做到。这样的实现与事实更加一性,生成的答案更可靠,还有助于缓解“幻觉”问题。
-Meta AI 的研究人员引入了一种叫做[检索增强生成(Retrieval Augmented Generation,RAG)](https://ai.facebook.com/blog/retrieval-augmented-generation-streamlining-the-creation-of-intelligent-natural-language-processing-models/)的方法来完成这类知识密集型的任务。RAG 把一个信息检索组件和文本生成模型结合在一起。RAG 可以微调,其内部知识的修改方式很高效,不需要对整个模型进行重新训练。
+Meta AI 的研究人员引入了一种叫做 [检索增强生成(Retrieval Augmented Generation,RAG)](https://ai.facebook.com/blog/retrieval-augmented-generation-streamlining-the-creation-of-intelligent-natural-language-processing-models/) 的方法来完成这类知识密集型的任务。RAG 把一个信息检索组件和文本生成模型结合在一起。RAG 可以微调,其内部知识的修改方式很高效,不需要对整个模型进行重新训练。
RAG 会接受输入并检索出一组相关/支撑的文档,并给出文档的来源(例如维基百科)。这些文档作为上下文和输入的原始提示词组合,送给文本生成器得到最终的输出。这样 RAG 更加适应事实会随时间变化的情况。这非常有用,因为 LLM 的参数化知识是静态的。RAG 让语言模型不用重新训练就能够获取最新的信息,基于检索生成产生可靠的输出。