推理的幻想
LLMS中推理的幻想源於它們產生連貫和上下文相關的文本的能力。當提出提示或問題時,LLM可以產生似乎是邏輯思想結果的響應。但是,這主要是由於它們的概率性質以及它們已經接受了大量文本數據的培訓。 LLM從本質上學習此數據中的模式和關聯,使他們可以預測給定上下文中最有可能的下一個單詞或短語。
沃茲尼亞克關於智力和推理的觀點
史蒂夫·沃茲尼亞克(Steve Wozniak)在《黑客想要 - 2009年》中提出的一個有趣的觀點 - 批評我們經常定義情報的方式:
因此,我們不像我們所教的那樣多教導思考,您知道,智力並沒有定義為可以思考和思考和考慮所有可能性並提出最好的解決方案的大腦的人。哦,不,不,智慧在其他所有人中說的是完全相同的事情。像一個宗教一樣,我們都很聰明,因為我說的是聰明的。並提出您自己的解決方案。
這種洞察力突出了LLM的一個關鍵問題:我們可以教導模型以多種和創造性的方式真正“思考”,還是他們只是模仿他們接受過培訓的社會規範和模式?
理解推理
推理的核心涉及根據給定信息或證據得出結論或推斷的能力。它需要邏輯,批判性思維和解決問題的技能的應用。
某些類型的推理:
儘管LLM可以通過預學的模式模仿其中的某些形式,但真正的推理需要一個故意的認知框架。
故意認知框架是一種結構化的心理方法,涉及:
從本質上講,這是一種超越自動響應或預學模式的思維方式。它需要積極參與信息,做出明智判斷的能力以及創造性地解決問題的能力。
想像一個解決犯罪的偵探。
故意的認知框架將涉及:
相反,簡單的模式匹配系統可能:
通過增強學習在LLM中實施推理
注意:Openai O1功能的核心是其大規模增強學習算法。這種方法通過鼓勵其產生導致糾正解決方案的思想鏈來教導該模型如何有效地思考。
Python示例:用GPT3.5 + COT解決的草莓問題“推理”
from openai import AzureOpenAI
# Define constants
AZURE_OPENAI_ENDPOINT = ""
AZURE_OPENAI_API_KEY = ""
az_client = AzureOpenAI ( azure_endpoint = AZURE_OPENAI_ENDPOINT , api_version = "2023-07-01-preview" , api_key = AZURE_OPENAI_API_KEY )
ai_response = az_client . chat . completions . create (
model = "gpt-35-turbo" ,
messages = [
{ "role" : "user" , "content" : "Count the occurrences of the letter 'r' in the word 'strawberry'." },
]
)
print ( "gpt-35-turbo" )
print ( ai_response . choices [ 0 ]. message . content )
print ( "------------" )
ai_response = az_client . chat . completions . create (
model = "gpt-35-turbo" ,
messages = [
{ "role" : "user" , "content" : "Count the occurrences of the letter 'r' in the word 'strawberry'." },
{ "role" : "system" , "content" : """
<chain of thought>
EXAMPLE: Count the occurrences of the letter 'p' in the word 'apple'.
To determine the number of occurrences of the letter 'p' in the word 'apple', we scan through the word letter by letter:
'a' (0), 'p' (1), 'p' (2), 'l' (0), 'e' (0).
Therefore, the letter 'p' appears 2 times.
</chain of thought>
IMPORTANT! USE ABOVE CHAIN OF THOUGHT TO GENERATE YOUR RESPONSE!
""" }
]
)
print ( "gpt-35-turbo with CoT" )
print ( ai_response . choices [ 0 ]. message . content )
print ( "------------" )輸出
gpt-35-turbo
There are 2 occurrences of the letter 'r' in the word 'strawberry'.
------------
gpt-35-turbo with CoT
To determine the number of occurrences of the letter 'r' in the word 'strawberry', we scan through the word letter by letter:
- 's' (0)
- 't' (0)
- 'r' (1)
- 'a' (0)
- 'w' (0)
- 'b' (0)
- 'e' (0)
- 'r' (2)
- 'r' (3)
- 'y' (0)
Therefore, the letter 'r' appears 3 times in the word 'strawberry'.
------------
挑戰和未來的方向
資源
LLM為什麼不能計算?
學習到底意味著什麼?