Skip to content

Commit 843a2ab

Browse files
Tighten memory computability guide
Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
1 parent 05c5c3a commit 843a2ab

1 file changed

Lines changed: 74 additions & 199 deletions

File tree

docs/memory-computable-guide.md

Lines changed: 74 additions & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -1,262 +1,137 @@
11
# Memory Computable Guide
22

3-
This guide captures the current design baseline for memory computability in
4-
the Kakeya inference engine. It deliberately starts from the three laws of
5-
attention and memory computation, then translates them into a trainable memory
6-
operator. It does not assume proposer cross-training.
3+
本文档只定义 Memory Computation Operator 的设计基线。
74

8-
## Three laws
5+
## 保留的三定律
96

10-
### 1. Alignment object law
7+
### 对齐对象定律
118

12-
Attention aligns to the output token distribution; memory aligns to stored
13-
records.
9+
注意力对齐输出分布,记忆力对齐存储记录。
1410

15-
- Attention computation is constrained by generation targets such as
16-
`P(y_t | x, y_<t)`.
17-
- Memory computation is constrained by already stored records such as user
18-
history, interaction traces, documents, logs, or persistent system state.
11+
### 稀疏化定律
1912

20-
In short:
13+
注意力和记忆力都需要稀疏化分类;注意力在生成分布约束下稀疏化,更适合自回归;记忆力在既存记录约束下主题稀疏化,更适合 diffusion 式重构。
2114

22-
```text
23-
attention alignment = distribution alignment
24-
memory alignment = record alignment
25-
```
26-
27-
### 2. Sparsification law
15+
### 相互内嵌定律
2816

29-
Both attention and memory need sparse classification, but under different
30-
constraints.
17+
注意力中有记忆存储,记忆中有注意力 forward;二者不是对立模块,而是相互内嵌的计算过程。
3118

32-
- Attention sparsifies under a generation-distribution constraint and is a
33-
natural fit for autoregressive token generation.
34-
- Memory sparsifies by topic under an existing-record constraint and is a
35-
natural fit for diffusion-style reconstruction.
19+
## 新设计起点
3620

37-
The important distinction is not "short term vs long term". It is whether the
38-
sparse choice is judged against a token distribution or against stored records.
21+
### 目标
3922

40-
### 3. Mutual embedding law
23+
设计一个 Memory Computation Operator,它不是普通检索,也不是输出分布拟合,而是:
4124

42-
Attention contains memory storage; memory contains attention forward. They are
43-
not opposing modules, but mutually embedded computation processes.
25+
> 在 Transformer 框架中,把注意力计算扩展为面向存储记录的可微分记忆力计算。
4426
45-
For this guide, "memory contains attention forward" means that the current
46-
Transformer computation predicts a memory support distribution. It is not a
47-
claim that attention forward has already read a verified memory fact.
27+
### 核心定义
4828

49-
## Memory computation definition
29+
记忆力计算可定义为:
5030

51-
Memory computation is the extension of attention computation from output
52-
distribution alignment to stored-record alignment:
53-
54-
```text
55-
current Transformer state
56-
-> memory attention forward
57-
-> memory support prediction
58-
-> record-aligned support objective
59-
-> sparse topic support
60-
-> diffusion-style denoising convergence
61-
-> record-aligned memory state
62-
```
31+
> 由当前计算状态触发,通过 attention forward 预测相关记忆支撑,并在既存存储记录约束下完成主题稀疏化与 diffusion 式重构的过程。
6332
64-
The core operator is:
33+
形式化:
6534

6635
```text
6736
M(q, R) -> z_M
6837
```
6938

70-
where:
71-
72-
- `q` is the current Transformer computation state.
73-
- `R = {r_i}` is the set of stored records.
74-
- `M` is the memory computation operator.
75-
- `z_M` is the resulting memory state.
76-
77-
The required constraint is:
78-
79-
```text
80-
z_M ~= E(R_relevant)
81-
```
82-
83-
where `R_relevant` is the stored-record support that should be relevant for
84-
the current computation.
85-
86-
## Operator boundaries
87-
88-
### Memory attention forward predicts support
89-
90-
Memory attention forward produces a support prediction:
91-
92-
```text
93-
pi = P(record/topic | q, R)
94-
```
95-
96-
This is a prediction over records or topic clusters. It is not a verified read.
97-
The support prediction must be aligned to stored records during training.
98-
99-
### Record alignment is the memory requirement
100-
101-
Record alignment is not an optional external check. It is the core training
102-
requirement that makes the support prediction a memory computation rather than
103-
a generic retrieval or generation bias.
104-
105-
The model must learn:
106-
107-
```text
108-
predicted support ~= relevant stored records
109-
```
110-
111-
If this alignment fails, later denoising can stabilize or amplify the wrong
112-
topic.
39+
其中:
11340

114-
### Diffusion denoising converges within support
41+
- `q`:当前 Transformer 计算状态;
42+
- `R`:既存存储记录;
43+
- `M`:记忆力计算算子;
44+
- `z_M`:重构后的 memory state。
11545

116-
Diffusion-style reconstruction does not change the predicted topic support.
117-
It only denoises and converges inside the support produced by memory attention
118-
forward.
46+
### 最小架构
11947

12048
```text
121-
z_T -> z_0 ~= E(R_relevant)
49+
Transformer Current State
50+
51+
Memory Attention Forward
52+
53+
Memory Support Prediction
54+
55+
Record Alignment Objective
56+
57+
Sparse Topic Support
58+
59+
Diffusion-style Memory Reconstruction
60+
61+
Record-aligned Memory State
12262
```
12363

124-
Therefore diffusion is useful only after the support prediction is record
125-
aligned. If the support is noisy or wrong, diffusion can make that wrong memory
126-
state more stable rather than correcting it.
127-
128-
## Minimal neural operators
64+
## 三个关键算子
12965

130-
### 1. Transformer state adapter
131-
132-
Maps the current Transformer computation state into a memory query:
133-
134-
```text
135-
q_M = Phi(q)
136-
```
66+
### 1. Memory Attention Forward
13767

138-
The adapter can consume hidden states, residual states, attention summaries,
139-
or other current-forward state summaries.
68+
作用不是“读取事实”,而是:
14069

141-
### 2. Record encoder
70+
> 预测当前计算需要哪些记忆支撑。
14271
143-
Maps stored records into the memory space:
72+
输出:
14473

14574
```text
146-
r_i -> e_i
75+
π = P(record/topic | q, R)
14776
```
14877

149-
The output can be grouped into record embeddings, topic embeddings, or
150-
record-topic blocks.
78+
即对存储记录或主题簇的稀疏预测分布。
15179

152-
### 3. Memory attention forward
80+
### 2. Record Alignment
15381

154-
Predicts a sparse support distribution over records or topics:
82+
这是记忆力计算的核心约束:
15583

15684
```text
157-
score_i = sim(q_M, e_i)
158-
pi = sparsemax(score) # or entmax / top-k routing
85+
π, z_M ≈ R_relevant
15986
```
16087

161-
### 4. Support alignment head
162-
163-
Trains `pi` against the known relevant support:
164-
165-
```text
166-
L_support = CE(pi, support_label)
167-
```
88+
目标是让 memory support prediction 和 memory state 都对齐既存记录。
16889

169-
or a contrastive support objective:
90+
### 3. Diffusion Memory Reconstruction
17091

171-
```text
172-
L_support = -log exp(sim(q_M, e_pos) / tau)
173-
/ sum_j exp(sim(q_M, e_j) / tau)
174-
```
92+
Diffusion 不负责改变主题,只负责:
17593

176-
### 5. Diffusion memory denoiser
94+
> 在已对齐的 memory support 内进行去噪、收敛和重构。
17795
178-
Denoises a memory latent inside the predicted support:
96+
即:
17997

18098
```text
181-
L_denoise = || eps - eps_theta(z_t, q_M, pi, R, t) ||^2
99+
z_T -> z_0 ≈ E(R_relevant)
182100
```
183101

184-
The denoiser should be evaluated only with support-quality metrics attached,
185-
because denoising quality is meaningless if the support is wrong.
186-
187-
## Training objective
188-
189-
The memory operator can be trained with:
102+
## 训练目标
190103

191104
```text
192105
L_memory =
193-
L_support_alignment
194-
+ lambda_record * L_record_alignment
195-
+ lambda_sparse * L_sparse_topic
196-
+ lambda_denoise * L_diffusion_reconstruction
197-
+ lambda_cf * L_counterfactual_record
198-
```
199-
200-
Where:
201-
202-
- `L_support_alignment` trains memory attention forward to predict the correct
203-
record or topic support.
204-
- `L_record_alignment` trains the final memory state to align with the stored
205-
records.
206-
- `L_sparse_topic` encourages a small active topic set.
207-
- `L_diffusion_reconstruction` trains denoising convergence inside the support.
208-
- `L_counterfactual_record` verifies that changing stored records changes the
209-
predicted support and memory state.
210-
211-
## H200 training target
212-
213-
The first H200 training milestone should validate the memory operator itself,
214-
not proposer integration.
215-
216-
Recommended sample shape:
217-
218-
```text
219-
(q, R_positive, R_negative, R_counterfactual, support_label)
106+
L_support_alignment
107+
+ λ L_record_alignment
108+
+ μ L_sparse_topic
109+
+ ν L_diffusion_reconstruction
220110
```
221111

222-
The run should report both model-quality and system-efficiency metrics.
223-
224-
### Quality metrics
112+
其中:
225113

226-
- Support precision: predicted support records are relevant.
227-
- Support recall: relevant records are covered by the predicted support.
228-
- Record alignment accuracy: `z_M` matches the correct stored record state.
229-
- Sparse topic entropy: routing remains sparse rather than diffuse.
230-
- Denoising gain on clean support: diffusion improves a correct support state.
231-
- Noise amplification rate: diffusion does not stabilize wrong support.
232-
- Counterfactual flip rate: replacing records changes support and `z_M`.
233-
- Update/delete consistency: changed or deleted records stop influencing
234-
memory output.
114+
- `L_support_alignment`:预测的 memory support 是否对应真实相关记录;
115+
- `L_record_alignment`:最终 memory state 是否对齐存储记录;
116+
- `L_sparse_topic`:主题选择是否足够稀疏;
117+
- `L_diffusion_reconstruction`:是否能在正确支撑内完成去噪重构。
235118

236-
### H200 system metrics
119+
## 判断是否真的有记忆力计算
237120

238-
- Samples per second.
239-
- Records per second.
240-
- HBM usage.
241-
- Routing latency.
242-
- Denoising latency.
243-
- End-to-end memory-operator latency.
121+
核心不是看模型是否“用过历史数据”,而是看:
244122

245-
## Acceptance criteria
123+
> 当前 memory prediction 和 memory state 是否被既存存储记录约束。
246124
247-
The memory operator should be considered valid only if:
125+
关键指标:
248126

249-
1. Support prediction aligns to stored records with high precision and recall.
250-
2. Diffusion denoising improves record-aligned states on clean support.
251-
3. Diffusion does not amplify noisy or wrong support beyond an allowed budget.
252-
4. Counterfactual record changes cause corresponding memory state changes.
253-
5. Record update/delete tests stop stale records from influencing output.
254-
6. The H200 latency and memory overhead are small enough to justify later
255-
inference-engine integration.
127+
- support precision
128+
- support recall;
129+
- record alignment accuracy;
130+
- sparse topic entropy;
131+
- reconstruction quality;
132+
- counterfactual record sensitivity;
133+
- update/delete consistency。
256134

257-
## Design summary
135+
## 新设计一句话
258136

259-
Memory computability is not proven by training on historical data. It is proven
260-
when the current computation predicts a sparse memory support, that support is
261-
aligned to stored records, and diffusion-style denoising converges only inside
262-
the aligned support.
137+
记忆力计算是注意力计算从“输出分布对齐”向“存储记录对齐”的扩展:它通过 memory attention forward 预测记忆支撑,通过记录对齐约束校正支撑分布,再通过 diffusion 式重构形成可用的 memory state。

0 commit comments

Comments
 (0)