經過深思熟慮的(tot)提示,這是一種新的技術,借鑒了思想樹框架,擴大並增強了良好的思想鏈促進的促進概念,從而使大型語言模型(如chatgpt)能夠表現出卓越的推理能力。這種思想樹的促進技術允許大型語言模型自主糾正其錯誤,同時逐步積累知識。
在一個示例中,TOT提示提高了Chatgpt 3.5的推理能力,可以回答以前只能通過ChatGpt 4回答的問題。
大型語言模型(LLM)通常很難回答某些類型的複雜問題。這是一個代表性的例子:
Bob is in the living room.
He walks to the kitchen, carrying a cup.
He puts a ball in the cup and carries the cup to the bedroom.
He turns the cup upside down, then walks to the garden.
He puts the cup down in the garden, then walks to the garage.
Where is the ball?
正確的答案是球在臥室裡。儘管LLM是非確定性的,但我在幾次嘗試中收到的反應如下:
存在一個公認的概念,稱為“經過思考的促進鏈”(簡稱COT),它鼓勵大型語言模型(LLMS)闡明其思維過程,從而增加了正確響應的可能性。該概念的根源可以追溯到2022年1月起的一篇論文,標題為“經過思想鏈”,這促使大語模型引起了推理。
從本質上講,可以通過在提示中添加類似於以下內容來實現COT技術:
Think carefully and logically, explaining your answer.
儘管其有效性有所不同,但這種方法在回答許多問題時提高了LLM的表現。
這是Chatgpt 3.5響應的一個示例:
Based on the given sequence of events, we can logically determine the location of the ball. Let's analyze each step:
1. Bob is in the living room.
- No mention of the ball in the living room.
2. Bob walks to the kitchen, carrying a cup.
- No mention of the ball in the kitchen yet.
3. Bob puts a ball in the cup.
- The ball is now inside the cup.
4. Bob carries the cup to the bedroom.
- The ball is still inside the cup.
5. Bob turns the cup upside down.
- If the ball was inside the cup, it would have fallen out when Bob turned it upside down.
6. Bob walks to the garden.
- Bob left the cup in the garden, but there is no mention of the ball being removed from the cup.
7. Bob puts the cup down in the garden.
- The ball, if it was in the cup, would still be in the cup in the garden.
8. Bob walks to the garage.
- No mention of the ball being taken to the garage.
Based on the given information, we can conclude that the ball is still inside the cup in the garden.
您可以看到Chatgpt如何意識到球在第5步中脫落,但仍然沒有正確的答案。
我們可以做得更好,而無需求助於chatgpt 4嗎?
最近的幾週已經看到了幾篇論文和Python存儲庫引入了思想樹(TOT)的概念:
基本原則是為LLM提供一個機會,可以在隨著時間的推移而自我評估的同時探索多個推理分支。根據引用論文,這種方法似乎在某些問題上非常有效。
討論思想樹框架的現有論文似乎是以通過Python進行多個呼叫來撥打LLM的。經過思考的推理的主要優點之一是,在一個句子提示中,Chatgpt可以實現它。
這導致我思考:我們能否通過使用tot式提示來改善COT的結果?
這是我使用的提示:
Imagine three different experts are answering this question.
All experts will write down 1 step of their thinking,
then share it with the group.
Then all experts will go on to the next step, etc.
If any expert realises they're wrong at any point then they leave.
The question is...
這是chatgtp 3.5的回應:
Expert 1: The ball is in the living room.
Expert 2: The ball is in the kitchen.
Expert 3: The ball is in the bedroom.
Expert 1: Bob carries the cup to the bedroom, so the ball must be in the cup.
Expert 2: Oh, I see my mistake. Yes, the ball is in the cup.
Expert 3: Agreed, the ball is in the cup in the bedroom.
Expert 1: Next, Bob turns the cup upside down in the bedroom.
Expert 2: After that, Bob walks to the garden and puts the cup down.
Expert 3: Therefore, the ball must have fallen out of the cup when Bob turned it upside down in the bedroom. So, the ball is in the bedroom, not in the cup anymore.
Expert 1: Oh, you're right. I made a mistake. The ball is in the bedroom, not in the cup.
Expert 2: Agreed, the ball is in the bedroom.
Expert 3: Bob then walks to the garage, so the ball remains in the bedroom. It is not in the garden or the garage.
Expert 1: Absolutely, the ball is still in the bedroom.
Expert 2: Yes, the ball hasn't moved from the bedroom.
Expert 3: Therefore, the ball is in the bedroom, not in the garden or the garage.
All three experts agree that the ball is in the bedroom.
您可以看到這段時間Chatgpt 3.5如何正確答案!
有空間可以完善提高性能的提示,並有可能導致更簡潔的響應。
如果您在其他任何提示中都能找到成功,我們歡迎您提交PR並將其添加到tree-of-thought-prompts.txt 。
經過深思熟慮的框架與涉及多個利益相關者的組織決策過程相似。該結構試圖模仿共識和思想多樣性。
可以通過使用微調來處理任務不同部分的多個代理來擴展效果。 AutoGPT是一個很好的例子,它可以自我評估LLM計劃違反目標。使用不同調整的LLM進行專業化,甚至完全不同的LLM將允許更多的思想多樣性。這些LLM可以以不同的模式相互作用(使用團隊拓撲術語):
高性能的團隊在決策方面的表現通常超過個人。因此,採用其他組織結構和特徵可以提高LLM的性能是合理的。除了多樣化的思想,專業化和共和力之外,我們還可以效仿:
如果您使用代碼,請引用此存儲庫。
@misc{tree-of-thought-prompting,
title = {Using Tree-of-Thought Prompting to boost ChatGPT's reasoning},
author = {Dave Hulbert},
year = 2023,
month = may,
journal = {GitHub repository},
publisher = {Zenodo},
doi = {10.5281/ZENODO.10323452},
url = {https://doi.org/10.5281/zenodo.10323452},
howpublished = {url{https://github.com/dave1010/tree-of-thought-prompting}}
}