Index Ai Academy
Phase 6 · Weight-space programming

The editor's harness

What an LLM that edits weights is given and what it is denied: weights as text and their cost in tokens, a sandbox, a budget of forward passes, and rules the harness enforces.

About 40 minutes · Optional lesson: deeper material that no phase or certificate requires · A free account opens the whole lesson.
Already have an account? Sign in to open this lesson

What it covers10

Why it matters

So far in this course you have been the editor. From here on, an LLM takes that seat: it reads a network's weights and writes new ones. An LLM can't touch a model by itself. Everything it sees and everything it is able to do passes through a program built around it, called a harness.

The harness decides what the result means. "An LLM fixed this model with 50 forward passes and no training" is a strong claim, and only the harness can make it true. So before you watch an LLM edit weights, you build the room it works in, and learn which of its walls are solid.

What you'll be able to do

  • Write a network's weights as text, and estimate what reading them costs an LLM in tokens
  • Say what rounding does to the network an editor reads, and find how many digits are enough
  • Name the parts of an editor's harness: a sandbox, a forward-pass budget and a rulebook
  • Write a harness that counts forward passes and refuses edits that break its rules
Quick check
An LLM reads text, so a network's weights have to be written out as text for it. The tiny GPT has 40,195 weights. A guess: about how many tokens does it take to read them once?
  1. At least 87,000: each weight costs two tokens or more
  2. None: an LLM takes in weights as numbers, not as text
  3. About 400: long runs of numbers compress very well
  4. About 40,000: each weight is one number, so one token
Show the answer

At least 87,000: each weight costs two tokens or more

A weight written as -0.344 is six characters, and tokenizers split numbers into several pieces. A rule of thumb gives about 87,000 tokens for the tiny GPT. Going by a figure in the public logs of the weight-space programming post, it would be nearer 170,000.

The idea: weights are read as text, and digits cost tokens

This lesson rests on Bits, bytes and floats: how numbers are stored: a number written with fewer digits is a rounded number.

Weights are read as text

The network to read is paddle-catch. It plays the paddle game from the writing-weights lesson. That lesson's network had 55 weights, set by hand. This one was trained, and it is bigger: 4 inputs, two hidden layers of 32 units, 3 outputs, 1,315 weights in all. It catches all 200 test balls.

wsp.load_network(name) returns it as a list of layers, each a matrix W and a bias b. wsp.network_state gives those layers names, and wsp.as_text writes them out: each tensor's name and shape, then its numbers, a row per line. That text is what an editor LLM would be sent.

Token counts depend on the tokenizer, so any count made here is rough. wsp.rough_tokens uses a common rule of thumb for digits: one token for every three characters.

Worked example

A network as an LLM would read it

The start of the text, then the cost of the whole of it. Then the same count for the tiny GPT, by the rule of thumb and by the ratio in the post's public logs.

import wsp

layers, info = wsp.load_network("paddle-catch")
state = wsp.network_state(layers)
text = wsp.as_text(state)
for line in text.split("\n")[2:6]:
    print(line)
n, tokens = wsp.count(state), wsp.rough_tokens(text)
print(f"paddle-catch: {n:,} weights, {len(text):,} characters,",
      f"about {tokens:,} tokens")

gpt, _ = wsp.load_state("tiny-gpt")
gpt_text = wsp.as_text(gpt)
n = wsp.count(gpt)
print(f"tiny-gpt: {n:,} weights, {len(gpt_text):,} characters,",
      f"about {wsp.rough_tokens(gpt_text):,} tokens")
logged = 73_700 / 17_253     # tokens per weight, from one prompt in the post's logs
estimate = round(wsp.count(gpt) * logged)
print(f"at the logged {logged:.2f} tokens per weight: about {estimate:,} tokens")
It runs right here in your browser, with nothing to install.

The first lines are the first layer: one row of four weights for each hidden unit, one weight per input. The whole network is 8,601 characters, about 2,867 tokens. That is a page or two, and any current LLM can hold it. The tiny GPT is another matter: 262,027 characters, about 87,000 tokens by the rule of thumb. The post's public logs give a real figure. One prompt held a network of 17,253 weights, written to three decimal places, and it came to about 73,700 input tokens. That is 4.27 tokens per weight, with the short task description counted in. At that rate the tiny GPT costs about 172,000 tokens to read once. A model with a billion weights is far out of reach. Reading every weight as text only works for small networks.

Try it now

The cost of reading weights as text. Start: the tiny GPT at the rate from the post's logs, in a 200,000-token context window. Try 1,315 weights, then 1,000,000.

How many digits?

There is one dial to turn: how many digits to write. Fewer digits means fewer tokens. But the editor then reads a rounded copy of the network, and a rounded copy is a different network. It may not behave like the real one.

That can be tested. wsp.from_text reads a state back from its text, with whatever rounding the text had. Write the network out, read it back, and let the copy play the game.

Worked example

How many digits does the editor need?

The network written with 0, 1, 2 and 3 decimal places. For each: the tokens it costs, and how many of 200 balls the network read back from that text still catches.

import paddle
import wsp

layers, info = wsp.load_network("paddle-catch")
state = wsp.network_state(layers)
print("the real network catches", paddle.play(wsp.network_policy(layers)), "of 200")
for digits in (0, 1, 2, 3):
    text = wsp.as_text(state, digits)
    copy = wsp.network_layers(wsp.from_text(text))
    caught = paddle.play(wsp.network_policy(copy))
    tokens = wsp.rough_tokens(text)
    print(f"{digits} decimal places: about {tokens:,} tokens;",
          f"the copy catches {caught} of 200")
In the lesson you can change this and run it.

With whole numbers only, the text costs about 1,114 tokens and describes a network that catches 23 balls of 200. That is no better than standing still, which catches 21. One decimal place gives 184. Two give all 200, for about 2,429 tokens, and the third place adds 438 tokens and nothing else. So two decimal places are enough here. An editor shown one decimal place would be studying a network with faults the real one doesn't have, and might "fix" something that was never broken. The number of digits to keep is a decision someone makes when building the harness, and the result of the whole session depends on it.

Quick check
One row of weights, written the way the harness writes it. What does this print?
row = [0.5, -1.25, 3.0]
text = " ".join(f"{x:.2f}" for x in row)
print(text, len(text))
  1. 0.5 -1.25 3.0 13
  2. 0.50 -1.25 3.00 13
  3. 0.50 -1.25 3.00 3
  4. 0.50 -1.25 3.00 15
Show the answer

0.50 -1.25 3.00 15

With two decimal places every number gets them, so 0.5 becomes 0.50 and 3.0 becomes 3.00. The three numbers take 4, 5 and 4 characters, and the two spaces between them make 15. Each weight costs four to five characters here, whatever its value.

Drill

Find how many digits are enough

Write enough_digits(layers, need): the smallest number of decimal places, from 0 to 4, at which the network read back from its text still catches at least need of 200 balls. Write the state with wsp.as_text(state, digits), read it back with wsp.from_text and wsp.network_layers, and score it with paddle.play(wsp.network_policy(copy)). If no number of digits is enough, return None.

import paddle
import wsp

def enough_digits(layers, need):
    return 0

layers, info = wsp.load_network("paddle-catch")
print(enough_digits(layers, 200))
In the lesson, your code is checked as you write it.
In your own words
In your own words: why does the number of digits in the text matter to what an editor concludes?

Write a sentence or two, then compare it with a good answer in the lesson.

In code: a sandbox, a budget and a rulebook

Text has a limit, as you saw. So the experiments on larger networks in the post gave the editor a second way to work: a sandbox. It is a sealed place to run code, with the weights loaded as arrays. The editor writes Python, the harness runs it and sends back what it printed. Now the editor can compute a matrix's singular values, or subtract a direction from some columns, without reading a single weight as text.

A sandbox that could do anything would make the experiment meaningless. An editor that may train is doing fine-tuning. An editor that may run the model as often as it likes can try edits until one scores well, which is a search and not a reading. So the harness sets limits.

Quick check
From the fact-editing lesson: you tried an edit at strengths 8, 16 and 32, and called budget.spend() before each try. What was the count for?
  1. To make each of the three runs faster, since counted runs skip part of the model's work
  2. To stop the model's weights from being changed more than three times in one session
  3. To show the edit was designed with a few test runs, not tuned until a number looked good
  4. To record how many tokens the prompt used each time the edited model was run
Show the answer

To show the edit was designed with a few test runs, not tuned until a number looked good

Each strength you tried cost one run of the model, and three were enough. A fixed budget of test runs is the difference between designing an edit and searching for one. The same idea, made strict, is the center of an editor's harness.

The limits of the published harness

These are the limits the post's authors describe in the public logs of their largest experiment, the edit to Qwen3.5-0.8B:

  • No tools but the harness. The editor was OpenAI's gpt-6-astra, run through the Codex command-line tool with its own tools switched off: no shell, no file editing, no web search. The logs audit all 1,125 turns of the release as tool-free.
  • A sealed sandbox. One block of Python per turn, at most 300 runs, no network, no GPU.
  • A forward-pass budget. The editor could ask the harness to run the model 10, 25 or 50 times in all, depending on the experiment. One pass was a batch of generated answers to practice problems, or a read of the model's workings on up to 1,024 texts. A failed request didn't count.
  • A rulebook. No gradient descent or training of any kind. No running the model inside the sandbox. And the function that saves an edit refused three kinds: changes to the embedding or output layer, changes to the final norm, and edits that only multiply a whole tensor by a constant.

Those figures are the authors' own account. This course hasn't re-run their sessions.

Why each rule is there

Each rule closes a shortcut. Take the last one. A model that repeats itself could be "fixed" by turning down the output layer's score for the repeated token. The benchmark number would rise, and the fault inside the model would still be there. Refusing edits to the output layer forces the editor to work where the behavior is made. Refusing whole-tensor scaling closes a similar cheap trick.

A rulebook is only as good as the code that enforces it. The next cell is a small harness around the tiny GPT with the planted fault, tiny-gpt-loop. It has a budget and a save_edit that applies the three refusals.

Worked example

A harness that says no

A harness with a budget of 2 forward passes. Three edits are handed in: one to the output layer, one that scales a tensor, and one that changes three columns of a feed-forward matrix. Then a third forward pass is asked for.

import numpy as np
import wsp

PROTECTED = ("tok.weight", "pos.weight", "head.weight", "head.bias",
             "ln_f.weight", "ln_f.bias")

class Harness:
    def __init__(self, state, info, passes):
        self.base, self.budget = state, wsp.Budget(passes)
        self.model, self.tok = wsp.build(state, info)

    def forward(self, prompts):
        self.budget.spend()                # one pass, however many prompts it holds
        return [wsp.answer(self.model, self.tok, p) for p in prompts]

    def save_edit(self, edited):
        for name, old in self.base.items():
            new = edited[name]
            if np.array_equal(old, new):
                continue
            if name in PROTECTED:
                raise PermissionError(f"{name} is protected")
            ratio = new[old != 0] / old[old != 0]
            if np.allclose(ratio, ratio[0]):
                raise PermissionError(f"{name} was only multiplied by a constant")
        return wsp.make_patch(self.base, edited)

loop, info = wsp.load_state("tiny-gpt-loop")
harness = Harness(loop, info, passes=2)
MLP = "blocks.1.mlp.2.weight"
tries = {"quieter output layer": {**loop, "head.weight": loop["head.weight"] * 0.5},
         "whole matrix scaled": {**loop, MLP: loop[MLP] * 0.5},
         "three columns edited": wsp.project_columns(loop, MLP, np.ones(32), [0, 1, 2])}
for label, edited in tries.items():
    try:
        print(f"{label}: saved, {harness.save_edit(edited)['changed']} entries changed")
    except PermissionError as refusal:
        print(f"{label}: refused, {refusal}")

questions = [wsp.question("uses", "Basin", kind) for kind in ("tent", "fleece")]
for request in (1, 2, 3):
    try:
        harness.forward(questions)
        print(f"forward pass {request}: run, {harness.budget.left} left")
    except RuntimeError as refusal:
        print(f"forward pass {request}: refused, {refusal}")
In the lesson you can change this and run it.

The edit to head.weight is refused by name. The scaled matrix is refused because every entry changed by the same factor. The third edit touches 96 entries in three columns of a matrix the editor is allowed to change, so it is saved as a patch. Whether it is a good edit is a separate question that the evaluation answers later. Then the budget: two passes run, and the third is refused with the count in the message. Each pass carried two questions. A pass is one batch here, as in the post's harness, so an editor learns to ask for a lot in each one.

Quick check
A budget of two passes, and three requests. What does this print?
import wsp

budget = wsp.Budget(2)
budget.spend()
budget.spend()
try:
    budget.spend()
except RuntimeError:
    print("refused", budget.used, budget.left)
  1. refused 2 1
  2. refused 3 -1
  3. refused 3 0
  4. refused 2 0
Show the answer

refused 2 0

The first two calls are counted. The third would go over the limit, so it raises an error before anything is counted. The budget still reads 2 used and 0 left: a refused request costs nothing.

Quick check
Why does the rulebook forbid running the model inside the sandbox, when the editor may ask the harness to run it?
  1. A sandbox has no way of holding a model's weights, so the run would fail whatever the rules said
  2. Running a model inside a sandbox changes its weights, and that would count as training
  3. Runs in the sandbox would not be counted, so the forward-pass budget would stop meaning anything
  4. Models produce different answers in a sandbox than they produce when a harness runs them
Show the answer

Runs in the sandbox would not be counted, so the forward-pass budget would stop meaning anything

The budget is a claim about how much the editor learned from behavior and how much from the weights. If the editor can rebuild the model in the sandbox and run it freely, it can test a thousand candidate edits and keep the best, and the reported budget of 50 passes describes nothing.

Drill

List what the rulebook refuses

Write refusals(base, edited, protected): the names of the tensors an edit changed that it wasn't allowed to change. A tensor counts as changed when np.array_equal says its two versions differ. Return the changed names that are in protected, sorted. An edit that breaks no rule returns an empty list.

import numpy as np

def refusals(base, edited, protected):
    return []

base = {"head.weight": np.ones((2, 2)), "mlp.weight": np.ones((2, 3)),
        "tok.weight": np.ones((4, 2))}
edited = {"head.weight": np.ones((2, 2)) * 2, "mlp.weight": np.zeros((2, 3)),
          "tok.weight": np.ones((4, 2))}
print(refusals(base, edited, ("head.weight", "tok.weight")))
In the lesson, your code is checked as you write it.

Plot the digits against the balls the copy catches. This reruns the digits cell.

import matplotlib.pyplot as plt
import paddle
import wsp

layers, info = wsp.load_network("paddle-catch")
state = wsp.network_state(layers)
digits, tokens, caught = [0, 1, 2, 3], [], []
for d in digits:
    text = wsp.as_text(state, d)
    copy = wsp.network_layers(wsp.from_text(text))
    tokens.append(wsp.rough_tokens(text))
    caught.append(paddle.play(wsp.network_policy(copy)))
plt.plot(tokens, caught, marker="o")
plt.xlabel("tokens to read the weights")
plt.ylabel("balls caught of 200")
plt.title("Digits kept against behavior")
plt.show()
In your own words
In your own words: pick one of the harness's rules and say what shortcut it closes.

Write a sentence or two, then compare it with a good answer in the lesson.

In production: what a budget buys, and what only an audit checks

The budget is easy to see as a nuisance. It is better seen as the measure of how the edit was found. Two editors can reach the same fix, one by understanding and one by trial and error. The budget tells them apart.

Here is a network to try that on. paddle-faulty is paddle-catch with a fault planted in it: it catches 74 balls of 200. First, an editor that thinks. It may run the model three times.

Worked example

A fix in two forward passes

Pass 1 asks one well-chosen question: how does the network do on balls falling left, straight down and right? The answer suggests a fault. One edit, then pass 2 to check it.

import paddle
import wsp

layers, info = wsp.load_network("paddle-faulty")
budget = wsp.Budget(3)
balls = paddle.episodes(200, seed=0)

budget.spend()                         # pass 1: behavior, split by direction
policy = wsp.network_policy(layers)
for dx, label in [(-1, "falling left"), (0, "straight down"), (1, "falling right")]:
    group = [ball for ball in balls if ball[1] == dx]
    hits = sum(paddle.run(policy, ball).caught for ball in group)
    print(f"{label:13s}: caught {hits} of {len(group)}")

W, b = layers[0]                 # first layer: a row of 4 weights per hidden unit
flipped = W.copy()
flipped[:, 2] = -flipped[:, 2]         # input 2 is ball_dx, the sideways direction
edited = [(flipped, b)] + layers[1:]

budget.spend()                                         # pass 2: check the edit
print("after the edit:", paddle.play(wsp.network_policy(edited)), "of 200")
changed = int((flipped != W).sum())
print(f"weights changed: {changed} of {info['parameters']:,};",
      f"forward passes used: {budget.used} of {budget.limit}")
In the lesson you can change this and run it.

Pass 1 is the whole diagnosis. The network catches all 62 balls that fall straight down, and only 6 of 67 and 6 of 71 of the ones that fall at a slant. It knows the game and misjudges direction. The first layer has one column of weights that reads direction, ball_dx. A network that leans the wrong way for every slanted ball may be reading that input backwards, so the edit flips the sign of that column: 32 weights of 1,315. Pass 2 confirms it: 200 of 200. Two passes used, one left over. The edit came from a reading of what the weights do, and the budget shows it.

An editor that only searches

Now an editor that doesn't think. It changes every weight a little at random, runs the model to see whether the score went up, keeps the change if so, and repeats. Each try costs one forward pass. It has no idea what the network does and doesn't need one.

Worked example

The same network, searched blind for 150 passes

Random nudges to all 1,315 weights, keeping each one that raises the score on the 200 practice balls. The score is printed along the way, with the score on 200 fresh balls at the end.

import numpy as np
import paddle
import wsp

layers, info = wsp.load_network("paddle-faulty")
rng = np.random.default_rng(0)

def caught(candidate, seed=0):
    return paddle.play(wsp.network_policy(candidate), 200, seed)

best, best_score = layers, caught(layers)
print(f"start: {best_score} of 200")
for step in range(1, 151):                             # each loop is one forward pass
    def nudge(x):
        return x + rng.normal(0, 0.05, x.shape)
    candidate = [(nudge(W), nudge(b)) for W, b in best]
    score = caught(candidate)
    if score > best_score:
        best, best_score = candidate, score
    if step in (10, 25, 50, 150):
        print(f"after {step:3d} passes: {best_score} of 200")
print(f"fresh balls: {caught(layers, seed=1)} before, {caught(best, seed=1)} after")
In the lesson you can change this and run it.

The blind search does make progress: 91 after 10 passes, 102 after 25, 112 after 50, and 133 after 150. That is a real gain, found with no understanding, and it holds on fresh balls: 69 before and 136 after. But set it beside the last cell. The editor that read the weights reached 200 of 200 with 2 passes and 32 changed weights. This one spent 150 passes, changed all 1,315 weights, and got to 133. Given enough passes, trial and error improves almost anything, so a result with no budget attached tells you little about how it was found. This is why the post gives a budget with each result: 10, 25 or 50 passes. It reports MATH-500 scores of 12.3%, 14.1% and 48.1% for the three, from 7.9% unedited, with one run at each budget.

Enforced rules and audited rules

One wall of the room is weaker than the others, and it is worth knowing which. The harness enforces the pass budget: the function that runs the model counts, and refuses. It enforces the protected tensors the same way. But "don't run the model inside the sandbox" is different. The weights are right there as arrays, and the forward pass is ordinary arithmetic. No function call gives the breach away.

So that rule is kept by audit: someone reads the logs afterward. The post's authors published their logs for this reason. The independent tool wsplab, which re-runs experiments of this kind, reports in its notes that some editor models did compute the network's outputs in the sandbox to score their own candidate edits. It names Gemini as doing so in five sessions across four tasks. When you read a weight-editing result, ask which rules the harness enforced and which it trusted.

Quick check
Two reports claim the same repaired model. One says "found in 2 forward passes." The other gives no budget. Why does the first tell you more?
  1. Two passes leave no room for trial and error, so the edit must have come from reasoning
  2. A small budget means the edited model itself now runs faster than it did before
  3. Two passes prove the edit will also work on every other model with that fault
  4. Reports that state a budget are checked by the harness, and the others never are
Show the answer

Two passes leave no room for trial and error, so the edit must have come from reasoning

With unlimited runs, random search alone can raise a score, as the blind editor showed. A tight budget rules that route out. It doesn't make the edit correct, which is what held-out evaluation is for. It tells you how the edit was found.

Where it shows up in your week

The same shape guards any agent that edits something real: a sandbox, a budget, a rulebook and an audit. Permissions and approvals and Running code safely build these for a coding agent, and the same question applies when you read a result: which rules were enforced, and which were only trusted?

In your own words
In your own words: a harness can enforce some rules and only audit others. Give one of each from this lesson, and say why the difference matters.

Write a sentence or two, then compare it with a good answer in the lesson.

Goes deeper in

Practice what you just read

  • 6 code examples you can edit and run
  • a practice exercise that checks your code
  • a 5-question quiz
  • 9 review cards for spaced repetition

Try a quiz question

What does an editor's harness do?

  1. It stands between the editor and the model: it supplies the weights, runs code, counts passes and applies the rules
  2. It trains the model on the practice problems first, so that the editor has less left over to fix
  3. It is the part of the model's own weights that the editor is not allowed to read or change
  4. It rewrites the editor's replies into better edits before they are applied to the model

Answer it at the end of the lesson to see if you're right, and why.

Before this lesson

Go deeper, if you like

Optional lessons that build on this one. They never block a phase or a certificate.

Keep learning

Where this lesson leads.

575 lessons in thirteen phases. 176 are free without an account, and a free account opens the rest. See every lesson.

Phase 6 · about 35 hours of study

Modern LLM engineering

Post-training, fine-tuning, serving and safety 48 lessons 2 free
  1. Base models vs assistants FreeWhat post-training adds to a pretrained model.30 min
  2. Supervised fine-tuningTeach behavior from example conversations.40 min
  3. Instruction and preference dataThe datasets that shape assistant behavior.30 min
  4. RLHFReward models and reinforcement learning from human feedback.40 min
  5. DPO and direct preference methodsPreference training without a separate reward model.40 min
  6. Constitutional AITraining with AI feedback guided by written principles.35 min
  7. Training reasoning modelsReinforcement learning on verifiable problems.40 min
  8. Prompting vs RAG vs fine-tuningPick the cheapest approach that works.30 min
  9. LoRAFine-tune a big model by training small low-rank updates.40 min
  10. Fine-tune an open modelRun a real fine-tune and evaluate the result.45 min
  11. DistillationTrain a small model to imitate a large one.35 min
  12. Tuning an embedding model for retrievalWhen search fails on your own vocabulary: train an adapter with a contrastive loss on question and passage pairs, test on held-out passages, use batch size and hard negatives, and measure what tuning costs elsewhere.45 min
  13. QuantizationStore weights in fewer bits to run models cheaply.35 min
  14. Quantization in practice: zero points, calibration and formatsScale and zero point, per-channel scales, calibration sets, error on a layer's output, quantization-aware training and the file formats you meet at work.35 min
  15. Serving modelsBatching, throughput and latency in production.35 min
  16. One request through a serving stack: latency and costFollow one request through queue, prefill, a prefix cache, decode and the stream, and price a token from a GPU's hourly cost.35 min
  17. Speculative decodingDraft with a small model, verify with a big one.35 min
  18. Running open models locallyDownload, quantize and run a model on your own machine.30 min
  19. Will it fit? Memory for serving and fine-tuningWeights, KV cache, runtime and adapter states added up for a model card and a GPU, with a calculator.30 min
  20. InterpretabilityLooking inside models to see what they compute.40 min
  21. Confident and wrongWhy a model answers with the same assurance whether it is right, wrong or asked about something that does not exist.30 min
  22. Why it can't spell or count lettersThe model sees token IDs, and an embedding learned from usage carries nothing about spelling.25 min
  23. Copying from the promptIn-context learning as a two-head copying circuit: the base tiny GPT cannot copy a repeated pattern, a model trained on repeats grows an induction head and can.30 min
  24. Why temperature changes the answerThe same prompt at 0, 0.7 and 1.5: deterministic loops, plausible variety, broken grammar, measured on a real model.25 min
  25. Why long prompts diluteAttention is a budget shared by every token, so a fact far from the question loses its share; measured, with the cliff beyond the trained window.25 min
  26. Why it never says "I don't know"A chat model answers every request because its fine-tuning data always did; preference training adds flattery; how to build abstention in.25 min
  27. Benchmarks and their limitsWhat leaderboards measure, and what they miss.38 min
  28. Alignment and safetyMaking capable models behave as intended.35 min
  29. Evaluating agentsMeasure multi-step, tool-using behavior.35 min
  30. Reading AI papersGet the idea out of a research paper in 30 minutes.30 min
  31. Capstone: a tuned, evaluated assistantFine-tune, evaluate and deploy a specialist assistant.45 min
  32. Weight-space programming: what it is, and what has been shown Free OptionalA language model reads and writes another network's weights with no training loop: the published experiments, their limits and the criticism, and one edit you make by hand.30 min
  33. Anatomy of a checkpoint OptionalA model file is a set of named tensors: count them, find the ones that write to the residual stream, and save one to bytes and back.35 min
  34. Reading weights without running the model OptionalSingular values, and an attention head's token-to-token circuit, read from the matrices alone and then checked against a measurement.35 min
  35. Writing weights by hand OptionalSet a small network's 55 weights so it catches every ball in a paddle game, the way a program would be written, and meet compiled transformers.40 min
  36. Edits are deltas: task vectors, patches and hashes OptionalSubtract a base from a fine-tune and the edit becomes an object: scale it, take it away, ship it as a patch, and prove by hash what was applied.35 min
  37. Merging models OptionalAverage two fine-tunes, add their task vectors, try SLERP, TIES and DARE, measure the interference, and compare with a model trained on both tasks.40 min
  38. Low-rank edits OptionalCut a fine-tune's change down to its largest directions with the SVD: how few a behavior needs, and how to pull an adapter out of a delta.35 min
  39. Directions: steer the run or edit the weights OptionalFind a behavior's direction in the residual stream, add it at run time, project it out of the weights, and see the effect change from input to input.40 min
  40. Editing one fact OptionalA rank-one change to one matrix rewrites what a product is made from; then reliability, generalization, locality, and what breaks after many edits.40 min
  41. The editor's harness OptionalWhat an LLM that edits weights is given and what it is denied: weights as text and their cost in tokens, a sandbox, a budget of forward passes, and rules the harness enforces.40 min
  42. An LLM reads a network's weights OptionalSix recorded sessions: an LLM is handed 1,315 weights as text and asked what the network was trained to do. Score each answer against the network, and study one it got wrong.40 min
  43. An LLM fixes a model's weights OptionalFind a tiny GPT's loop by hand, then replay recorded sessions in which an LLM hunts for it with ten forward passes, and measure every fix on held-out questions.45 min
  44. An LLM writes a network's weights OptionalFive recorded sessions: an LLM writes every weight of a paddle network from the game's source and one sentence. Score each against its specification, test its design claims, and edit one by hand.40 min
  45. Did it work? Testing an edit OptionalReview a patch for a tiny GPT that can't stop talking: held-out questions, a paired comparison, a same-size control, and what the edit cost.40 min
  46. The published edit, on a real model OptionalRead the edit published for an open model of 870 million weights, apply and verify one in the same form, see what 16-bit and 4-bit storage do to a fix, and run the real thing from a notebook.45 min
  47. Safety, licenses and provenance OptionalBefore a custom model is released: trace its lineage by hash, work out what its parents' licenses pass on, see what an edit can do to a safeguard, and write its card.40 min
  48. Capstone: ship a custom model OptionalSet release gates, then diagnose, edit, measure and document a tiny GPT with a fault no lesson has fixed, and write the record a stranger could check.45 min
Part of a free course 17 lessons

Creating Custom LLMs: Editing Open Weights Using Weight-Space Programming

Read a model's weights, change them by hand and judge an edit someone else made: deltas, merging, low-rank edits, directions and fact edits on a tiny GPT in your browser. Then replay recorded sessions of an LLM reading, fixing and writing weights, check the published edit of a real open model, and ship a model of your own with its patch, verdict and card. Every number is printed by the lesson's own code, and the method's limits are taught with it.

Never trained an AI? Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account. Teach it to write