Learning New Facts with Weight Space Programming

Agents & AI systemsproject introductionWeight Space Programming

Viksit + Codex collaboration

I’ve been thinking about how model memory lives in text and Markdown today. Agents keep conversations in context, compact them into summaries, and retrieve past information from vector stores.

What would it take to move some of that memory into model weights? Could an agent write what it learns as it goes, without gradient descent or LoRA? If I correct an agent, I’d like it to use that correction the next time it faces a similar decision. What should it store? How should that change its behavior? Who gets to make that change?

I’ve been following weight space programming (WSP), and thought it would be an interesting way to try this.

  • I started with facts that pair a name with a two-digit value, like a team and its meeting room.

  • I then added a small memory head to Qwen’s last decoder block. It has a weight matrix with one column per team. Qwen picks the team and room from the assignment. My program encodes the two digits, replaces that team’s column, and saves the 320-byte matrix.

  • I reload the matrix in a fresh process and ask a new question. Qwen picks the team to read. A fixed reader uses that team’s stored value, the question, and Qwen’s current activations to compute a correction.

  • I added it after the last decoder block, before Qwen scores the next token. The base model and reader weights stay frozen.

Qwen selects a write from a teaching sentence. The program updates and saves one column of weights. After restart, the memory head reads that column and adds a correction after decoder block 31.
  • I then loaded two saved assignments and asked the same questions after restart. Which room does the team meet in? Should I move from where I’m waiting?
Qwen gives the correct move decision for both saved rooms and incorrectly recalls 72 for both. Across ML4, move decisions score 797 of 800 with a write and 400 of 800 with no write. Exact recall scores 450 of 800.

The saved value changed the move decision. Exact recall and replacement fell short of the criteria I’d set.

I traced the recall errors to the second digit. When I tested the reader repair end to end, Qwen still sometimes copied the team name incorrectly into the write command.

Experiments in progress

This is a work in progress. I’ll add the full experimental results and writeups here.

  • ML1 · Testing Qwen on Facts with Two-Digit Values. Can Qwen use the fact when I give it in the prompt?

  • ML2 · Storing and Reloading Values in External and Internal Memory. Do supplied writes affect answers after restart?

  • ML3 · Selecting Memory Writes and Reads from Natural Language. Can Qwen choose what to store and retrieve?

  • ML4 · Recalling and Using Stored Two-Digit Values After Restart. How well does the full process work on new assignments?

  • ML5 · Testing Retention in Four Memory Slots Across 100 Writes. Do updated and untouched values survive repeated writes?

What comes next

  • ML6 · Comparing the memory head with an exact table. I then tried a small set of numerical edits adapted from CounterFact. I’ll show how the head and table compared after restart, including cases where both missed the update.

  • ML7 · Tracing errors through the write and read paths. My proposed next test is to replay those failures with the correct write and read commands supplied. That should help me see when Qwen picked the wrong command and when it had the right stored value and still gave the wrong answer.

I’d like to understand where a correction goes wrong before I try storing something less tidy than a room number. If I tell an agent that a rule only applies in certain situations, what should it write? And if it learns the wrong thing, can I undo that change without losing what it learned afterward?