ilm, short for iterative learning model, is a runtime that makes AI agents cheaper the more they work. The first time it meets a new kind of job, a large model writes a short script for it; ilm checks the script and saves it as an action, and every later job of that kind is a replay with no large model.
We show the idea on file tasks, a self-driving car and a parkour robot, and then describe the composer: how ilm builds answers to new jobs out of actions it already has, using addresses, learned contracts, an effect model, practice runs and compression.
Learn once, then replay
Most agents solve every task from scratch, even when they solved the same kind of task a minute ago. ilm takes a different route. The first time a new kind of job arrives, a large model writes a general, typed program for it, which we call an action. ilm checks it and saves it. When a similar job comes in later, ilm replays the saved action instead of asking the model again.
In ilm, a script and an action are the same thing. Whatever the large model writes to solve a job is a short script. Once that script has run and passed its checks, it is saved, with its fixed values turned into parameters, and from then on it is an action that ilm can call.
Several pieces make this safe and cheap:
- Typed actions. An action like "sum a column per group and save it as JSON" takes the file, the column and the output path as inputs, so one action covers every job of its kind.
- A decision model. A small, cheap model (Jev) does the judgement calls. It picks which action fits, fills in its inputs from the job's wording, and reviews the result.
- A gate and a sandbox. New code is checked statically before it ever runs, and every run happens in an isolated process with time and memory limits.
- A journal. Every call is written to an append-only log. From good runs ilm learns what each action's output normally looks like, so it notices when a replay suddenly drifts.
Control tasks: driving and parkour
Actions are not limited to file and data work: anything with a programmatic interface can be driven by them. We use two simulated control tasks in ilm Studio. In both, low-level control (steering and speed, or joint motion) is plain code. The actions encode manoeuvres, and the decision model chooses among them at run time. When a situation has no matching action, the run pauses at a safe point and the large model writes one; after that, the situation is handled without it.
Driving. A car on a city route. Learned actions cover stop signs, school zones, potholes, emergency vehicles and red lights.
Parkour. A simulated humanoid. Each move, such as ducking, vaulting or climbing, is learned once and reused on unseen courses.
Clips from the ilm demo video.
We crossed the same course, Course 7 with eight obstacles, two ways and added up the tokens obstacle by obstacle. Without ilm, the agent (Claude Opus 5.5) used the same parkour tools and worked out every obstacle itself. With ilm, the moves it had already learned ran with no large model at all. Both runs cleared all eight obstacles without a fall.
Across the eight obstacles that is 551k tokens and $0.46 without ilm, against 12.6k tokens and under a tenth of a cent with ilm. Without ilm the cost also varies with the obstacle: the moving platform and the climb each took five calls. With ilm every obstacle costs the same single pick.
A worked example: how the robot learned to jump
To teach the jump, the large model writes one short script: run up to the gap, try every push strength from 0.3 to 0.8 on copies of the world, let the decision model pick one that lands safely, then do it for real and check the robot is on its feet.
Once the script works, it is saved as the action parkour.jump, with its numbers turned into parameters so it fits any gap. From then on every gap is a replay with no large model.
@action
def jump(speed_mps: float = 4.5, angle_deg: float = 30.0,
strengths: list = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) -> dict:
"""Use when a gap is next."""
gap = tools.parkour.next_obstacles(count=1)["obstacles"][0]
tries = tools.parkour.preview(variants=[steps(s) for s in strengths])
# keep only the pushes that land
landed = {s: t for s, t in zip(strengths, tries) if t["ok"]}
if not landed: # nothing works: stop safely and ask
ilm.escalate("no push clears this gap", gap=gap)
question = "Which push lands past the gap with a comfortable margin?"
s = ilm.decision.pick(question, options=landed, gap=gap, frame=camera())
out = tools.parkour.do(steps=steps(s))
ilm.ensure(out["ok"] and not out["fallen"], "landed past the gap on its feet")Listing 1. The saved action parkour.jump, simplified so it is easy to read. A real action is often longer, with more checks, more options, retries and hand-offs, but it has the same shape: look, try, pick, do, check.
Composing new answers from old pieces
Replay only helps when the same kind of job comes back. A job like "filter this file, then keep the top 10 rows" is new as a whole, even if ilm already has a filter action and a top-N action. Today it goes back to the large model. We want ilm to build the answer from the parts it has.
Two facts make this tractable. Both follow from actions being plain, deterministic code: an action a with inputs θ maps a state s to exactly one next state.
Checking is exact
Any candidate plan can be run on a scratch copy of the folder in about a tenth of a second per step, so we never have to trust a guess. The planner only has to rank candidates well, not be right first time.
Training data is free
Every run (s, a, s′) is a true example, with no labelling needed.
The hard part is search. With N actions and plans of length k, there are Nk possible plans; with 106 actions and four steps that is 1024. There are three numbers to attack: the cost of one pick, the number of choices per step, and the plan length. The composer has one idea for each.
Addresses: a pick that doesn't grow with the library
Comparing a task with every action one by one is slow once there are many of them. Instead, every action gets a three-digit address, each digit from 0 to 254, like a floor, aisle and shelf: 2553, about 16 million slots.
The digits come from the action's embedding by residual quantization: the nearest of 255 coarse centres, then the nearest centre to what is left over, and so on.
The library becomes a 255 × 255 × 255 cube of small buckets, stored as three bytes per action, and a pick is three choices of 255:
That is 765 scores per pick at any library size, and a new action gets an address without retraining.
Toy example. With 2-number embeddings and 3 centres per level, an action at (3.6, 1.2) is nearest to the centre (4, 0), so its first digit is 1. Repeating on the leftover gives the address (1, 2, 0), which rebuilds to (3.5, 1.0).
Robustness. A wrong turn near the top would lose an action, so each cell is a bucket compared exactly, an action can have up to three addresses (from its text, its behaviour and the tasks it solved), a plain nearest-neighbour scan runs alongside, and only an overfull bucket is split.
Adding an action needs no retraining and changes no other address:
Contracts: only pieces that fit
Each action needs something and produces something. ilm learns both from the action's own runs, for example "reads a CSV file, writes a JSON file". Two steps can be chained only if what the first produces fits what the second needs:
This turns most wrong plans into impossible ones before any model is asked, and it turns wiring (which output feeds which input) into simple matching. Types are learned on a small ladder (a CSV path is a path, which is text) and only get narrower once several runs agree, so a single odd run can't mislead the planner.
Guess first, then check for real
Running every candidate is cheap but not free. So a small effect model learns to predict what an action will do to the current state, in the spirit of JEPA: it predicts a compact summary of the next state, not every byte of it. The composer imagines about 32 candidates this way, ranks them by how close their predicted result is to the goal, and runs only the best few in the sandbox.
There is a trap. An action usually changes a small part of a large state, so "nothing changes" is almost always a good prediction, and a model trained only to predict the next state learns to ignore the action. We guard against this with an inverse loss: from the states before and after, a second head has to say which action ran.
Rollouts are kept to one or two steps. The real state is re-read after every step that actually runs, because latent world models are known to rank actions reliably only over short horizons.
Dreams: learning with no teacher
Because actions are code, ilm can practise on its own. It samples random chains of actions that fit together, runs them in a scratch folder, and records where they end up.
The trick is hindsight: whatever state a chain reached, the chain is a correct plan for reaching it. Every random run becomes a labelled example for the effect model and the picker. Real tasks still count for more than dreams, since dreams come from a different distribution than what users actually ask.
Compression: keeping plans short
If the same chain of actions keeps showing up in solved plans with the same wiring, it is merged into one new action. This is the BPE idea from tokenizers, applied to plans: common pairs become a single token.
Each merge adds one choice to the library but removes steps from every plan that used it, and plan length is what makes search explode. Merges are weighted towards what recent jobs use, not just what was common long ago. A merge is only committed if every past plan that used the chain, rewritten to call the new action, reproduces its recorded run exactly. If a merged action ever fails, it is split back into its parts and only the broken part is re-planned.
Try cheap first
For each job, ilm climbs a ladder and stops at the first rung that works:
- Replay: a saved action already fits the job.
- First guess: the picker's best plan, checked in the sandbox.
- Wider search: a best-first search over about 32 candidates per step.
- Repair: split a failing merged action, or write a small adapter between two actions that almost fit.
- Ask the big AI: the large model writes a new action, which is saved, so that kind of job won't need it again.
Because checking is exact, more tries buy real accuracy. If each sampled plan were right with probability p, running R of them succeeds with probability
A plan is only accepted when every step feeds the final answer and the result passes the same review as any other job. An accepted plan is compiled into one ordinary action, so the next job of its kind is a plain replay at the cheapest rung.
A small local model as the brain
A language model of about 1.7 billion parameters (LFM3-1.7B) runs locally and takes over jobs that would otherwise need the large one:
- Proposing plans. Its output is constrained to the names of actions that exist and can run, so it can't invent one. It is also trained with the action addresses as new tokens, learning from the task-and-plan pairs ilm saves from every solved job, so it writes a whole plan as a short string of codes.
- Writing glue. When two actions almost fit, it writes many small adapters; each is gated and tested, and only one that passes is kept.
- Learning from search. Search with exact checking finds better plans than the model alone, and the model can then be trained on those plans: a loop that improves itself with no human labels.
Why it could matter
- Agents get cheaper and faster with use, because solved work turns into code.
- Picking an action is designed to cost the same however many actions there are.
- Every plan is proven by running it, not trusted because a model said so.
- Plans get shorter over time as common chains merge.
- Most of it runs on a laptop.
Disadvantages
- Some actions can't be practised. Actions with outside effects, like sending an email, can't be run at random, so they learn only from real runs.
- Contracts are weak for new actions. An action with only a few runs has little evidence about what it needs and makes.
- Actions belong to their environment. A library is learned against one set of tools, so it has to be adjusted for each environment. If a tool changes, say it is renamed, takes new inputs or returns something different, the actions that call it break. ilm keeps a separate library per environment and notices when results drift, but a broken action still has to be fixed or taught again.
What's next
The improvements we're working on next:
- Train the picker on solved jobs and practice runs, so the address tree alone finds the right action at any library size.
- Repair actions when tools change: spot the call that broke and rewrite only that part, checked against past runs.
- Carry experience across environments: when ilm meets a new environment or a different set of tools, construct its actions on the fly from what it learned in other scenarios and environments, instead of starting from an empty library.
References
- The Planning Limits of Latent World Models: short horizons
- Keeping JEPA World Models Plannable When Little of the Frame Moves: the inverse loss
- ToolWeaver: hierarchical codes for tools
- PRISE: BPE over action sequences
- Prospective Compression in Human Abstraction Learning
- Hindsight Supervised Learning: relabelling dreams
- Searching Latent Program Spaces: search at test time
- LFM3-1.7B


