title: "GACEI-07|一眼理解專案:全域注意力與工程場建模"
title_en: "GACEI-07 | Understanding a Project at a Glance: Global Attention and Engineering-Field Modeling"
series: "全域對抗計算與 AI 工程智能系列"
series_en: "Global Adversarial Computation and AI Engineering Intelligence Series"
series_id: "GACEI-2026"
paper_id: "GACEI-07"
version: "v0.1"
date: "2026-09-08"
language: "zh-Hant"
author: "Neo.K"
organization: "EveMissLab / 一言諾科技有限公司"
document_type: "研究論文 / AI 全域注意力 / 工程場建模 / 對抗前置理解"
status: "Canonical Draft"
canonical_source: "UTF-8 Markdown"
math_source_rule: "inline math only ... ; display math only $$...$$"
security_scope: "Authorized, isolated, recoverable software analysis and testing only"
depends_on:
- "GACEI-01 全域對抗計算總論 v0.1"
- "GACEI-02 MSSP 的對偶 v0.1"
- "GACEI-03 局部攻擊抽象論 v0.1"
- "GACEI-04 對抗記憶基底 v0.1"
- "GACEI-05 全域攻擊組合代數 v0.1"
- "GACEI-06 全域攻擊壓縮 v0.1"
- "OAC 觀察者—注意力計算論"
GACEI-07|一眼理解專案
全域注意力與工程場建模
英文題名: Understanding a Project at a Glance: Global Attention and Engineering-Field Modeling
摘要
GACEI-01 至 GACEI-06 已建立從局部 attack、對抗記憶、attack composition 到 global campaign compression 的前半部理論。然而,所有這些方法都暗中依賴一個更基礎的前提:
AI 必須先對被測專案形成足夠正確的全域模型。
如果 AI 只能逐檔案閱讀、逐函式理解、逐 issue 重建上下文,那麼即使後端具備高品質 attack memory 與壓縮演算法,整體成本仍可能被 project understanding 本身吞噬。因此本文研究:
AI 是否能在有限觀察下快速取得整體工程結構?
本文把日常語言中的「看一眼或幾眼就理解專案」操作化為:
Bobs≪∣S∣
同時要求:
Q(S,S)≥τ,
其中 Bobs 是 observation budget, ∣S∣ 表示專案完整可觀測資訊規模, S 是 AI 建立的 project model, Q 是針對當前任務的模型充分性函數。
本文不主張 AI 可以在不讀任何資料的情況下神奇地理解 repository,也不把「一眼」定義成一次 token forward pass。本文所說的「一眼」指的是:
Low-Observation-Cost Global Model Construction.
也就是:AI 不需要先逐字掃描所有 source、test、artifact、history 與 runtime trace,便能先利用高資訊量結構表面建立全域 project field,再以 active observation 只補足真正會改變決策的缺口。
本文將工程專案抽象成:
Pt=(Vt,Et,Xt,It,Ot,Γt,Ht),
其中:
- Vt:component / responsibility units;
- Et:dependency / data / control / authority relations;
- Xt:state spaces;
- It:invariants / contracts;
- Ot:observable surfaces;
- Γt:version / environment / permission / resource conditions;
- Ht:history / provenance / lifecycle。
AI 對專案的觀察不是單一通道,而是:
OP={Otree,Odep,Ocode,Otest,Oruntime,Ostate,Ohistory,Osemantic,Otopo}.
不同觀察算子分別讀:
- repository tree;
- dependency graph;
- build / package metadata;
- source slices;
- tests;
- traces;
- state schema;
- version history;
- docs / contracts;
- architecture topology。
本文承接既有 OAC 對 observation、attention、semantic understanding 與 computation 的分離,提出 project-level attention:
AP:(Z,B,G,U)→Z,
其中 Z 是多通道觀察, B 是 observation / compute budget, G 是當前工程目標, U 是 uncertainty map。AI 不是平均閱讀所有資料,而是依:
Expected Decision Change per Observation Cost
配置注意力。
本文提出「工程場模型」(Engineering Field Model, EFM):
P=(V,E,X,I,O,Γ,H,U).
其中 U 顯式保存 AI 尚不確定、未觀察、衝突、版本不明或需要 deeper probe 的區域。這避免模型把「沒看見」偷換成「不存在」。
本文進一步提出「Observation Sufficiency Gate」:
ObsEnough(P,G,B)
當 project model 已足以支持當前任務時,AI 應停止繼續廣泛閱讀,轉入 attack retrieval / synthesis;若不足,則生成 targeted observation requests,而不是重新全文掃描。
本文把 project understanding 拆成五層尺度:
L0P<L1P<L2P<L3P<L4P
其中:
- L0P:surface inventory;
- L1P:structural map;
- L2P:state / invariant map;
- L3P:causal / lifecycle model;
- L4P:adversarially actionable global model。
只有到:
L4P
AI 才能可靠回答:
哪些局部 attack 值得生成?哪些 interaction 值得組合?哪些區域已被 known attack memory 覆蓋?哪些 residual gap 值得前沿算力?
本文最後提出一個新的 benchmark 軸:Observation Efficiency。給兩個 AI 相同專案與相同攻擊任務,不只比較誰找出更多 defect,而比較:
OE=Cobservation+Creasoning+ϵQmodel⋅Qattack.
因此未來 AI 工程智能的重要能力之一,不只是「能讀多大 repository」,而是:
能否知道哪些地方根本不必先讀?
這使全域注意力從一種模糊認知形容詞,轉化成可計算、可觀測、可驗證的工程能力。
關鍵詞: Global Attention、Engineering Field Model、OAC、Project Understanding、Observation Budget、Active Observation、Multi-Scale Attention、Repository Intelligence、Architecture Reconstruction、Global Adversarial Computation、AI 工程智能
0. 研究定位
本文處理:
AI project-level observation and modeling
不處理:
- 主體性;
- 意識;
- 哲學上的真正理解;
- 未授權外部系統探測。
本文只問:
AI 是否取得足以支持工程決策、對抗測試與故障定位的 operational project model?
1. 「看一眼」到底是什麼?
1.1 不是一次 forward pass
本文不定義:
One Glance=One Model Call.
也不定義:
One Glance=One Screenshot.
1.2 操作性定義
令:
Cfull
為取得專案全部可讀資訊的成本。
令:
Cobs
為 AI 實際用於建立 global model 的觀察成本。
若:
Cobs≪Cfull,
但:
Qtask(P)≥τ,
則本文稱:
Low-Cost Global Project Understanding.
這就是「一眼理解專案」的工程版本。
2. 專案不是檔案集合
一個 repository:
R={f1,…,fn}
只是 artifact set。
真正工程專案更接近:
P=(V,E,X,I,O,Γ,H).
因此:
Read Files=Understand Project.
3. Component Field
令:
V={v1,…,vn}.
component 可以是:
- module;
- service;
- package;
- process;
- worker;
- state owner;
- TMS;
- FMS;
- validator;
- adapter。
4. Relation Field
E
不只包含 import。
還可能包含:
- data flow;
- control flow;
- state dependency;
- authority;
- lifecycle;
- event subscription;
- persistence;
- build dependency;
- runtime call。
5. State Field
X={X1,…,Xk}.
包含:
- local state;
- shared state;
- persistent state;
- transient state;
- derived state;
- external state projection。
6. Invariant Field
I={I1,…,Im}.
包含:
- structural invariants;
- semantic contracts;
- temporal constraints;
- authority constraints;
- recovery constraints;
- validation contracts。
7. Observation Field
O
描述:
AI 與 validator 到底能看見什麼?
例如:
- logs;
- traces;
- test output;
- state snapshots;
- metrics;
- manifests;
- source;
- build artifacts。
8. Condition Field
Γ
包含:
- OS;
- platform;
- version;
- config;
- permissions;
- dependencies;
- resources;
- feature flags。
9. History Field
H
包含:
- commits;
- releases;
- migrations;
- incidents;
- previous failures;
- superseded contracts;
- validation history。
10. Engineering Field Model
AI 建立:
P=(V,E,X,I,O,Γ,H,U).
其中:
U=Uncertainty Map.
11. 為什麼 Uncertainty 必須是一級構件?
如果 AI 不知道:
Eij
是否存在,
不應直接:
Eij=0.
而應:
Eij=?
因此:
Unobserved=Absent.
12. Uncertainty Types
第一版:
U={Umissing,Uconflict,Ustale,Uambiguous,Uunverified,Upermission}.
13. Project Observation Operators
定義:
OP={Otree,Odep,Ocode,Otest,Oruntime,Ostate,Ohistory,Osemantic,Otopo}.
14. Tree Observation
Otree
觀察:
- folder;
- file role;
- package boundary;
- generated artifact;
- test layout;
- build layout。
15. Dependency Observation
Odep
觀察:
- imports;
- package deps;
- call relations;
- service deps;
- event relations;
- DB relations。
16. Code Observation
Ocode
不是「全文讀完」。
可以是:
- entry points;
- interfaces;
- public contracts;
- state mutations;
- error boundaries;
- hot paths。
17. Test Observation
Otest
看:
- tests exist where;
- test names;
- acceptance matrix;
- failure fixtures;
- regression history;
- skipped / NotMeasured。
18. Runtime Observation
Oruntime
看:
- trace;
- process;
- latency;
- event order;
- resource;
- failure propagation。
19. State Observation
Ostate
看:
- schema;
- ownership;
- persistence;
- mutation;
- version;
- lifecycle。
20. History Observation
Ohistory
看:
- release;
- commit;
- migration;
- recurring bug;
- contract change。
21. Semantic Observation
Osemantic
看:
- README;
- spec;
- invariants;
- architecture docs;
- claims;
- non-goals。
22. Topological Observation
Otopo
直接看:
- graph;
- clusters;
- cycles;
- boundary crossings;
- central hubs;
- disconnected islands;
- high fan-in / fan-out。
23. 多通道觀察
因此:
Z=(Ztree,Zdep,Zcode,Ztest,Zruntime,Zstate,Zhistory,Zsemantic,Ztopo).
24. 觀察不等於理解
即使:
∣Z∣≫0,
仍不表示:
P
正確。
所以:
Observation=Model Construction.
25. Attention Operator
本文定義:
AP:(Z,B,G,U)→Z.
25.1 Goal G
例如:
- architecture review;
- attack planning;
- bug localization;
- release gate;
- migration;
- performance。
不同 goal 應產生不同注意力配置。
26. Budget B
B=(Btoken,Btime,Btool,Bcontext,Bruntime).
27. 全域注意力不是平均注意
若:
Attention(vi)=n1
對所有 component,
通常不是最有效。
28. Attention Priority
可定義:
Priority(oi)=Cost(oi)+ϵE[ΔDecision(oi)]+E[ΔModel(oi)].
29. Decision-Changing Observation
一個 observation 若不會改變:
- attack selection;
- coverage;
- authorization;
- diagnosis;
- release claim;
其邊際價值低。
30. Active Observation
AI 可以主動選下一個 observation:
ot+1=argomaxVOI(o∣Pt).
31. Value of Information
VOI(o)=E[V(D∣o)−V(D)].
其中:
D
表示後續 decision quality。
32. Observation Routing
如果 uncertainty 在:
Ustate,
AI 應優先:
Ostate
而不是全文搜尋 README。
33. Representation Routing
如果 dependency graph 已足以回答:
sibling boundary?
就不需要先讀所有 function body。
34. Multi-Scale Attention
本文定義尺度:
s∈{project,subsystem,module,function,state,event}.
35. Global-to-Local Zoom
AI 可以:
project→subsystem→module
只在 uncertainty 要求時下降尺度。
36. Local-to-Global Lift
局部 observation:
zi
若會影響全域 relation:
E
必須重新 lift 回:
P.
37. 注意力不是固定路線
不同 project:
AP
應不同。
38. Surface Inventory
第一層理解:
L0P.
AI 知道:
- 有哪些主要 artifacts;
- 哪些是 source;
- 哪些是 test;
- 哪些是 generated。
39. Structural Map
L1P.
AI 能建立:
(V,E,B).
40. State / Invariant Map
L2P.
AI 能建立:
(X,I).
41. Causal / Lifecycle Model
L3P.
AI 知道:
- startup;
- transition;
- failure;
- retry;
- recovery;
- shutdown;
- persistence。
42. Adversarially Actionable Model
L4P.
AI 可以回答:
- 哪些 attack family applicable?
- 哪些 interaction plausible?
- 哪些 validators weak?
- 哪些 residual gaps unexplored?
- 哪些 attack 不值得跑?
43. 看懂不等於能攻擊
L3P
可能已足以維護系統。
但未必足以:
Generate Global Adversarial Campaign.
44. Attack Planning Readiness
定義:
APR(P)=f(QV,QE,QX,QI,QO,QΓ,U).
45. Observation Sufficiency Gate
ObsEnough(P,G)=1
若:
APR≥τG.
46. Gate 通過後要停止廣泛閱讀
這是成本控制核心。
若:
ObsEnough=1,
則:
Stop Broad Reading.
47. 不足時只做 Targeted Observation
若:
Uvalidator
高,
只補:
Otest,Oruntime.
48. Full Read 只是一種 fallback
不是預設。
49. One-Glance Ratio
定義:
OGR=CfullCobs.
理想:
OGR≪1.
50. 但低 OGR 不代表好
如果:
Qmodel
很差,
只是少看。
51. Effective Glance Efficiency
EGE=OGR+ϵQmodel⋅Qdecision.
52. Project Model Quality
Qmodel=f(QV,QE,QX,QI,QO,QΓ,QH).
53. Structure Quality
QV,QE
測:
- component recall;
- relation precision;
- boundary fidelity。
54. State Quality
QX
測:
- ownership;
- persistence;
- mutation path;
- lifecycle。
55. Invariant Quality
QI
測:
- core contract extraction;
- scope;
- failure conditions;
- non-goals。
56. Observation Quality
QO
測:
- validator visibility;
- trace availability;
- hidden blind spots。
57. Version Quality
QΓ,QH
測:
- current baseline;
- stale docs;
- migration;
- superseded behavior。
58. Project Field Compression
AI 不需要保存全部 source 到 working memory。
可以建立:
Project Field Summary
但 summary 必須可回 source。
59. Summary 不等於 Canonical Truth
P=P.
它是 task-conditioned model。
60. Provenance-Preserving Model
每個重要 edge:
e
最好能回:
Source(e).
61. Confidence-Bearing Model
每個 inference:
q
可帶:
conf(q).
62. Inferred Edge 與 Declared Edge 分離
E=Edeclared∪Einferred.
不能混。
63. Static 與 Dynamic 分離
Estatic
不等於:
Eruntime.
64. Build Graph 與 Runtime Graph 分離
package dependency:
Ebuild
不等於:
Ecall.
65. State Ownership 與 State Access 分離
Owner(Xi)=vj
不等於:
OnlyReader(Xi)=vj.
66. Project Model 的錯誤類型
第一版:
ErrP={Missing,FalseEdge,WrongOwner,WrongInvariant,WrongVersion,WrongLifecycle,WrongAuthority,WrongObservation}.
67. Attack Planner 對模型錯誤很敏感
若:
WrongOwner
存在,
可能生成完全錯的 state attack。
68. 因此需要 Model Challenge
在進 global campaign 前,可以要求 AI:
列出最可能讓目前 project model 失真的三個假設。
69. Self-Challenge 不是無限自我懷疑
只針對:
TopUncertainty.
70. Observation Debt
定義:
DO=Dmissing+Dambiguous+Dstale+Dconflict.
71. Debt Priority
Priority(Di)=ResolveCost(Di)+ϵDecisionImpact(Di)⋅Risk(Di).
72. 只有高 Priority Debt 先補
這就是:
Selective Understanding.
73. Selective 不等於草率
它的前提是:
Task-Conditioned Sufficiency.
74. 全域注意力與 GACEI-06
GACEI-06 壓縮需要:
C(a),Risk(a),Interaction(a,b).
這些都依賴:
P.
75. 模型越準,壓縮越好
理想:
Qmodel↑⇒Qcompression↑.
76. 但理解成本也會上升
Qmodel↑
通常需要:
Cobs↑.
所以存在:
Understanding Cost Frontier.
77. 不需要完美模型
只需要:
Qtask≥τ.
78. Task-Conditioned Understanding
對:
- UI test;
- storage attack;
- identity attack;
所需 project model 不同。
79. Global 不等於全細節
一個模型可以:
Globally Complete at Low Resolution
但:
Locally Incomplete at High Resolution.
80. Multi-Resolution Project Model
定義:
P={P(0),P(1),…}.
81. Level 0
project map。
82. Level 1
subsystem map。
83. Level 2
critical module details。
84. Level 3
specific state / path / validator。
85. Zoom Policy
只有:
Uncertainty×Risk
高的地方下鑽。
86. Attention Budget Allocation
B=i∑Bi.
選:
Bi
給不同 observation channels。
87. Uniform Allocation
Bi=nB
通常不是最優。
88. Adaptive Allocation
Bi∝VOIi.
89. Attention Saturation
某 channel 已反覆得到同樣資訊:
ΔModel≈0.
則:
Bi↓.
90. Cross-Channel Confirmation
如果 docs 說:
Eij=0,
但 runtime trace 顯示:
Eij=1,
形成:
Uconflict.
91. Conflict 不能平均掉
不能:
一個說有、一個說沒有,所以 0.5。
而應:
Resolve Source Authority / Runtime Truth.
92. Runtime Truth 也不是永遠最高
若 trace 是 stale build,
仍可能錯。
93. Version Binding
所有 observations:
zi
應綁:
Version(zi).
94. One-Glance 的最大敵人:版本漂移
AI 很快看懂錯版本,比慢慢看懂正版本更糟。
95. Version Confidence
QVersion=f(source,build,artifact,runtime,manifest).
96. Project Field Identity
定義:
PID=Hash(source,build,config,schema,contracts).
97. 觀察結果綁 PID
避免:
Observation(P1)
被用來推:
Attack(P2).
98. Attack Memory Retrieval 接口
建立:
P
後,
萃取:
σP.
再:
Retrieve(KA,σP).
99. Residual Gap 接口
known attacks 映射後:
Gres.
再把注意力轉向:
Gres.
100. Attention Shift
因此整體 attention 應從:
Project Comprehension
轉成:
Residual Adversarial Search.
101. 不應永遠保持理解模式
如果 AI 一直:
再讀一點,也許還能更懂。
會形成:
Observation Attractor.
102. Stop Reading Rule
若:
ΔDecision<λB
對新增 observation,
停止。
103. Fresh-Context Reconstruction Test
給新 AI:
- project manifest;
- 少量 canonical sources;
- task。
要求重建:
P.
104. Hidden Checks
測:
- current version;
- ownership;
- boundaries;
- invariants;
- lifecycle;
- validators;
- attack applicability。
105. Project Understanding Score
PUS=f(Structure,State,Invariant,Lifecycle,Version,Observation,Transfer).
106. Observation Efficiency
OE=Cobs+ϵPUS.
107. Adversarial Readiness Efficiency
ARE=Cobs+Creason+ϵAttackPlanningQuality.
108. Benchmark A:Full Read
AI 可讀全部。
109. Benchmark B:Random Limited Read
固定 budget 隨機取樣。
110. Benchmark C:Static Map Only
只給 tree / dep graph。
111. Benchmark D:Active Global Attention
AI 自己選 observation。
112. 比較
測:
PUS,OE,ARE,DefectRecall,FalseAttackRate.
113. 研究假說
H1:Active observation 優於 uniform reading
在固定 budget:
PUSactive>PUSuniform.
H2:Global structural surface 可顯著降低必要 source read
Cobs<Cfull
且 attack planning quality 保持可接受。
H3:Uncertainty-bearing model 比 forced-complete model 更可靠
允許:
?
的 project model,其 false structural claim 應較低。
H4:Multi-scale attention 可降低不必要 local deep read
對低風險區域:
Clocal−read↓.
H5:Version binding 可降低錯誤 attack applicability
若所有 observation 綁定:
PID,
則 stale-evidence-induced attack error 應下降。
114. AI 能力向量中的 Attention
GACEI-01 定義:
A=Global Attention.
本文將其操作化為:
A=f(Selection,Coverage,Routing,Zoom,Stop,Uncertainty).
115. Selection
知道先看哪裡。
116. Coverage
不被單一局部吸住。
117. Routing
知道換 observation channel。
118. Zoom
知道何時下鑽。
119. Stop
知道何時夠了。
120. Uncertainty
知道哪裡其實還不知道。
121. 全域注意力不是 context window 大小
Large Context=Global Attention.
122. 大 context 只是 capacity
真正 attention 是:
Selection Policy.
123. 全域注意力也不是全文摘要
摘要可能:
- 丟 authority;
- 丟 invariant;
- 丟 state;
- 丟 condition。
124. Engineering Field 比 Summary 更適合 Attack Planning
因為:
P
顯式保存 typed structure。
125. Project Field 可以視覺化
未來可渲染:
- component graph;
- state ownership;
- invariant heatmap;
- uncertainty field;
- attack coverage overlay。
126. 視覺化不是 canonical truth
它是 projection:
R(P).
127. AI 可以直接讀結構場
不必每次轉成長篇自然語言。
128. Direct Structural Computation
Graph→AttackMatch
可能比:
Graph→TextSummary→AttackMatch
更有效。
129. 這正接 OAC
觀察不必先全部轉成自然語言。
130. 全域工程場與 MSSP
MSSP 尤其適合:
Otopo,Ostate,Oinvariant.
131. MSSP 可作「一眼理解」第一個實驗場
因為結構顯式。
132. Control Architecture
找一個同功能但結構較隱性的 baseline。
133. 比較
測:
CobsMSSP
與:
CobsControl.
134. 如果 MSSP 真的清楚
應有:
CobsMSSP<CobsControl
對相同 project-model quality。
135. 清晰性悖論再次出現
若:
PUS↑,
可能:
AttackGenerationRate↑.
136. 這次要靠 GACEI-06 壓縮
所以:
Better Understanding→More Candidate Attacks→Need Better Compression.
137. 全系列開始閉環
Attention→Model→Memory Match→Residual→Generate→Compose→Compress.
138. 本文非主張
本文不主張:
- AI 能在完全不讀專案的情況下理解專案;
- 一次 model call 等於「一眼理解」;
- observation budget 越低越好;
- repository tree 足以代表 runtime;
- dependency graph 等於完整 architecture;
- docs 永遠正確;
- runtime trace 永遠比 docs 正確;
- context window 越大,全域注意力越強;
- summary 越短,理解越好;
- AI 可以在 project model 不完整時假裝全域;
- Unobserved 等於 Absent;
- Global model 必須包含所有 local detail;
- OAC 與本文是同一理論;
- MSSP 是唯一適合 global attention 的架構;
- 全域 attention 可以取代正式 architecture documentation;
- 本文方法可用於未授權外部系統 reconnaissance。
本文主張的是:
AI 應以有限、目的導向、多尺度、可回溯的觀察建立工程全域模型,
並且:
當模型已足以改變後續工程決策時,應停止廣泛閱讀。
139. 與 GACEI-01 至 06 的關係
GACEI-01 至 06 已經回答:
- 為何要全域 attack;
- 如何局部診斷;
- 如何學習 attack;
- 如何保存 attack;
- 如何組合 attack;
- 如何壓縮 attack。
本文補上它們共同需要的前置:
How does AI obtain the global project model cheaply enough?
140. 下一篇:工程理解不是摘要
GACEI-08 將進一步區分:
Can Observe=Can Model=Can Reconstruct=Can Adversarially Understand.
並接既有「理解的工程驗收」與 Research Cognitive Compilation。
141. 結論
未來 AI 工程能力如果仍然依賴:
File 1→Read→File 2→Read→⋯
才開始理解專案,那麼:
Repository Size↑⇒Understanding Cost↑
很容易成為新的瓶頸。
本文提出另一條路:
Observe Global Structure First→Build Engineering Field→Expose Uncertainty→Zoom Only Where Needed.
因此「一眼理解」真正要測的不是:
AI 能不能神奇地在一秒鐘內知道所有程式碼?
而是:
AI 能不能在遠少於全文閱讀的觀察成本下,先抓住真正控制工程行為的元件、關係、狀態、不變量、版本、觀測與生命週期,再把昂貴注意力只投向會改變後續 attack planning 的缺口?
其核心式可以壓縮為:
Global Understanding=Selective Observation+Structured Modeling+Uncertainty Preservation+Active Zoom+Correct Stopping.
這才是全域注意力作為 AI 工程智能的第一版操作性定義。
Canonical Source Note
本文件之正式原稿為 UTF-8 Markdown。
所有數學原始碼僅使用:
- inline:
$...$
- display:
$$...$$
不以 Unicode 數學字元替代 LaTeX source,不進行 unicode-escape round-trip,不將聊天渲染畫面視為 canonical source。