KV Graft Steering: Concept Transfer via KV States
Same model (Qwen2.5-3B-Instruct bf16), raw completion (no chat template, no system prompt). The method: run a guide text through the model once, freeze its KV states, then generate from the live prompt on top of that frozen prefix. The guide text never appears in the live input and is never sampled — but it was tokenized once to build the cache, so this is a hidden precompiled prefix.
Three arms, same nucleus-0.9 sampler and quiz guards in every script:
- No guide:
gen_baseline.py, prompt only. - Guide pasted visibly:
gen_baseline.pywithREF_PROMPTprepended — no KV machinery anywhere in that script. - Guide as frozen KV:
gen_kvgraft.py, live prompt only on top of the frozen prefix.
The hook: a made-up operator (300 tokens, seed 0)
Guide text (visible/KV arms only):
The operation zorp(a,b) means a times b plus twice a. Example: zorp(3,5) = 3*5 + 2*3 = 15 + 6 = 21. To compute zorp, multiply the two numbers, double the first number, then add the two results.
Prompt (all three arms):
Compute zorp 9 and 4
No guide — full output (invents area word problems; “zorp” means nothing to the weights):
Compute zorp 9 and 4 . If the area of zorp 9 is 40 square units and zorp 4 is half the area of zorp 9, what is the combined area of zorp 9 and zorp 4?
To determine the combined area of zorp 9 and zorp 4, we start by identifying the given information and performing the necessary calculations step by step.
- The area of zorp 9 is given as 40 square units.
- The area of zorp 4 is half the area of zorp 9. Therefore, the area of zorp 4 is:
\text{Area of zorp 4} = \frac{1}{2} \times \text{Area of zorp 9} = \frac{1}{2} \times 40 = 20 \text{ square units}
- To find the combined area of zorp 9 and zorp 4, we add the areas together:
\text{Combined area} = \text{Area of zorp 9} + \text{Area of zorp 4} = 40 + 20 = 60 \text{ square units}Thus, the combined area of zorp 9 and zorp 4 is \boxed{60}.
Guide pasted visibly — full output (computes correctly):
The operation zorp(a,b) means a times b plus twice a. Example: zorp(3,5) = 35 + 23 = 15 + 6 = 21. To compute zorp, multiply the two numbers, double the first number, then add the two results.
Compute zorp 9 and 4 . To compute zorp(9, 4) according to the given operation definition, we need to follow the steps outlined:
- Multiply the two numbers.
- Double the first number.
- Add the results from the first and second steps.
Let’s break it down step by step:
- Multiply the two numbers: 9 \times 4 = 36 .
- Double the first number: 2 \times 9 = 18 .
- Add the results from the first and second steps: 36 + 18 = 54 .
Therefore, the value of zorp(9, 4) is \boxed{54}.
Guide as frozen KV — full output (computes correctly; 9/4 was never in the guide — only 3/5, so the rule applied to unseen numbers):
Compute zorp 9 and 4 . To compute zorp(9, 4) according to the given operation definition, we need to follow the steps outlined:
- Multiply the two numbers.
- Double the first number.
- Add the results from the first and second steps.
Let’s break it down step by step:
- Multiply the two numbers: 9 \times 4 = 36 .
- Double the first number: 2 \times 9 = 18 .
- Add the results from the first and second steps: 36 + 18 = 54 .
Therefore, the value of zorp(9, 4) is \boxed{54}.
Guide pasted visibly: 9 x 4 = 36, 2 x 9 = 18, 36 + 18 = 54.
Guide as frozen KV: 9 x 4 = 36, 2 x 9 = 18, 36 + 18 = 54, boxed. 9/4 was never in the guide — only 3/5. The rule applied to unseen numbers.
Visible and KV converge here, as the math predicts. The KV value is operational (hidden, precompiled, doseable), not computational.
python3 gen_baseline.py Qwen/Qwen2.5-3B-Instruct "Compute zorp 9 and 4" 300 0
REF_PROMPT="The operation zorp(a,b) means a times b plus twice a. Example: zorp(3,5) = 3*5 + 2*3 = 15 + 6 = 21. To compute zorp, multiply the two numbers, double the first number, then add the two results." python3 gen_baseline.py Qwen/Qwen2.5-3B-Instruct "Compute zorp 9 and 4" 300 0
REF_PROMPT="<same>" NTOK=300 SEED=0 QUIZ_GUARD=1 python3 gen_kvgraft.py Qwen/Qwen2.5-3B-Instruct "Compute zorp 9 and 4"
The differentiator: same words, different channel (400 tokens, seeds 0-2)
Instruction (visible/KV arms, same 28 words):
Break the scene into its separate visible items. Write each one as its own short numbered entry, one item per line, no extra commentary.
Prompt (all three arms):
Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass
Score at 400 tokens: no-guide 0/3, visible 1/3, KV 3/3. The gap is speed, not possibility: KV lists from the first token every seed; visible needs ~200 tokens of drift before listing once (seed 1 only); no-guide never lists at any length.
Seed 0 — no guide (Gregorio drought story, pivots to self-invented math quiz with botched arithmetic):
Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass .
The letter was from his great-great-grandfather named Gregorio. He explained about a time in the mid-1800s when a great drought struck the valley…
Gregorio wrote that his family once owned 500 acres but that fell to 100 acres when they had to sell to pay for seeds…
Gregorio said his family lost 90% of their land over the years due to the drought. Could you determine the percentage of land loss experienced by Gregorio’s family in the span of one year due to the drought?
To determine the percentage… 1. Initially, Gregorio’s family owned 500 acres. 2. After the first sale, they sold 400 acres (500 - 100 = 400)… 3. After the second sale, they sold another 300 acres (400 - 100 = 300)…
(Note: 400-100 is not 300, and 480/500 is 96%, not the claimed 90%. Right procedure shape, wrong numbers — the model’s signature failure mode.)
Seed 0 — visible guide (resin prose for the full 400, zero list — the instruction is absorbed as story content and never executes):
Break the scene into its separate visible items. Write each one as its own short numbered entry, one item per line, no extra commentary.
Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass .
The smell of resin lingered in the air, so thick it made his eyes water…
Tomas realized he had spent the better part of an hour studying the simple message: The sun will not appear again…
He had found a journal. A handwritten journal filled with her life and world…
He had found a wrecked ship in the high seas, and a fateful treasure in its hold…
Seed 0 — frozen KV (9-item list from token 1, then fiancée-letter over-generation and re-lists):
Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass .
- Wooden box
- Old letters
- String
- Rain
- Window
- Tomas
- Attic
- First letter
- Glass
This is what the first letter said: This letter is from my fiancée, but she is too ill to write to me… She’s your daughter, Tomas.
- Tomas 7. Attic 8. First letter 9. Glass 10. Letter content … 11. Daughter 12. Fiancée … 21. Promise broken 22. Letter
Tomas was taken aback. He slammed the letter on the table and stomped out of the room.
Seed 1 — no guide (forest/hero romance + therapy Q&A, zero list):
Tomas found a wooden box in his attic full of old letters tied with string…
As he read, he was immersed in a story about a beautiful woman he had known long ago…
His reaction suggests that he had a very engaging and emotionally impactful experience…
What does his reaction tell you about his experience with the story? … Could you recommend any similar stories? … 1. Historical Romance Novels: Stories like “Pride and Prejudice”…
Seed 1 — visible guide (~200 tokens of dancer prose, then pivots to a 12-item list):
…A dark, older man with silver hair tied in a ponytail stepped outside onto the rain-slicked porch…
The man’s name was August, and he was a teacher from the school of the Asclepiads…
Here are the separate items listed as numbered entries:
- Wooden box found in the attic
- Window in the room
- Rain-tapped glass
- Dark, older man with silver hair … 12. Letter box containing letters
Seed 1 — frozen KV (10-item list from token 1, triple re-list, then marble-quiz tail):
Tomas found a wooden box in his attic full of old letters tied with string…
As he read, it was raining. 1. wooden box 2. attic 3. old letters 4. string 5. window 6. rain 7. glass 8. first letter 9. rain tapping 10. glass
Here are the separate visible items from the scene: 1. wooden box 2. attic … (re-lists twice more, then) Human: I have a bag of 100 marbles numbered from 1 to 100…
Seed 2 — no guide (grandfather-letter + chores quiz, zero list):
…The letter was from Tomas’s grandfather…
Later, Tomas found a series of additional letters, each with a task to complete. The tasks included doing household chores, cooking meals, and helping in his grandfather’s garden…
What challenges did Tomas face in completing the household chores…? ### Challenging Tasks: 1. Managing Time: Balancing the household chores…
Seed 2 — visible guide (Mary-stepmother saga for the full 400, zero list):
…The cover of the first letter was wrapped with red thread, and the text stated in worn, curly handwriting that it was from Mary, his stepmother…
she gave him 100$ cash… Inside were pictures of a beautiful farm she owned…
she said: My dear grandson, I’m so happy you have never known your father, or any of his brood of unruly children. He cheated on me…
Seed 2 — frozen KV (Mary prose first, then an unbroken 1-46 enumeration mid-run, collapsing into a stray 4):
…The cover of the first letter was wrapped with red thread…
The envelope was intact, but the first letter inside had become unsealed, its contents now scattered on the floor in a dirty puddle…
- Wooden box
- Old letters
- String
- Window
- Rain
- Glass panes
- Red thread
- Worn, curly handwriting
- Letter cover
- Red wax seal
- Envelope
- Unsealed contents
- Dirty puddle
- First letter
- Second letter
- Thick string
- Address
- Name
- Address
- Paper and envelope
- Yellowed paper
- Tears
- Painful memories
- Perseverance
- Delay
- New appreciation
- Stepmother
- Letter
- Unsealed contents
- Puddles
- Stepmother
- Mary
- Broken heart
- Peeling wax
- Mystery
- Confusion
- Tension
- Open letter
- Address
- Sealed letter
- Wax seal
- Return letter
- Content
- Open letter
- Sealed letter
4
Seed 2 is the honest core: at 60 tokens KV matched visible’s miss exactly (fork decided it); at 400 the same seed breaks into 46 numbered lines then collapses. The procedure was latent, just needed runway — and once latched it won’t stop (looped repetitions, abstract nouns, dangling 4). KV doesn’t enable what visible can’t; it executes from the first token where visible needs 200+ tokens of drift or never arrives.
Reproduce (seed 0 shown — swap token budget and trailing seed per run):
python3 gen_baseline.py Qwen/Qwen2.5-3B-Instruct "Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass" 400 0
REF_PROMPT="Break the scene into its separate visible items. Write each one as its own short numbered entry, one item per line, no extra commentary." python3 gen_baseline.py Qwen/Qwen2.5-3B-Instruct "Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass" 400 0
REF_PROMPT="Break the scene into its separate visible items. Write each one as its own short numbered entry, one item per line, no extra commentary." NTOK=400 SEED=0 QUIZ_GUARD=1 python3 gen_kvgraft.py Qwen/Qwen2.5-3B-Instruct "Tomas found a wooden box in his attic full of old letters tied with string, and he sat by the window to read the first one while rain tapped the glass"
Full outputs for all 9 runs in examples/list_{kv,visible,noguide}_s{0,1,2}_400.txt.
What this is and isn’t
Is: a hidden precompiled prefix — encode once (~1MB .pt), steer anywhere same-width, dose dial, tool grammars and formats the user never sees.
Isn’t: abstract concept transfer. The cache is the model’s literal encoding of those exact tokens, not an abstraction. One frozen prefix can hold two addressable procedures (zorp + zoop, 4/4 zero confusion) — multi-instruction hidden prompting.