跳到主要內容

目前AI(LLM)的原理概論:LLM 沒有真正理解,而是統計式理解!

緣起:

我在公司負責導入AI技術與治理規範,做了一些研究。
邀請大家一起閱讀與討論,以了解目前AI目前真實的能力與限制!
才不會被賣AI的人搞得很焦慮!

我試過了Microsoft Copilot ChatClaudeGeminiChatGPT

我最喜歡Microsoft Copilot 的答案,更可貴的它提到引發AI熱潮,Google 無私公開的論文:Attention Is All You Need

我的指令(Prompt)

下面句子的 it 代表什麼?
你是怎麼知道的,會不會有出錯的時候?
The animal didn't cross the street because it was too tired.
請說明清楚技術,如過出現專有名詞請說明清楚:
包含但不僅限於Large Language modleNatural Language Processing

Microsoft Copilot chat

這個問題其實碰到了 大型語言模型(Large Language Model, LLM)最核心的能力之一:指代消解(Coreference Resolution

先說結論:

在句子 "The animal didn't cross the street because it was too tired."
大部分人類以及大部分 LLM,都會判斷:it = the animal(那隻動物)

也就是:那隻動物沒有穿越馬路,因為牠太累了。

但重點是:
AI 並不是「真的知道」it animal,而是根據語言模式、機率、語意關聯去推斷,因此有可能出錯。

一、人類為什麼知道 it animal

句子:The animal didn't cross the street because it was too tired.

拆解:

主詞:The animal
動作:didn't cross the street
原因:because it was too tired

如果翻譯成中文: 那隻動物沒有穿越馬路,因為牠太累了。

人類會自然推論:太累無法移動,無法移動沒有過馬路
所以:it = animal

這是一種:語意推理(Semantic Reasoning而不是單純文法分析。

二、如果是 NLP 時代,是怎麼做的?

ChatGPT 出現以前,Natural Language ProcessingNLP,自然語言處理)通常會用:

Coreference Resolution(指代消解、代詞解析)

目的: John bought a car.He loves it.

找出:He => John it => car

傳統 NLP 的作法會看很多特徵:

1. 距離

靠近代詞的名詞比較可能,例如: Tom talked to Jack.He smiled.
可能:He => Jack  因為比較近。

2. 文法角色

主詞優先。例如: Tom met Jack. He was happy.
比較可能:He => Tom 因為 Tom 是主詞。

3. 性別

例如:  Lisa met Tom.She smiled.
She => Lisa

4. 單複數

The dogs ran away.They were frightened.
They => dogs

但這些方法都有極限。

三、真正困難的地方:Winograd Schema

AI 研究界有個非常有名的測試:Winograd Schema Challenge

Terry Winograd 提出。

例如:The trophy didn't fit in the suitcase because it was too big.

it 是誰?可能有兩個:trophy、suitcase
但是:獎盃太大放不進去
所以: it = trophy

換一句:The trophy didn't fit in the suitcase because it was too small.
突然變成: it = suitcase
因為:行李箱太小裝不下

注意:文法完全一樣。
只有:big small不同。但答案相反。

因此:傳統 NLP 經常做不好。
因為需要:Common Sense(常識推理)

四、Large Language Model 怎麼做?

例如:  GPT-5、 Copilot、Claude、  Gemini並不是用規則。
而是:Transformer

2017 Google 提出的論文:Attention Is All You Need
核心技術:Self-Attention(自注意力機制)

五、什麼是 Self-Attention

當模型讀到: The animal didn't cross the street  because it was too tired.

不會像人類逐字閱讀。而是建立一個關聯網路。

例如:

1     it

2    

3    

4    

5    

6     animal

7     street

8     cross

9     tired

模型會計算: it 與誰最有關聯?可能得到:

animal  = 0.82

street  = 0.05

cross   = 0.03

其他    = 0.10

因此:  it → animal 機率最高。

六、Copilot 真的理解了嗎?

其實這是 AI 研究的大問題。

很多學者認為:LLM 並沒有真正理解。

而是:統計式理解  (statistical understanding)

換句話說:它看過數十億句語料。知道:

1     too tired

2    

3     通常形容人或動物

4    

5     很少形容 street

所以預測:it = animal

七、它會不會出錯?

一定會。例如:The animal didn't cross the street because it was blocked.

這時候: it = ?
可能: animal、street都合理。

如果改成:  The animal didn't cross the street  because it was closed.
人類知道:  it = street
但模型不一定百分之百判對。

八、LLM 內部實際流程

Copilot 看到一句話時,大致會經過:

Step 1 Tokenization(詞元化)

把文字切成 Token例如:

1     The

2     animal

3     didn't

4     cross

5     the

6     street

7     because

8     it

9     was

10     too

11     tired

變成:

1     [The]

2     [animal]

3     [didn't]

4     [cross]

5     ...

6     [it]

7     [tired]

Step 2 Embedding(向量化)

每個 Token 變成數百或數千維數字。例如:

1     animal

2     =

3     [0.25, -0.63, ...]

這稱為:Word Embedding 詞向量。

Step 3 Attention

計算:it 應該參考誰?形成 Attention 權重。例如:

1     it → animal 0.81

2     it → street 0.07

3     it → cross  0.02

   

Step 4 多層 Transformer

不像只算一次。而是:

1     Layer 1

2     Layer 2

3     Layer 3

4     ...

5     Layer N

一層層修正。最後得到:  it = animal 機率最高。 

九、這和「理解」有什麼差別?

人類可能建立因果鏈:

1     動物

2    

3     很累

4    

5     走不動

6    

7     無法過馬路

LLM 比較像:

1     在數十億句語料中

2    

3     too tired

4    

5    

6    

7     animal

8    

9     共同出現機率極高

所以推測:  it = animal

十、如果在 Copilot Chat 中嘗試

你可以直接問:

1     The animal didn't cross the street because it was too tired.

2    

3     What does "it" refer to?

4     Explain your reasoning step by step.

再進一步問:

1     Could there be another interpretation?

2     What confidence level do you assign?

通常 Copilot 會回答:

1     it = the animal

原因:

1     being tired explains why the animal

2     didn't cross the street.

而不是:street was tired 因為語意不合理。

關鍵觀念總結

名稱

中文

在這句話中的作用

Natural Language Processing (NLP)

自然語言處理

處理人類語言的技術總稱

Coreference Resolution

指代消解

判斷 it 指向誰

Semantic Reasoning

語意推理

利用句意判斷原因與結果

Common Sense Reasoning

常識推理

知道「累了就不想走路」

Tokenization

詞元化

將句子切成 Token

Embedding

詞向量

將文字轉成數學向量

Transformer

轉換器架構

現代 LLM 的核心架構

Self-Attention

自注意力機制

找出 it 最可能關聯的詞

Large Language Model (LLM)

大型語言模型

透過龐大語料學習語言模式

Hallucination

幻覺

推論錯誤時可能發生

最重要的一句話:

CopilotChatGPTClaude 並不是利用「文法規則」判斷 it,而是在 Transformer Attention 機制下,結合大量語言統計模式與語意關聯,推論出 "it" 最可能指向 "animal"大多數情況判斷正確,但遇到語意模糊、缺乏常識或上下文不足時,仍然可能出錯。 



公部門人工智慧應用參考手冊|政府AI參考手冊及應用站 - 數位政府 - 核心業務|moda — 數位發展部 Ministry of Digital Affairs
很用心的手冊,包含了:AI 概念介紹、服務評估、服務導入、營運管理。深入淺出的論述,估計小六學生可以看懂95%以上。

留言

這個網誌中的熱門文章

Wake up - Arcade Fire /白日夢冒險王/The Secret Life of Walter Mitty —聽見007

白日夢想家 the secret life of Walter Mitty_哔哩哔哩_bilibili 白日夢冒險王,經典的歌曲Wake Up 再次深深觸動,進入人生下半場的我! 原來當初看時,漏了好多細節! 彩蛋:(注意背景的文字)  Making of a Brave man. 做一個勇敢的人。 To see the world.  去探索世界。 Things Dangerous to come to.  面對危險、不確定的事物。 Passport to see behind walls. 通往表面下內心的護照。 To draw close,To find each other and to feel.  拉近距離,找到彼此,感受。 That is the purpose of life! 這就是人生的目的! Wake Up/Arcade Fire  歌詞 Somethin' filled up My heart with nothin' Someone told me not to cry Now that I'm older My heart's colder And I can see that it's a lie Children, wake up Hold your mistake up Before they turn the summer into dust If the children don't grow up Our bodies get bigger but our hearts get torn up We're just a million little god's causin' rain storms Turnin' every good thing to rust I guess we'll just have to adjust With my lightnin' bolts a-glowin I can see where I am goin' to be When the reaper he reaches and touches my hand With my lightnin' bolts a-glowin...

《手冊》/愛比克泰德—《Enchiridion》/Epictetus 翻譯與解析

  這是一份關於愛比克泰德(Epictetus)《手冊》(Enchiridion)對照翻譯與解析。這部作品是斯多葛學派(Stoicism)的經典,核心在於區分「我們能控制的」與「我們不能控制的」。 斯多葛學派(Stoicism)的核心要素: 以寧靜的心靈接納無法改變的一切, 以勇氣面對可以改變的一切, 以智慧分辨兩者的差異。 —《別因渴望你沒有的,糟蹋了你已經擁有的》 備註: 英文出處 https://classics.mit.edu/Epictetus/epicench.html Gemini對話過程: https://gemini.google.com/share/d001e7c2eebb 📘 1-30完整原文與中譯 (Full Text & Translation) 原文 (The Enchiridion - Elizabeth Carter Translation) 中文翻譯 (Chinese Translation) The Enchiridion By Epictetus. Written 135 A.C.E. Translated by Elizabeth Carter 《手冊》 愛比克泰德 著。寫於西元 135 年。伊莉莎白·卡特 英譯。 1. Some things are in our control and others not. Things in our control are opinion, pursuit, desire, aversion, and, in a word, whatever are our own actions. Things not in our control are body, property, reputation, command, and, in one word, whatever are not our own actions. 1. 有些事情是我們能控制的,有些則不然。我們能控制的是:見解、追求、慾望、厭惡,總之,凡是我們自己的行為。我們不能控制的是:身體、財產、名聲、官職,總之,凡不是我們自己的行為。 The things in our control are by nature free, unrestrained, unhindered; but those n...

正向心理學的新時代/The new era of positive psychology|Martin Seligman —Ted027

正向心理學的新時代/The new era of positive psychology 重點摘錄: 我相信有三個不同種類的快樂 我說它們不同,是因為它們各有不同的調控方法 而且有可能是有一種而沒有另一種 這樣三種不同的快樂生活  第一種快樂生活是愉快的生活  這是一種你擁有最多的正面情緒的生活 而且有技巧去擴大它  第二種快樂是種投入的生活  投入你的工作、你的家庭、你的情愛、你的休閑的生活,時間為你停止 那是以前亞里士多德討論的  第三種的快樂是有意義的生活 And I believe there are three different -- I call them "different" because different interventions build them, it's possible to have one rather than the other -- three different happy lives.  The first happy life is the pleasant life.  This is a life in which you have as much positive emotion as you possibly can, and the skills to amplify it.  The second is a life of engagement : a life in your work, your parenting, your love, your leisure; time stops for you. That's what Aristotle was talking about.  And third, the meaningful life.   簡介: 塞利格曼談心理學--一門學科,一對一的心理咨詢。它已經不僅是對付心理疾病,現代心理學能幫助我們達成什麼? Martin Seligman talks about psychology -- as a field of study and as it works one-on-one with each patient and each pra...

姿勢決定你是誰!/Your body language shapes who you are|Amy Cuddy—Ted026

姿勢決定你是誰!/Your body language shapes who you are 簡介: 身體語言影響別人對我們的觀感,亦改變我們如何看自己。社會心理學家 Amy Cuddy 說明「高權勢姿勢」。即使在不覺得充滿信心時,站起來裝出一副很有自信的樣子,也可以改變我們腦內睪固酮和腎上腺皮質醇的濃度,進而影響成功的機會。 (NOTE: Some of the findings presented in this talk have been referenced in an ongoing debate among social scientists about robustness and reproducibility. Read "Corrections & Updates" below for more details as well as Amy Cuddy's response.) Body language affects how others see us, but it may also change how we see ourselves. Social psychologist Amy Cuddy argues that "power posing" -- standing in a posture of confidence, even when we don't feel confident -- can boost feelings of confidence, and might have an impact on our chances for success. 中英逐字稿: 首先我要提供你們一個免費的 不涉科技的生活小撇步 你只要 改變你的姿勢二分鐘 在我說明前,我要先請大家 先檢視一下你的姿態 你們之中有多少人縮著身體? 或許你現在駝著背 交叉著雙腳,或者腳踝互勾著 有時我們會這樣抱著手臂 有時我們張開雙臂(笑聲) 我看到囉(笑聲) 現在請大家專心在自己身上 我們等一下在回到這件事上 希望你們可以稍微改變一下 這會讓你的生活變得很不一樣 So I want to start by offering you a free no-tech life hack, a...

No Fear In My Heart |朴樹—聽見016

朴树《No Fear In My Heart》经典现场!愿我们的内心都没有恐惧!@bilibili No Fear In My Heart 詞:朴樹/曲:朴樹 你在躲避什麼 你在挽留什麼 你想取悅誰呢 你曾經下跪 這冷漠的世界 何曾將你善待 所以你厭惡危險 墜入厄運深淵 輸掉一切 你兩手緊緊抓著 如同身處懸崖 你小心翼翼地 以為你擁有著 貌似人生圓滿 能不能 徹底地放開你的手 敢不敢 這麼義無反顧墜落 墜入黑暗中 墜入泥土中 的海闊天空 就讓我 來次透徹心扉的痛 都拿走 讓我再次兩手空空 只有奄奄一息過 那個真正的我 他才能夠誕生 Just let time go on Your kneeling now stand With no fear in my heart God comes into my mind 你也曾經追問 然後沉默 漸漸習慣謊言 並以此為榮 因為沒有草原 就忘了你是馬 你卑微的人生 從不曾犯錯的 無聊的人生 能不能 徹底地放開你的手 敢不敢 這麼義無反顧墜落 墜入黑暗中 墜入泥土中 的海闊天空 就讓我 來次透徹心扉的痛 都拿走 讓我再次兩手空空 只有奄奄一息過 那個真正的我 他才能夠誕生 那才是我 那才是我 那個發光的 那個會飛的 Yo buddy 那個頂天立地的 那才是我 當我一微笑 所有的苦難 都灰飛煙滅 能不能 徹底地放開你的手 敢不敢 這麼義無反顧墜落 墜入黑暗中 墜入泥土中 的海闊天空 就讓我 來次透徹心扉的痛 都拿走 讓我再次兩手空空 只有奄奄一息過 那個真正的我 他才能夠誕生