Skip to content

Commit 797f23c

Browse files
committed
docs: v12 vocab-grounded Q-Former — don't retrain, translate
1 parent 974915d commit 797f23c

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

docs/papers/_draft_v2_30b_a3b_section.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,35 @@ Soft token norm locked at 1.49 vs real embed 1.52 — **perfect 1:1 match**. Bes
286286

287287
**Phi-2 uses rotary position embeddings (RoPE)** — so the positional shift shouldn't cause this. The issue may be simpler: the model's KV cache during autoregressive generation doesn't correctly handle the `inputs_embeds``input_ids` transition. This needs debugging.
288288

289-
**Status:** Architecture validated. Magnitude controlled. Positional/generation issue needs debugging — likely a HuggingFace `generate()` edge case with `inputs_embeds`, not a fundamental architecture problem.
289+
**Status:** Architecture validated. Magnitude controlled. Generation issue identified and solved (see v12 below).
290+
291+
### v12: Vocab-Grounded Q-Former — "Don't retrain, translate."
292+
293+
**The core insight:** The target model spent millions of GPU-hours learning what every token embedding means. We can't teach it a new language in 5000 steps. We must speak ITS language. The substrate translates the source model's knowledge into the target model's vocabulary — weighted combinations of REAL token embeddings the target already understands.
294+
295+
**The Continuum adapter principle applies:** output must be in a format the CONSUMER understands. In Continuum, different AI providers (Claude, GPT, local models) all speak through a common interface — adapters translate between the provider's native format and the system's expected format. Many-Worlds is the same pattern at the representation level: the substrate is the shared interface, the Q-Former is the adapter that translates into each model's native vocabulary.
296+
297+
**Architecture:**
298+
```
299+
Q-Former queries (16, substrate_dim)
300+
↓ cross-attn to substrate field
301+
↓ self-attn between queries
302+
↓ vocab_proj → (16, target_embed_dim)
303+
304+
↓ attention over target vocab: softmax(proj @ embed_table.T)
305+
↓ weighted sum of real token embeddings: attn_weights @ embed_table
306+
307+
soft_tokens (16, target_embed_dim) — each is a "mixture word"
308+
```
309+
310+
**Why this solves three problems at once:**
311+
1. **Magnitude:** convex combination of real embeddings has the same magnitude as real embeddings. No normalization needed. Impossible to oversaturate.
312+
2. **Interpretability:** can decode which vocabulary tokens dominate each query. The substrate's "translation" is inspectable.
313+
3. **Compatibility:** the target model processes the soft tokens using the same pathways it uses for all tokens. No foreign vectors, no distribution shift.
314+
315+
**Generation fix:** HuggingFace `generate()` with `inputs_embeds` is broken for autoregressive generation (confirmed on both Phi-2 and Qwen3 — test 2 in diagnostic produces wrong output even without prefix). Fix: manual generation loop that uses `inputs_embeds` for prefill, then `embed(new_token_id)` for each subsequent step with KV cache. This works correctly with 16 zero-prefix tokens producing identical output to baseline.
316+
317+
**The thesis in one sentence:** Don't retrain, translate. The substrate converts between models' internal representations. The Q-Former translates into each model's native vocabulary. The models do what they already know how to do. The knowledge was free. The translation is cheap.
290318

291319
## 11. Next Experiment Design — The Right Team for the Right Benchmark
292320

0 commit comments

Comments
 (0)