跳到主要內容

目前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%以上。

留言

這個網誌中的熱門文章

《手冊》/愛比克泰德—《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...

《Anthem》/《頌歌》|Leonard Norman Cohen—聽見033

歌曲翻譯與賞析:Leonard Cohen《Anthem》(Gemini) 這是一首充滿哲思與神性的經典作品。Leonard Cohen 在這首歌中探討了人性的不完美、歷史的循環以及在破碎中尋找希望的可能性。 歌詞翻譯 (Lyrics Translation) 原文 (English) 中文翻譯 (Chinese) Ring the bells that still can ring 敲響那些還能發聲的鐘 Forget your perfect offering 忘掉你那所謂完美的奉獻 There is a crack, a crack in everything 萬物皆有裂痕 That's how the light gets in 那是光照進來的地方 The birds they sang at the break of day 鳥兒在黎明時分歌唱 "Start again", I seem to hear them say 「重新開始吧」,我似乎聽見牠們這麼說 Don't dwell on what has passed away 不要糾結於那些已經逝去的 Or what is yet to be 或是那些尚未到來的 Ah, the wars, they will be fought again 啊,戰爭,終將再次開打 The holy dove, she will be caught again 神聖的鴿子,會再次被捕獲 Bought and sold and bought again 被買賣、被交易、再被買賣 The dove is never free 鴿子從未獲得自由                     Ring the bells that still can ring 敲響那些還能發聲的鐘 Forget your perfect offering 忘掉你那所謂完美的奉獻 There is a crack, a crack in everything 萬物皆有裂痕 That's how the light gets in 那是光照進來的地方 We asked for signs, and the signs were sent 我...

觀世音菩薩發願偈/大悲咒|齊豫—聽見003

 今早請Google Nest Mini(智慧音箱) 播放音樂,它播了這首,我非常喜愛的《觀世音菩薩發願偈》,這次聽,多了一層不同的體會。刀山、火湯、地獄、餓鬼、修羅、畜生不在外,而是在我內心阿,是我的陰暗面。當我與它同在,真誠地接納這就是我的一部份,突然間,就會得到平靜、解脫、大智慧。 齐豫演唱的好听佛歌《观音菩萨发愿偈》_哔哩哔哩_bilibili 南無大悲觀世音,願我速知一切法。 南無大悲觀世音,願我早得智慧眼。 南無大悲觀世音,願我速度一切眾。 南無大悲觀世音,願我早得善方便。 南無大悲觀世音,願我速乘般若船。 南無大悲觀世音,願我早得越苦海。 南無大悲觀世音,願我速得戒定道。 南無大悲觀世音,願我早登涅槃山。 南無大悲觀世音,願我速會無為舍。 南無大悲觀世音,願我早同法性身。 我若向刀山,刀山自摧折。 我若向火湯,火湯自消滅。 我若向地獄,地獄自枯竭。 我若向餓鬼,餓鬼自飽滿。 我若向修羅,惡心自調伏。 我若向畜生,自得大智慧。 相關閱讀: 你是什麼,世界就是什麼—《你就是世界》克里希那穆提90篇經典對話錄 攝影: 英勇的膽小鬼-李彥甫Andrew

It's My Life/我的人生我作主|Bon Jovi—聽見031

It's My Life/我的人生我作主 - Bon Jovi 英文歌詞 中文翻譯 This ain't a song for the broken-hearted 這不是一首寫給心碎者的歌 No silent prayer for the faith-departed 也不是為了喪失信仰的人所做的無聲禱告 I ain't gonna be just a face in the crowd 我不想只做茫茫人海中的一張大眾臉 You're gonna hear my voice 你會聽到我的聲音 When I shout it out loud 當我大聲吶喊的時候 It's my life 我的人生我作主 It's now or never 機不可失,失不再來 I ain't gonna live forever 我不可能長生不老 I just want to live while I'm alive 我只想趁活著的時候,活得精彩 It's my life 我的人生我作主 My heart is like the open highway 我的心就像一條寬廣的公路 Like Frankie said, "I did it my way" 就像法蘭克(辛納屈)說過的:「我走我自己的路」 I just want to live while I'm alive 我只想趁活著的時候,活得精彩 It's my life 我的人生我作主 This is for the ones who stood their ground 這是為了那些堅守陣地、不曾動搖的人們 It's for Tommy and Gina who never backed down 是為了(像歌詞故事中的)湯米和吉娜,他們從不退縮 Tomorrow's getting harder, make no mistake 別搞錯了,未來只會變得更加艱難 Luck ain't enough, you've got to make your own breaks 單靠運氣是不夠的,你得自己創造機會 You better stand tall when they're call...

姿勢決定你是誰!/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...