Merge branch 'main' into guided_cot

pull/451/head
Erik Behrends 3 weeks ago committed by GitHub
commit c8af326afb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@ -116,14 +116,14 @@ Sentiment:
Neutre
```
Nous avons donné l'instruction de classer le texte et le modèle a répondu avec `'Neutral'` qui est correct. Rien ne va pas avec cela, mais disons que ce dont nous avons vraiment besoin est que le modèle donne l'étiquette dans le format exact que nous voulons. Donc, au lieu de `Neutral`, nous voulons qu'il retourne `Neutral`. Comment y parvenir ? Il existe différentes façons de le faire. Nous nous soucions de la spécificité ici, donc plus nous pouvons fournir d'informations à la demande, meilleurs seront les résultats. Nous pouvons essayer de fournir des exemples pour spécifier le comportement correct. Essayons à nouveau :
Nous avons donné l'instruction de classer le texte et le modèle a répondu avec `'Neutre'` qui est correct. Rien ne va pas avec cela, mais disons que ce dont nous avons vraiment besoin est que le modèle donne l'étiquette dans le format exact que nous voulons. Donc, au lieu de `Neutre`, nous voulons qu'il retourne `neutre`. Comment y parvenir ? Il existe différentes façons de le faire. Nous nous soucions de la spécificité ici, donc plus nous pouvons fournir d'informations à la demande, meilleurs seront les résultats. Nous pouvons essayer de fournir des exemples pour spécifier le comportement correct. Essayons à nouveau :
*Prompt:*
```
Classez le texte en neutre, négatif ou positif.
Text: Je pense que les vacances vont bien.
Sentiment: neutral
Sentiment: neutre
Text: Je pense que la nourriture était correcte..
Sentiment:
@ -131,10 +131,10 @@ Sentiment:
*Output:*
```
neutral
neutre
```
Parfait ! Cette fois-ci, le modèle a retourné `neutral`, qui est l'étiquette spécifique que je cherchais. Il semble que l'exemple fourni dans l'instruction ait aidé le modèle à être spécifique dans sa sortie. Pour souligner pourquoi parfois être précis est important, jetez un coup d'œil à cet exemple et repérez le problème :
Parfait ! Cette fois-ci, le modèle a retourné `neutre`, qui est l'étiquette spécifique que je cherchais. Il semble que l'exemple fourni dans l'instruction ait aidé le modèle à être spécifique dans sa sortie. Pour souligner pourquoi parfois être précis est important, jetez un coup d'œil à cet exemple et repérez le problème :
*Prompt:*
```
@ -146,7 +146,7 @@ Sentiment:
*Output:*
```
Neutral
Neutre
```
Quel est le problème ici?
@ -212,7 +212,7 @@ let name = prompt("What is your name?");
console.log(`Hello, ${name}!`);
```
Vous pouvez voir que nous n'avons même pas eu besoin de spécifier la langue à utiliser.
Vous pouvez voir que nous n'avons même pas eu besoin de spécifier le langage à utiliser.
Changeons un peu de niveau. Je veux vous montrer à quel point les LLM peuvent être puissants avec un peu plus d'effort dans la conception des instructions.
@ -285,4 +285,4 @@ Beaucoup mieux, n'est-ce pas? Au fait, j'ai essayé cela plusieurs fois et le sy
Nous continuerons à inclure d'autres exemples d'applications courantes dans cette section du guide.
Dans la section suivante, nous couvrirons des concepts et des techniques d'ingénierie de prompt encore plus avancés pour améliorer les performances sur toutes ces tâches ainsi que sur des tâches plus difficiles.
Dans la section suivante, nous couvrirons des concepts et des techniques d'ingénierie de prompt encore plus avancés pour améliorer les performances sur toutes ces tâches ainsi que sur des tâches plus difficiles.

@ -1,5 +1,15 @@
# LLM Einstellungen
import {Bleed} from 'nextra-theme-docs'
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/CB0H7esOl68?si=OECAnvgnvJHy0qZ2" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>
Beim Entwerfen und Testen von Prompts interagieren Sie normalerweise über eine API mit dem LLM. Sie können einige Parameter konfigurieren, um unterschiedliche Ergebnisse für Ihre Prompts zu erhalten. Das Anpassen dieser Einstellungen ist wichtig, um die Zuverlässigkeit und Erwünschtheit der Antworten zu verbessern, und es bedarf des Experimentierens, um die richtigen Einstellungen für Ihre Anwendungsfälle herauszufinden. Unten finden Sie die gängigen Einstellungen, auf die Sie bei der Verwendung verschiedener LLM-Anbieter stoßen werden:
**Temperatur** - Kurz gesagt, je niedriger die `temperature`, desto deterministischer sind die Ergebnisse in dem Sinne, dass immer das wahrscheinlichste nächste Token gewählt wird. Eine Erhöhung der Temperatur kann zu mehr Zufälligkeit führen und damit vielfältigere oder kreativere Ausgaben fördern. Sie erhöhen im Grunde das Gewicht der anderen möglichen Tokens. Im Hinblick auf die Anwendung möchten Sie vielleicht einen niedrigeren Temperaturwert für Aufgaben wie faktenbasierte QA verwenden, um präzisere und knappere Antworten zu fördern. Für die Generierung von Gedichten oder andere kreative Aufgaben könnte es vorteilhaft sein, den Temperaturwert zu erhöhen.

@ -10,9 +10,11 @@
"gpt-4": "GPT-4",
"grok-1": "Grok-1",
"llama": "LLaMA",
"llama-3": "Llama 3",
"mistral-7b": "Mistral 7B",
"mistral-large": "Mistral Large",
"mixtral": "Mixtral",
"mixtral-8x22b": "Mixtral 8x22B",
"olmo": "OLMo",
"phi-2": "Phi-2",
"sora": "Sora",

@ -10,6 +10,7 @@
"gpt-4": "GPT-4",
"grok-1": "Grok-1",
"llama": "LLaMA",
"llama-3": "Llama 3",
"mistral-7b": "Mistral 7B",
"mistral-large": "Mistral Large",
"mixtral": "Mixtral",

@ -0,0 +1,49 @@
# Llama 3
import {Bleed} from 'nextra-theme-docs'
Meta hat kürzlich ihre neue Familie großer Sprachmodelle (LLMs), genannt Llama 3, [vorgestellt](https://llama.meta.com/llama3/). Diese Veröffentlichung umfasst vorab trainierte und anweisungsoptimierte Modelle mit 8 Milliarden und 70 Milliarden Parametern.
## Architekturdetails zu Llama 3
Hier eine Zusammenfassung der technischen Details von Llama 3:
- Es verwendet einen standardmäßigen Decoder-only-Transformer.
- Der Wortschatz umfasst 128K Token.
- Es wird auf Sequenzen von 8K Token trainiert.
- Es wendet gruppierte Abfrageaufmerksamkeit (GQA) an.
- Es ist auf über 15T Token vorab trainiert.
- Es beinhaltet eine Nachtrainierung, die eine Kombination aus SFT, Ablehnungs-Stichprobenentnahme, PPO und DPO einschließt.
## Leistung
Auffällig ist, dass Llama 3 8B (anweisungsoptimiert) [Gemma 7B](https://www.promptingguide.ai/models/gemma) und [Mistral 7B Instruct](https://www.promptingguide.ai/models/mistral-7b) übertrifft. Llama 3 70 übertrifft deutlich [Gemini Pro 1.5](https://www.promptingguide.ai/models/gemini-pro) und [Claude 3 Sonnet](https://www.promptingguide.ai/models/claude-3), bleibt jedoch beim MATH-Benchmark etwas hinter Gemini Pro 1.5 zurück.
!["Llama 3 Leistung"](../../img/llama3/llama-instruct-performance.png)
*Quelle: [Meta AI](https://ai.meta.com/blog/meta-llama-3/)*
Die vorab trainierten Modelle übertreffen ebenfalls andere Modelle bei mehreren Benchmarks wie AGIEval (Englisch), MMLU und Big-Bench Hard.
!["Llama 3 Leistung"](../../img/llama3/llama3-pretrained-results.png)
*Quelle: [Meta AI](https://ai.meta.com/blog/meta-llama-3/)*
## Llama 3 400B
Meta berichtete auch, dass sie ein Modell mit 400 Milliarden Parametern veröffentlichen werden, das derzeit noch trainiert wird und bald verfügbar sein soll! Es gibt auch Bemühungen um multimodale Unterstützung, mehrsprachige Fähigkeiten und längere Kontextfenster. Der aktuelle Checkpoint für Llama 3 400B (Stand 15. April 2024) liefert die folgenden Ergebnisse bei gängigen Benchmarks wie MMLU und Big-Bench Hard:
!["Llama 3 400B"](../../img/llama3/llama-400b.png)
*Quelle: [Meta AI](https://ai.meta.com/blog/meta-llama-3/)*
Die Lizenzinformationen für die Llama 3 Modelle können auf der [Modellkarte](https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md) gefunden werden.
## Ausführliche Bewertung von Llama 3
Hier folgt eine längere Bewertung von Llama 3:
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/h2aEmciRd6U?si=m7-xXu5IWpB-6mE0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>

@ -0,0 +1,49 @@
# Llama 3
import {Bleed} from 'nextra-theme-docs'
Meta recently [introduced](https://llama.meta.com/llama3/) their new family of large language models (LLMs) called Llama 3. This release includes 8B and 70B parameters pre-trained and instruction-tuned models.
## Llama 3 Architecture Details
Here is a summary of the mentioned technical details of Llama 3:
- It uses a standard decoder-only transformer.
- The vocabulary is 128K tokens.
- It is trained on sequences of 8K tokens.
- It applies grouped query attention (GQA)
- It is pretrained on over 15T tokens.
- It involves post-training that includes a combination of SFT, rejection sampling, PPO, and DPO.
## Performance
Notably, Llama 3 8B (instruction-tuned) outperforms [Gemma 7B](https://www.promptingguide.ai/models/gemma) and [Mistral 7B Instruct](https://www.promptingguide.ai/models/mistral-7b). Llama 3 70 broadly outperforms [Gemini Pro 1.5](https://www.promptingguide.ai/models/gemini-pro) and [Claude 3 Sonnet](https://www.promptingguide.ai/models/claude-3) and falls a bit behind on the MATH benchmark when compared to Gemini Pro 1.5.
!["Llama 3 Performance"](../../img/llama3/llama-instruct-performance.png)
*Source: [Meta AI](https://ai.meta.com/blog/meta-llama-3/)*
The pretrained models also outperform other models on several benchmarks like AGIEval (English), MMLU, and Big-Bench Hard.
!["Llama 3 Performance"](../../img/llama3/llama3-pretrained-results.png)
*Source: [Meta AI](https://ai.meta.com/blog/meta-llama-3/)*
## Llama 3 400B
Meta also reported that they will be releasing a 400B parameter model which is still training and coming soon! There are also efforts around multimodal support, multilingual capabilities, and longer context windows in the pipeline. The current checkpoint for Llama 3 400B (as of April 15, 2024) produces the following results on the common benchmarks like MMLU and Big-Bench Hard:
!["Llama 3 400B"](../../img/llama3/llama-400b.png)
*Source: [Meta AI](https://ai.meta.com/blog/meta-llama-3/)*
The licensing information for the Llama 3 models can be found on the [model card](https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md).
## Extended Review of Llama 3
Here is a longer review of Llama 3:
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/h2aEmciRd6U?si=m7-xXu5IWpB-6mE0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>

@ -0,0 +1,28 @@
# Mixtral 8x22B
Mixtral 8x22B ist ein neues offenes großes Sprachmodell (LLM), das von Mistral AI veröffentlicht wurde. Mixtral 8x22B wird als sparsames Mischmodell aus Experten charakterisiert, mit 39 Milliarden aktiven Parametern aus insgesamt 141 Milliarden Parametern.
## Fähigkeiten
Mixtral 8x22B wurde entwickelt, um ein kosteneffizientes Modell zu sein, mit Fähigkeiten, die mehrsprachiges Verständnis, mathematisches Denken, Codegenerierung, native Funktionsaufrufunterstützung und eingeschränkte Ausgabeunterstützung umfassen. Das Modell unterstützt eine Kontextfenstergröße von 64000 (64K) Token, was eine leistungsstarke Informationsabrufung bei großen Dokumenten ermöglicht.
Mistral AI behauptet, dass Mixtral 8x22B eines der besten Leistungs-Kosten-Verhältnisse unter den Community-Modellen bietet und aufgrund seiner sparsamen Aktivierungen deutlich schnell ist.
!["Mixtral 8x22B Leistung"](../../img/mixtral/mixtral-8-cost.png)
*Quelle: [Mistral AI Blog](https://mistral.ai/news/mixtral-8x22b/)*
## Ergebnisse
Gemäß den [offiziell berichteten Ergebnissen](https://mistral.ai/news/mixtral-8x22b/) übertrifft Mixtral 8x22B (mit 39 Milliarden aktiven Parametern) andere Spitzenmodelle wie Command R+ und Llama 2 70B in mehreren Denk- und Wissensbenchmarks wie MMLU, HellaS, TriQA, NaturalQA unter anderen.
!["Mixtral 8x22B Denk- und Wissensleistung"](../../img/mixtral/mixtral-8-reasoning.png)
*Quelle: [Mistral AI Blog](https://mistral.ai/news/mixtral-8x22b/)*
Mixtral 8x22B übertrifft alle offenen Modelle bei Programmier- und Mathematikaufgaben, wenn es anhand von Benchmarks wie GSM8K, HumanEval und Math bewertet wird. Es wird berichtet, dass Mixtral 8x22B Instruct eine Punktzahl von 90% auf GSM8K (maj@8) erreicht.
!["Mixtral 8x22B Denk- und Wissensleistung"](../../img/mixtral/mixtral-8-maths.png)
*Quelle: [Mistral AI Blog](https://mistral.ai/news/mixtral-8x22b/)*
Weitere Informationen zu Mixtral 8x22B und dessen Nutzung finden Sie hier: https://docs.mistral.ai/getting-started/open_weight_models/#operation/listModels
Das Modell wird unter einer Apache 2.0-Lizenz veröffentlicht.

@ -3,6 +3,8 @@
"rag": "RAG für LLMs",
"llm-reasoning": "LLM Reasoning",
"guided-cot": "LM-geführtes CoT",
"rag-faithfulness": "RAG Zuverlässigkeit",
"llm-recall": "LLM In-Context Recall",
"thoughtsculpt": "ThoughtSculpt",
"infini-attention": "Infini-Attention",
"trustworthiness-in-llms": "Vertrauenswürdigkeit in LLMs",

@ -2,6 +2,7 @@
"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",

@ -0,0 +1,21 @@
# Groq 是什么?
[Groq](https://groq.com/) 最近因其作为当今最快的大型语言模型LLM推理解决方案之一而广受关注。LLM 实践者对于降低LLM响应的延迟非常感兴趣因为延迟是一个重要的性能指标它需要被优化以支持实时人工智能应用。目前许多公司都在LLM推理领域展开竞争。
Groq 是那些声称在 [Anyscale 的 LLMPerf 排行榜](https://github.com/ray-project/llmperf-leaderboard)上,比其他顶尖的基于云的服务提供商快 18 倍的公司之一。Groq 目前通过其 API 提供了 Meta AI 的 Llama 2 70B 和 Mixtral 8x7B 等模型。这些模型由 Groq LPU™ 推理引擎驱动,该引擎是基于他们为运行 LLM 特别设计的定制硬件——语言处理单元LPUs构建的。
根据 Groq 的常见问题解答LPU 有助于减少每个单词的计算时间,从而加快文本序列的生成。您可以在他们获得 ISCA 奖项的 [2020 年](https://wow.groq.com/groq-isca-paper-2020/)和 [2022 年](https://wow.groq.com/isca-2022-paper/) 的论文中,阅读有关 LPU 技术细节及其优势的更多信息。
以下是一张展示了他们模型的速度和定价的图表:
!["Groq 定价"](../../img/research/groq.png)
下面的图表比较了输出词元吞吐量Output Tokens Throughput词元/秒),这是衡量每秒返回的平均输出词元数的指标。图表中的数字代表了基于 150 个请求的 Llama 2 70B 模型上LLM 推理服务提供商的平均输出词元吞吐量。
!["LLMPerf 排行榜"](https://github.com/ray-project/llmperf-leaderboard/blob/main/.assets/output_tokens_per_s.jpg?raw=true)
对于流媒体应用而言LLM 推理的另一个重要因素是首个词元时间Time to First TokenTTFT它指的是 LLM 返回第一个词元所需的时间。以下图表展示了不同 LLM 推理服务提供商在这方面的表现:
!["首个词元时间(秒)"](https://github.com/ray-project/llmperf-leaderboard/blob/main/.assets/ttft.jpg?raw=true)
您可以在[此处](https://wow.groq.com/groq-lpu-inference-engine-crushes-first-public-llm-benchmark/) 阅读有关 Groq 在 Anyscale 的 LLMPerf 排行榜上的 LLM 推理性能的更多信息。

@ -0,0 +1,19 @@
# 语言模型引导的思维链(CoT)
[Lee 等人2024的新研究](https://arxiv.org/abs/2404.03414)提出了一种创新方法,利用小型语言模型来提升大语言模型的推理能力。
首先,研究者将大型语言模型生成的解释通过知识蒸馏技术转移到小型语言模型上,以期缩小两者在推理能力上的差距。
在这种方法中,轻量级语言模型负责生成解释,而答案预测则由冻结的大型语言模型完成。这种方法不仅资源高效,而且免去了对大型模型的微调。
随后,研究者使用以解释和任务为导向的多种奖励信号,通过强化学习对知识蒸馏后的小型语言模型进行优化。
!["LM-Guide Chain-of-Thought"](../../img/research/guided-cot.png)
*来源https://arxiv.org/pdf/2404.03414.pdf*
该框架在多跳multi-hop抽取式问答任务上进行了测试并在答案预测准确率方面超过了所有基线方法。强化学习的应用提高了生成解释的质量进而提升了问答性能。
本文提出的语言模型引导的思维链提示方法在性能上超越了标准提示和传统思维链提示。自我一致性解码也进一步提高了性能。
这种方法巧妙地利用了小型语言模型来生成解释,其结果令人瞩目,因为人们通常认为大型语言模型更适合此类任务。开发者应当深入考虑这种任务分解的方式,并非所有任务都需要依赖大型模型来完成。在微调过程中,思考希望优化的具体方面,并探索小型语言模型是否能够胜任,是非常有用的。

@ -0,0 +1,17 @@
# 高效处理无限长文本的Transformer模型
Google的[最新研究](https://arxiv.org/abs/2404.07143)在标准的点积注意力机制中整合了压缩内存技术。
这项技术的目标是让Transformer大语言模型能够使用有限的内存足迹和计算资源有效地处理长度几乎无限的输入数据。
研究团队提出了一种名为Infini-attention的新型注意力技术它将一个压缩内存模块融入到了标准的注意力机制中。
!["Infini-Attention"](../../img/research/infini-attention.png)
Infini-attention技术在单个Transformer模块中结合了局部掩蔽注意力和长期线性注意力这使得Infini-Transformer模型能够高效地同时处理长距离和短距离的上下文依赖。
使用这种技术模型在处理长文本的语言建模任务中性能超越了现有的标准模型内存使用量压缩了114倍。
研究还表明一个拥有100亿参数的大语言模型可以轻松处理长度为100万的数据序列而一个拥有800亿参数的模型在处理50万字符长度的书籍摘要任务上取得了当前最佳的成绩。
随着处理长文本的大型语言模型变得越来越重要,通过高效的内存系统,这些模型将能更好地进行推理、规划和持续学习,展现出更加强大的问题处理能力。

@ -0,0 +1,36 @@
# 大语言模型的推理能力
在过去几年里,大语言模型(LLM/Large Language Model)在广泛的任务中取得了长足进展。最近随着规模的扩大LLM展现出了具备推理能力的潜力。推理是智力的基础但 AI 模型如何学会并利用这种能力来解决复杂问题尚不完全清楚。这是目前许多研究实验室关注和大力投资的热门领域。
## 基础模型的推理
[Sun et al. (2023)](https://arxiv.org/abs/2312.11562) 最近提出了一个关于基础模型推理的概述,重点介绍了各种推理任务的最新进展。该概述还着重探讨了跨多模态模型和自主语言智能体(AI Agent)的推理能力。
推理任务可能包括数学推理、逻辑推理、因果推理、视觉推理等。下图概述了该调查论文中讨论的推理任务,包括基础模型的推理技术,如对齐训练和上下文学习(In-context Learning)。
!["Reasoning Tasks"](../../img/research/reasoning-tasks.png)
*Figure source: [Sun et al. 2023](https://arxiv.org/pdf/2212.09597.pdf)*
## 如何引发LLM的推理能力?
可以通过多种提示方法来引发和增强LLM的推理能力。[Qiao et al. (2023)](https://arxiv.org/abs/2212.09597) 将推理方法研究分为推理增强策略和知识增强推理两大类。推理策略包括提示工程(Prompt Engineering)、过程优化和外部引擎。例如,单级提示策略有[思维链(Chain-of-Thought)](https://www.promptingguide.ai/techniques/cot) 和[主动提示(Active-Prompt)](https://www.promptingguide.ai/techniques/activeprompt)等。下图总结了该论文所提出的语言模型提示推理分类:
!["Reasoning Taxonomy"](../../img/research/reasoning-taxonomy.png)
*Figure source: [Qiao et al. 2023](https://arxiv.org/pdf/2212.09597.pdf)*
[Huang et al. (2023)](https://arxiv.org/pdf/2212.10403) 也总结了改进或引发大语言模型(LLM如 GPT-3)推理能力的多种技术,包括使用监督微调模型(在解释数据集上训练)到少样本(Few-shot)和零样本(Zero-shot)的提示方法,如思维链(Chain-of-Thought)、问题分解和上下文学习(In-context Learning)。下图总结了论文中描述的这些技术:
!["Reasoning Techniques"](../../img/research/reasoning-techniques.png)
*Figure source: [Huang et al. 2023](https://arxiv.org/pdf/2212.10403.pdf)*
## LLM 能否进行推理和规划?
关于 LLM 是否具备推理和规划的能力存在很大争议。推理和规划是 LLM 在机器人领域、自主智能体等复杂应用中发挥作用的关键能力。[这篇立场文章](https://arxiv.org/abs/2403.04121) 探讨了 LLM 推理和规划的话题。作者的结论总结如下:
> 从我所阅读、验证或完成的一切来看,都没有让我确信 LLM 确实能够进行通常所理解的推理/规划。它们所做的,是利用网络规模训练数据进行通用近似检索,这有时会被误认为是推理能力。
## 参考文献
- [语言模型提示推理:一项调查](https://arxiv.org/abs/2212.09597)
- [走向大语言模型推理:一项调查](https://arxiv.org/abs/2212.10403)
- [大语言模型能够推理和规划吗?](https://arxiv.org/abs/2403.04121)
- [重新思考LLM推理的范围:多智能体讨论是关键吗?](https://arxiv.org/abs/2402.18272v1)
- [Awesome LLM Reasoning](https://github.com/atfortes/Awesome-LLM-Reasoning)

@ -0,0 +1,26 @@
# LLM In-Context Recall hängt vom Prompt ab
import {Bleed} from 'nextra-theme-docs'
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/2cNO76lIZ4s?si=tbbdo-vnr56YQ077" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>
Dieses neue [Paper von Machlab und Battle (2024)](https://arxiv.org/abs/2404.08865) analysiert die In-Context Recall-Leistung verschiedener LLMs anhand mehrerer Nadel-im-Heuhaufen-Tests.
Es zeigt, dass verschiedene LLMs Fakten auf unterschiedlichen Längen und in verschiedener Tiefe erinnern. Es stellt fest, dass die Recall-Leistung eines Modells erheblich durch kleine Änderungen im Prompt beeinflusst wird.
!["Needle In the HayStack Performance"](../../img/research/haystack-performance.png)
*Quelle: [Machlab und Battle (2024)](https://arxiv.org/abs/2404.08865)*
Darüber hinaus kann das Zusammenspiel zwischen Prompt-Inhalt und Trainingsdaten die Antwortqualität verschlechtern.
Die Recall-Fähigkeit eines Modells kann durch Vergrößerung, Verbesserung des Attention-Mechanismus, das Ausprobieren verschiedener Trainingsstrategien und das Anwenden von Fine-Tuning verbessert werden.
Wichtiger praktischer Tipp aus dem Paper: „Die fortlaufende Bewertung wird die Auswahl von LLMs für individuelle Anwendungsfälle weiter informieren, ihre Wirkung und Effizienz in realen Anwendungen maximieren, da die Technologie weiterhin fortschreitet.“
Die wichtigsten Erkenntnisse aus diesem Paper sind die Bedeutung einer sorgfältigen Gestaltung des Prompts, die Einrichtung eines kontinuierlichen Bewertungsprotokolls und das Testen verschiedener Modellverbesserungsstrategien, um Recall und Nutzen zu verbessern.

@ -0,0 +1,16 @@
# 大型语言模型的上下文记忆受提示影响
[Machlab 和 Battle2024的新研究](https://arxiv.org/abs/2404.08865)分析了不同大型语言模型在“大海捞针”测试中的上下文记忆性能。
研究表明,各种大型语言模型回忆事实的长度和位置各不相同,且模型回忆性能对提示的微小变化非常敏感。
!["Needle In the HayStack Performance"](../../img/research/haystack-performance.png)
*来源:[Machlab and Battle (2024)](https://arxiv.org/abs/2404.08865)*
此外,提示内容与训练数据之间的相互作用可能会降低回答的质量。
模型的回忆能力可以通过增加模型大小、增强注意力机制、尝试不同的训练策略和进行微调来提高。
论文提供了一个重要的实用建议“通过持续的评估可以更好地了解不同LLM在特定用例中的表现从而做出更明智的选择以最大化它们在实际应用中的影响力和效率。随着技术的不断发展这种评估和选择过程将变得更加重要和有效。”
研究的结论是,谨慎设计提示、建立持续的评估协议,并测试不同的模型改进策略对于提高记忆和实用性至关重要。

@ -0,0 +1,27 @@
# 大语言模型LLM的标记化处理
Andrej Karpathy 最近发布了一个关于如何对大型语言模型Large Language Model简称 LLM进行标记化处理的新[讲座视频](https://youtu.be/zduSFxRajkE?si=Hq_93DBE72SQt73V)。标记化是训练这类模型时的核心环节,它包括使用专属的数据集和算法(比如[字节对编码](https://en.wikipedia.org/wiki/Byte_pair_encoding))来训练标记器。
在讲座中Karpathy 向我们展示了如何从零开始构建一个 GPT 标记器,并探讨了与标记化相关的一些异常行为。
!["LLM Tokenization"](../../img/research/tokenization.png)
*图源https://youtu.be/zduSFxRajkE?t=6711*
以下是视频中提及的列表内容:
- 为什么大语言模型不能正确拼写单词?这是因为标记化。
- 为什么它不能执行像字符串反转这样的简单任务?同样是因为标记化。
- 为什么在处理日语等非英语语言时表现不佳?标记化的问题。
- 为什么它在简单算术方面表现糟糕?也是标记化导致的。
- GPT-2 为什么在用 Python 编码时遇到更多问题?依旧是标记化的问题。
- 当模型遇到 "\<endoftext\>" 这个字符串时为什么会突然停止?还是标记化的问题。
- 那些关于 "trailing whitespace" 的警告是什么意思?也是标记化引起的。
- 为什么询问 "SolidGoldMagikarp" 时模型会出错?同样是标记化的问题。
- 为什么在使用大语言模型时更倾向于使用 YAML 而不是 JSON这也是标记化的问题。
- 为什么大语言模型并不是真正的端到端语言模型?原因在于标记化。
- 什么才是痛苦真正的根源?在这一点上,讲座中以幽默的方式指出,也是标记化。
为了提升大语言模型的可靠性,了解如何有效地提示模型至关重要,这包括认识到它们的局限性。虽然在模型推理时对标记器的关注不多(除了设置 `max_tokens` 参数之外),但要想进行有效的提示工程,就需要像考虑如何构建和格式化提示一样,理解标记化过程中的内在限制和约束。例如,如果提示没有达到预期效果,可能是因为模型未能正确处理或标记化某个缩写词或概念,这是一个很多开发者和研究者在开发大语言模型时容易忽视的问题。
[Tiktokenizer](https://tiktokenizer.vercel.app/) 是一个实用的标记化工具Karpathy 在讲座中就是用它来演示的。

@ -0,0 +1,26 @@
# Wie zuverlässig sind RAG-Modelle?
import {Bleed} from 'nextra-theme-docs'
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/eEU1dWVE8QQ?si=b-qgCU8nibBCSX8H" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>
Dieses neue Paper von [Wu et al. (2024)](https://arxiv.org/abs/2404.10198) zielt darauf ab, das Kräftemessen zwischen den RAG-Modellen und der internen Priorisierung von LLMs zu quantifizieren.
Es konzentriert sich dabei auf GPT-4 und andere LLMs bei der Beantwortung von Fragen zur Analyse.
Es wurde festgestellt, dass das Bereitstellen korrekter abgerufener Informationen die meisten Fehler des Modells korrigiert (94% Genauigkeit).
!["RAG Treue"](../../img/research/rag-faith.png)
*Quelle: [Wu et al. (2024)](https://arxiv.org/abs/2404.10198)*
Wenn die Dokumente mehr falsche Werte enthalten und das interne Priorisieren des LLM schwach ist, neigt das LLM eher dazu, falsche Informationen wiederzugeben. Es wurde jedoch festgestellt, dass die LLMs widerstandsfähiger sind, wenn sie eine stärkere Vorprägung haben.
Das Paper berichtet auch, dass „je mehr die modifizierte Information von der Vorprägung des Modells abweicht, desto unwahrscheinlicher ist es, dass das Modell sie bevorzugt.“
Viele Entwickler und Unternehmen setzen RAG-Systeme in der Produktion ein. Diese Arbeit hebt die Bedeutung der Risikobewertung bei der Verwendung von LLMs hervor, die verschiedene Arten von Kontextinformationen enthalten können, die unterstützende, widersprüchliche oder völlig inkorrekte Informationen enthalten können.

@ -0,0 +1,26 @@
# How Faithful are RAG Models?
import {Bleed} from 'nextra-theme-docs'
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/eEU1dWVE8QQ?si=b-qgCU8nibBCSX8H" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>
This new paper by [Wu et al. (2024)](https://arxiv.org/abs/2404.10198) aims to quantify the tug-of-war between RAG and LLMs' internal prior.
It focuses on GPT-4 and other LLMs on question answering for the analysis.
It finds that providing correct retrieved information fixes most of the model mistakes (94% accuracy).
!["RAG Faithfulness"](../../img/research/rag-faith.png)
*Source: [Wu et al. (2024)](https://arxiv.org/abs/2404.10198)*
When the documents contain more incorrect values and the LLM's internal prior is weak, the LLM is more likely to recite incorrect information. However, the LLMs are found to be more resistant when they have a stronger prior.
The paper also reports that "the more the modified information deviates from the model's prior, the less likely the model is to prefer it."
So many developers and companies are using RAG systems in production. This work highlights the importance of assessing risks when using LLMs given different kinds of contextual information that may contain supporting, contradicting, or completely incorrection information.

@ -0,0 +1,16 @@
# RAG 模型的忠实度如何?
[Wu 等人2024的研究](https://arxiv.org/abs/2404.10198)旨在衡量 RAG 与 LLM 内部先验之间的角力。
研究重点分析了 GPT-4 和其他 LLMs 在问答任务上的表现。
研究发现,提供准确检索信息能显著减少模型错误,达到 94% 的准确率。
!["RAG Faithfulness"](../../img/research/rag-faith.png)
*来源:[Wu et al. (2024)](https://arxiv.org/abs/2404.10198)*
当文档中的错误信息增多且 LLM 的内部先验较弱时LLM 更倾向于重复错误信息。但是,当 LLM 拥有较强的先验时,它们对此类错误的抵抗力更强。
论文还指出,修改后的信息与模型先验的差异越大,模型选择这种信息的可能性就越小。
由于许多开发者和公司已经在生产环境中使用 RAG 系统,这项工作强调了在使用大型语言模型时,评估上下文信息中的支持性、矛盾性和错误性内容的重要性。

@ -188,6 +188,7 @@ Below is a collection of research papers highlighting key insights and the lates
| **Insight** | **Reference** | **Date** |
| ------------- | ------------- | ------------- |
| Shows how retrieval augmentation can be used to distill language model assistants by training retrieval augmented simulators | [KAUCUS: Knowledge Augmented User Simulators for Training Language Model Assistants](https://aclanthology.org/2024.scichat-1.5)| Mar 2024 |
| Proposes Corrective Retrieval Augmented Generation (CRAG) to improve the robustness of generation in a RAG system. The core idea is to implement a self-correct component for the retriever and improve the utilization of retrieved documents for augmenting generation. The retrieval evaluator helps to assess the overall quality of retrieved documents given a query. Using web search and optimized knowledge utilization operations can improve automatic self-correction and efficient utilization of retrieved documents. | [Corrective Retrieval Augmented Generation](https://arxiv.org/abs/2401.15884)| Jan 2024|
| Recursively embeds, clusters, and summarizes chunks of text, constructing a tree with differing levels of summarization from the bottom up. At inference time, the proposed RAPTOR model retrieves from the tree, integrating information across lengthy documents at different levels of abstraction. | [RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval](https://arxiv.org/abs/2401.18059)| Jan 2024 |
| A general program with multi-step interactions between LMs and retrievers to efficiently tackle multi-label classification problems. | [In-Context Learning for Extreme Multi-Label Classification](https://arxiv.org/abs/2401.12178) | Jan 2024 |
@ -242,6 +243,7 @@ Below is a collection of research papers highlighting key insights and the lates
## References
- [KAUCUS: Knowledge Augmented User Simulators for Training Language Model Assistants](https://aclanthology.org/2024.scichat-1.5)
- [A Survey on Hallucination in Large Language Models: Principles,Taxonomy, Challenges, and Open Questions](https://arxiv.org/abs/2311.05232)
- [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401)
- [Retrieval-augmented multimodal language modeling](https://arxiv.org/abs/2211.12561)
@ -257,4 +259,4 @@ Below is a collection of research papers highlighting key insights and the lates
- [Best Practices for LLM Evaluation of RAG Applications](https://www.databricks.com/blog/LLM-auto-eval-best-practices-RAG)
- [Building Production-Ready RAG Applications](https://youtu.be/TRjq7t2Ms5I?si=gywRj82NIc-wsHcF)
- [Evaluating RAG Part I: How to Evaluate Document Retrieval](https://www.deepset.ai/blog/rag-evaluation-retrieval)
- [Retrieval Augmented Generation meets Reciprocal Rank Fusion and Generated Queries](https://towardsdatascience.com/forget-rag-the-future-is-rag-fusion-1147298d8ad1)
- [Retrieval Augmented Generation meets Reciprocal Rank Fusion and Generated Queries](https://towardsdatascience.com/forget-rag-the-future-is-rag-fusion-1147298d8ad1)

@ -0,0 +1,12 @@
# 利用 RAG 降低结构化输出中的虚假信息
ServiceNow 的研究人员发表了一篇[新论文](https://arxiv.org/abs/2404.08189),探讨了如何为结构化输出任务高效部署 RAG 系统。
!["RAG Hallucination"](../../img/research/structured_outputs.png)
RAG 系统整合了小型语言模型和极小型检索器。研究表明RAG 使得在资源受限的环境下部署强大的 LLM 驱动的系统成为可能,同时减轻了虚假信息问题并提升了输出的可靠性。
论文讨论了一种极具实用价值的企业应用,即将自然语言需求转换为工作流程(以 JSON 格式)。这项任务能够极大提升生产力,尽管还有许多优化空间(例如,采用推测性解码或使用 YAML 代替 JSON
论文提供了关于如何在现实世界中有效开发 RAG 系统的宝贵见解和实用建议。

@ -0,0 +1,11 @@
# 语言模型合成数据的实用技巧与经验
这篇[论文](https://arxiv.org/abs/2404.07503)总结了语言模型合成数据的实用技巧与经验,由 Google DeepMind 及其他合作者共同发表。
该论文聚焦于合成数据,探讨了其在应用、挑战以及未来发展方向上的作用。鉴于 AI 领域合成数据带来的显著进步,这是一篇非常重要的论文。
我们深知,向模型提供高质量的数据越多,它们的性能就越好。然而,创建合成数据并不困难,真正的挑战在于确保其质量。
此外,该论文还讨论了在使用合成数据时需要关注的重要话题,如数据质量、事实性、忠实度、无偏见性、可信度、隐私等。
相关工作部分也列举了许多有价值的参考文献。

@ -0,0 +1,18 @@
# 大语言模型的中间修订与搜索推理
[Chi 等人2024的研究](https://arxiv.org/abs/2404.05966))提出了一种用于可分解为组件的任务的通用推理和搜索方法。
他们提出的基于图的框架——THOUGHTSCULPT融入了迭代自我修正的能力允许大语言模型构建一个交织的思维网络。
与 Tree-of-thoughts 这样使用树形结构塑造推理过程的方法不同这个新方法结合了蒙特卡洛树搜索MCTS来高效地导航搜索空间。
这个新方法使用了一个由大语言模型驱动的思维评估器来对候选的部分输出提供反馈。然后一个思维生成器组件产生可能的解决方案。思维评估器和思维生成器组成了扩展阶段,这一阶段有助于改进当前的解决方案。
!["ThoughtSculpt"](../../img/research/thoughtsculpt.png)
最后,决策模拟器(作为 MCTS 过程的一部分)模拟连续的思维线索来评估一条路径的潜在价值。
由于其能够持续迭代思维THOUGHTSCULPT 特别适合于诸如开放式生成、多步骤推理和创造性构思等任务。
我们可能会看到更多使用类似概念和搜索算法的先进方法,以提高大语言模型的推理能力,并增强处理需要复杂推理和规划的问题的能力。这是一篇跟踪这一研究趋势的好论文。

@ -1,3 +1,105 @@
# Prompt Chaining
This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right side.
import {Screenshot} from 'components/screenshot'
import PC1 from '../../img/prompt_chaining/prompt-chaining-1.png'
## プロンプトチェイニングの紹介
LLMの信頼性と性能を向上させるために、重要な手法の一つとして、タスクを複数のサブタスクに分割することがあります。これらのサブタスクが特定されると、LLMはそれぞれに対してプロンプトを出し、その回答を次のプロンプトの入力として利用します。これをプロンプト・チェイニングと呼び、タスクをサブタスクに分割してプロンプトの連鎖を作ることが目的です。
この方法は、LLMが一度に扱うには複雑すぎる詳細なプロンプトに対処する際に有効です。プロンプトを連鎖させることで、望ましい最終結果に到達する前に、生成された応答に対して変更や追加の処理を行うことができます。プロンプトの連鎖はパフォーマンスを向上させるだけでなく、LLMアプリケーションの透明性を高め、より良い制御性と信頼性を実現するのに役立ちます。これにより、モデルの応答に関する問題を簡単にデバッグし、改善が必要な各段階のパフォーマンスを分析して改善することが可能になります。特に、LLMを使った会話アシスタントを構築し、アプリケーションのパーソナライズとユーザーエクスペリエンスを向上させる際にプロンプト・チェイニングは有効です。
## プロンプト・チェイニングの使用例
### ドキュメントQAのためのプロンプト・チェイニング
プロンプト・チェイニングは、さまざまな操作や変換を伴うシナリオで利用可能です。例として、LLMの一般的な用途のひとつに、長い文章に基づいた質問に答えることがあります。
ここで2つの異なるプロンプトを用意します。最初のプロンプトは、関連する引用を抽出して質問に答えるためのもので、次のプロンプトは、抽出された引用と元のドキュメントを使って質問に答えます。つまり、2つのステップを経て、ドキュメントにおける質問に対する回答を得ることが目的です。
以下の最初のプロンプト例では、質問に基づいてドキュメントから関連する引用を抽出するよう設計されています。簡潔さを保つために、文書のプレースホルダーを設定しています。このプロンプトを試す場合は、ウィキペディアの記事をコピー&ペーストし、このページで[プロンプトエンジニアリング](https://en.wikipedia.org/wiki/Prompt_engineering)を適用してみてくださいこのタスクには広範なコンテキストが必要なため、OpenAIの`gpt-4-1106-preview`モデルを使用します。このプロンプトは、Claudeのような長いコンテキストを扱うLLMでも使用可能です。
プロンプト1
```
あなたは親切なアシスタントです。
あなたの仕事は、文書で与えられた質問に答えるのを助けることです。最初のステップは、####で区切られた文書から質問に関連する引用を抽出することです。
引用のリストは<quotes></quotes>を使って出力してください。関連する引用が見つからなかった場合は「関連する引用は見つかりませんでした。]と返信してください。
####
{{document}}
####
```
これは、`user`のroleを使用して渡される質問を含むプロンプト全体のスクリーンショットです。
<Screenshot src={PC1} alt="Prompt Chaining Part 1" />
Output of Prompt 1:
```
<quotes>
- Chain-of-thought (CoT) prompting[27]
- Generated knowledge prompting[37]
- Least-to-most prompting[38]
- Self-consistency decoding[39]
- Complexity-based prompting[41]
- Self-refine[42]
- Tree-of-thought prompting[43]
- Maieutic prompting[45]
- Directional-stimulus prompting[46]
- Textual inversion and embeddings[59]
- Using gradient descent to search for prompts[61][62][63][64]
- Prompt injection[65][66][67]
</quotes>
```
最初のプロンプトで得られた引用は、次に示す2番目のプロンプトの入力として使用できます。引用をもう少し整理することもできます。つまり、引用部分から出典を取り除くことが可能です。これらの出典は削除するか、別のプロンプトの一部として活用することができますが、現段階では無視しても構いません。
次に、2番目のプロンプトは、プロンプト1で抽出された関連する引用を取り、文書で提起された質問と抽出された引用に対して有益な回答を準備します。
2番目のプロンプトは以下のようになります
```
ある文書から抽出された関連する引用(<quotes></quotes>で区切られています)と元の文書(###で区切られています)が与えられたら、質問に対する答えを作成してください。
回答は正確で、友好的な口調で、役に立つように聞こえるようにしてください。
####
{{document}}
####
<quotes>
- Chain-of-thought (CoT) prompting[27]
- Generated knowledge prompting[37]
- Least-to-most prompting[38]
- Self-consistency decoding[39]
- Complexity-based prompting[41]
- Self-refine[42]
- Tree-of-thought prompting[43]
- Maieutic prompting[45]
- Directional-stimulus prompting[46]
- Textual inversion and embeddings[59]
- Using gradient descent to search for prompts[61][62][63][64]
- Prompt injection[65][66][67]
</quotes>
```
Output of Prompt 2:
```
文書で言及されているプロンプトのテクニックには、以下のようなものがある:
1. Chain-of-thought (CoT) prompting[27]
2. Generated knowledge prompting[37]
3. Least-to-most prompting[38]
4. Self-consistency decoding[39]
5. Complexity-based prompting[41]
6. Self-refine[42]
7. Tree-of-thought prompting[43]
8. Maieutic prompting[45]
9. Directional-stimulus prompting[46]
10. Textual inversion and embeddings[59]
11. Using gradient descent to search for prompts[61][62][63][64]
12. Prompt injection[65][66][67]
これらの技法はそれぞれ、大規模な言語モデルとの相互作用を強化したり特定したりして、望ましい結果を生み出すための独自の戦略を採用している。
```
おわかりのように、プロンプトチェーンを簡略化して作成することは、応答 がいくつかの操作や変換を受ける必要がある場合に有効なプロンプトアプローチである。練習として、アプリケーションのユーザーに最終的なレスポンスとして送信する前に、レスポンスから引用 (例: 27) を削除するプロンプトを自由に設計してください。
プロンプトチェイニングの例は、こちらの [documentation](https://docs.anthropic.com/claude/docs/prompt-chaining) ( Claude LLMを活用しています)にもあります。私たちの例は彼らの例からヒントを得てアレンジしたものです。

@ -1,3 +1,71 @@
# Reflexion
This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right.
リフレクションは、言語的フィードバックを通じて言語ベースのエージェントを強化するためのフレームワークです。[Shinn et al. (2023)](https://arxiv.org/pdf/2303.11366.pdf)によると、「リフレクションは、エージェントの記憶エンコーディングとLLMパラメータの選択をパラメータ化することにより、“言葉による”強化を行う新しいパラダイムです。」
概念的には、リフレクションは環境からのフィードバック自由形式の言語またはスカラーを言語的フィードバックに変換し、これを自己反省とも呼ばれるものとして次のエピソードでLLMエージェントのコンテキストとして提供します。これにより、エージェントは過去の間違いから迅速かつ効果的に学び、多くの高度なタスクでのパフォーマンスが向上します。
!["Reflexion Framework"](../../img/research/reflexion.png)
図に示されているように、リフレクションは三つの異なるモデルで構成されています:
- **アクター**: 状態観測に基づいてテキストと行動を生成します。アクターは環境で行動を取り、観測を受け取り、それによって軌跡が生成されます。アクターモデルとしては[Chain-of-Thought (CoT)](https://www.promptingguide.ai/techniques/cot)と [ReAct](https://www.promptingguide.ai/techniques/react) が使用されます。また、追加のコンテキストをエージェントに提供するために記憶コンポーネントも加えられています。
- **評価者**: アクターが生成した出力を採点します。具体的には、生成された軌跡短期記憶とも表されるを入力として受け取り、報酬スコアを出力します。タスクに応じて異なる報酬関数が使用されます意思決定タスクにはLLMやルールベースのヒューリスティックが使用されます
- **自己反省**: 自己改善を支援するための言語的強化の手がかりを生成します。この役割はLLMによって達成され、将来の試行に対する貴重なフィードバックを提供します。具体的かつ関連性のあるフィードバックを生成するために、自己反省モデルは報酬シグナル、現在の軌跡、および持続的な記憶を活用します。これらの経験長期記憶に保存されたものは、エージェントが意思決定を迅速に改善するために活用されます。
要約すると、リフレクションプロセスの主要なステップは、a) タスクを定義する、b) 軌跡を生成する、c) 評価する、d) 反省を行う、e) 次の軌跡を生成する、です。下の図は、リフレクションエージェントが意思決定、プログラミング、推論など様々なタスクを解決するために行動を反復的に最適化する方法の例を示しています。リフレクションは自己評価、自己反省、記憶コンポーネントを導入することでReActフレームワークを拡張します。
!["Reflexion Examples"](../../img/research/reflexion-examples.png)
## Results
実験結果によると、リフレクションエージェントは、意思決定タスクであるAlfWorld、推論問題のHotPotQA、HumanEvalでのPythonプログラミングタスクにおいて、パフォーマンスを大幅に向上させています。
連続的な意思決定タスクAlfWorldで評価されたとき、ReAct + リフレクションは、HeuristicやGPTを用いた二値分類の自己評価技術を使用して、130/134のタスクを完了し、ReActを大幅に上回りました。
!["Reflexion ALFWorld Results"](../../img/research/reflexion-alfworld.png)
リフレクションは、いくつかの学習ステップにわたり、すべてのベースラインアプローチを大きく上回ります。推論のみの場合や、最新の軌跡から成るエピソード記憶を追加した場合、それぞれ、リフレクション + CoTはCoTのみやCoTとエピソード記憶を併用した場合を上回ります。
!["Reflexion ALFWorld Results"](../../img/research/reflexion-hotpotqa.png)
以下の表に要約されているように、リフレクションは、MBPP、HumanEval、Leetcode HardでのPythonおよびRustのコード記述において、以前の最先端アプローチを一般的に上回ります。
!["Reflexion ALFWorld Results"](../../img/research/reflexion-programming.png)
## When to Use Reflexion?
リフレクションは以下の場合に最適です:
1. **エージェントが試行錯誤から学習する必要がある場合**:リフレクションは、過去の間違いを反省し、その知識を将来の決定に取り入れることで、エージェントのパフォーマンスを向上させるよう設計されています。これは、意思決定、推論、プログラミングなど、試行錯誤を通じて学習する必要があるタスクに適しています。
2. **従来の強化学習方法が非現実的な場合**従来の強化学習RL方法は、多くの訓練データや高価なモデルのファインチューニングを必要とすることが多いです。リフレクションは、基盤となる言語モデルのファインチューニングを必要としない軽量な代替手段を提供し、データと計算リソースの面で効率的です。
3. **繊細なフィードバックが必要な場合**リフレクションは言語的フィードバックを利用し、従来のRLで使用されるスカラー報酬よりも繊細で具体的です。これにより、エージェントは自身の間違いをよりよく理解し、次の試行でより的確な改善を行うことができます。
4. **解釈可能性と明示的な記憶が重要な場合**リフレクションは従来のRL方法に比べて、より解釈可能で明示的な形式のエピソード記憶を提供します。エージェントの自己反省はその記憶に保存され、学習プロセスの分析と理解が容易になります。
リフレクションが効果的なタスク:
- **連続的な意思決定**リフレクションエージェントは、さまざまな環境をナビゲートし、複数ステップの目標を達成するAlfWorldタスクでパフォーマンスを向上します。
- **推論**リフレクションは、複数の文書にまたがる推論を必要とする質問回答データセットであるHotPotQAで、エージェントのパフォーマンスを向上させました。
- **プログラミング**リフレクションエージェントは、HumanEvalやMBPPなどのベンチマークでより優れたコードを書き、場合によっては最先端の結果を達成しています。
リフレクションのいくつかの制限:
- **自己評価能力に依存**:リフレクションは、エージェントが自身のパフォーマンスを正確に評価し、有用な自己反省を生成する能力に依存しています。これは、特に複雑なタスクでは困難かもしれませんが、モデルの能力が向上するにつれてリフレクションも時間とともに改善されると期待されます。
- **長期記憶の制約**:リフレクシ
ョンは最大容量のスライディングウィンドウを使用しますが、より複雑なタスクでは、ベクター埋め込みやSQLデータベースなどの高度な構造の使用が有利かもしれません。
- **コード生成の制限**:テスト駆動開発では正確な入出力マッピング(例えば、非決定論的な生成関数やハードウェアに影響を受ける関数の出力など)を指定することに制限があります。
---
*Figures source: [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/pdf/2303.11366.pdf)*
## References
- [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/pdf/2303.11366.pdf)
- [Can LLMs Critique and Iterate on Their Own Outputs?](https://evjang.com/2023/03/26/self-reflection.html)

@ -1,3 +1,45 @@
# Tree of Thoughts (ToT)
This page needs a translation! Feel free to contribute a translation by clicking the `Edit this page` button on the right side.
import { Callout, FileTree } from 'nextra-theme-docs'
import {Screenshot} from 'components/screenshot'
import TOT from '../../img/TOT.png'
import TOT2 from '../../img/TOT2.png'
import TOT3 from '../../img/TOT3.png'
Pour des tâches complexes qui nécessitent une exploration ou une anticipation stratégique, les techniques de prompt traditionnelles ou simples sont insuffisantes. [Yao et al. (2023)](https://arxiv.org/abs/2305.10601) et [Long (2023)](https://arxiv.org/abs/2305.08291) ont récemment proposé "Tree of Thoughts" (ToT), un framework qui généralise le prompt "chain-of-thought" et encourage l'exploration à travers des pensées qui servent d'étapes intermédiaires pour la résolution de problèmes généraux avec des modèles de langage.
ToT maintient un arbre de pensées, où les pensées représentent des séquences de langage cohérentes qui servent d'étapes intermédiaires vers la résolution d'un problème. Cette approche permet à un LLM d'auto-évaluer les progrès à travers les pensées intermédiaires réalisées vers la résolution d'un problème grâce à un processus de raisonnement délibéré. La capacité du LLM à générer et évaluer les pensées est ensuite combinée avec des algorithmes de recherche (par exemple, recherche en largeur et recherche en profondeur) pour permettre une exploration systématique des pensées avec anticipation et retour en arrière.
Le framework ToT est illustré ci-dessous :
<Screenshot src={TOT} alt="TOT" />
Source de l'image : [Yao et al. (2023)](https://arxiv.org/abs/2305.10601)
Lors de l'utilisation de ToT, différentes tâches nécessitent de définir le nombre de candidats et le nombre de pensées/étapes. Par exemple, comme démontré dans l'article, le Jeu des 24 est utilisé comme une tâche de raisonnement mathématique qui nécessite de décomposer les pensées en 3 étapes, chacune impliquant une équation intermédiaire. À chaque étape, les 5 meilleurs candidats sont conservés.
Pour effectuer une recherche en largeur dans ToT pour la tâche du Jeu des 24, le LLM est invité à évaluer chaque candidat de pensée comme "sûr/peut-être/impossible" par rapport à l'objectif d'atteindre 24. Comme l'indiquent les auteurs, "l'objectif est de promouvoir des solutions partielles correctes qui peuvent être jugées dans quelques essais, d'éliminer les solutions partielles impossibles en se basant sur le bon sens 'trop grand/petit', et de garder les 'peut-être'". Les valeurs sont échantillonnées 3 fois pour chaque pensée. Le processus est illustré ci-dessous :
<Screenshot src={TOT2} alt="TOT2" />
Source de l'image : [Yao et al. (2023)](https://arxiv.org/abs/2305.10601)
D'après les résultats rapportés dans la figure ci-dessous, ToT surpasse considérablement les autres méthodes de prompt :
<Screenshot src={TOT3} alt="TOT3" />
Source de l'image : [Yao et al. (2023)](https://arxiv.org/abs/2305.10601)
Code disponible [ici](https://github.com/princeton-nlp/tree-of-thought-llm) et [ici](https://github.com/jieyilong/tree-of-thought-puzzle-solver)
À un niveau plus élevé, les idées principales de [Yao et al. (2023)](https://arxiv.org/abs/2305.10601) et [Long (2023)](https://arxiv.org/abs/2305.08291) sont similaires. Les deux améliorent la capacité des LLM à résoudre des problèmes complexes par la recherche d'arbres via une conversation en plusieurs tours. Une des principales différences est que [Yao et al. (2023)](https://arxiv.org/abs/2305.10601) utilise la recherche via parcours en largeur/profondeur/par faisceaux, tandis que la stratégie de recherche d'arbres (c'est-à-dire quand revenir en arrière et revenir en arrière de combien de niveaux, etc.) proposée dans [Long (2023)](https://arxiv.org/abs/2305.08291) est pilotée par un "Contrôleur ToT" formé par apprentissage par renforcement (RL). La recherche via parcours en largeur/profondeur/par faisceaux sont des stratégies génériques de recherche de solutions sans adaptation à des problèmes spécifiques. En comparaison, un Contrôleur ToT formé par RL pourrait apprendre à partir d'un nouvel ensemble de données ou par auto-apprentissage (AlphaGo vs recherche par force brute), et donc le système ToT basé sur RL peut continuer à évoluer et apprendre de nouvelles connaissances même avec un LLM fixe.
[Hulbert (2023)](https://github.com/dave1010/tree-of-thought-prompting) a proposé le "Tree-of-Thought Prompting", qui applique le concept principal des frameworks ToT comme une technique de prompt simple, amenant le LLM à évaluer les pensées intermédiaires dans un seul prompt. Un exemple de prompt ToT est :
```
Imaginez que trois experts différents répondent à cette question.
Tous les experts écriront 1 étape de leur réflexion,
puis la partageront avec le groupe.
Ensuite, tous les experts passeront à l'étape suivante, etc.
Si un expert se rend compte qu'il a tort à un moment donné, alors il part.
La question est...
```
[Sun (2023)](https://github.com/holarissun/PanelGPT) a évalué le "Tree-of-Thought Prompting" avec des expériences à grande échelle, et introduit PanelGPT --- une idée du prompting avec des tables rondes entre LLM.

@ -29,7 +29,7 @@ ToT 完成算 24 的游戏任务要执行广度优先搜索BFS每步思
[这里](https://github.com/princeton-nlp/tree-of-thought-llm)还有[这里](https://github.com/jieyilong/tree-of-thought-puzzle-solver)可以找到代码例子。
从大方向上来看,[Yao et el. (2023)](https://arxiv.org/abs/2305.10601) 和 [Long (2023)](https://arxiv.org/abs/2305.08291) 的核心思路是类似的。两种方法都是以多轮对话搜索树的形式来增强 LLM 解决复杂问题的能力。主要区别在于 [Yao et el. (2023)](https://arxiv.org/abs/2305.10601) 采用了深度优先DFS/广度优先BFS/集束beam搜索而 [Long (2023)](https://arxiv.org/abs/2305.08291) 则提出由强化学习Reinforcement Learning训练出的 “ToT 控制器”ToT Controller来驱动树的搜索策略(宝库什么时候回退和搜索到哪一级回退等等)。深度优先/广度优先/集束搜索是通用搜索策略,并不针对具体问题。相比之下,由强化学习训练出的 ToT 控制器有可能从新的数据集学习或是在自对弈AlphaGo vs. 蛮力搜索)的过程中学习。因此,即使采用的是冻结的 LLM基于强化学习构建的 ToT 系统仍然可以不断进化,学习新的知识。
从大方向上来看,[Yao et el. (2023)](https://arxiv.org/abs/2305.10601) 和 [Long (2023)](https://arxiv.org/abs/2305.08291) 的核心思路是类似的。两种方法都是以多轮对话搜索树的形式来增强 LLM 解决复杂问题的能力。主要区别在于 [Yao et el. (2023)](https://arxiv.org/abs/2305.10601) 采用了深度优先DFS/广度优先BFS/集束beam搜索而 [Long (2023)](https://arxiv.org/abs/2305.08291) 则提出由强化学习Reinforcement Learning训练出的 “ToT 控制器”ToT Controller来驱动树的搜索策略(包括什么时候回退和搜索到哪一级回退等等)。深度优先/广度优先/集束搜索是通用搜索策略,并不针对具体问题。相比之下,由强化学习训练出的 ToT 控制器有可能从新的数据集学习或是在自对弈AlphaGo vs. 蛮力搜索)的过程中学习。因此,即使采用的是冻结的 LLM基于强化学习构建的 ToT 系统仍然可以不断进化,学习新的知识。
[Hulbert (2023)](https://github.com/dave1010/tree-of-thought-prompting) 提出了思维树ToT提示法将 ToT 框架的主要概念概括成了一段简短的提示词,指导 LLM 在一次提示中对中间思维做出评估。ToT 提示词的例子如下:

@ -1,7 +1,19 @@
# Zero-Shot Prompting
Große LLMs (Language-Modelle) wie beispielsweise GPT-3 sind heute darauf abgestimmt, Anweisungen zu befolgen, und wurden mit großen Datenmengen trainiert. Daher sind sie in der Lage, einige Aufgaben "Zero-Shot" auszuführen.
Wir haben einige Zero-Shot-Beispiele im vorherigen Abschnitt ausprobiert. Hier ist eines der Beispiele, die wir verwendet haben:
import {Bleed} from 'nextra-theme-docs'
<Bleed>
<iframe width="100%"
height="415px"
src="https://www.youtube.com/embed/ZTaHqdkxUMs?si=EDLjgAxuFxFcrSM3" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
/>
</Bleed>
Große LLMs (Language-Modelle) wie beispielsweise GPT-3.5 Turbo, GPT-4 und Claude 3 sind heute darauf abgestimmt, Anweisungen zu befolgen, und wurden mit großen Datenmengen trainiert. Groß angelegtes Training ermöglicht es diesen Modellen, einige Aufgaben auf
"Zero-Shot"-Weise auszuführen. Zero-Shot-Prompting bedeutet, dass der Prompt, der verwendet wird, um mit dem Modell zu interagieren, keine Beispiele oder Demonstrationen enthält. Der Zero-Shot-Prompt instruiert das Modell direkt, eine Aufgabe ohne zusätzliche Beispiele auszuführen, um es zu lenken.
Wir haben einige Zero-Shot-Beispiele im vorherigen Abschnitt ausprobiert. Hier ist eines der Beispiele, die wir verwendet haben (Text-Klassifizierung):
*Prompt:*
```

Loading…
Cancel
Save