A rigorous follow-on course on safe execution, evaluation, and architecture tradeoffs for Recursive Language Models.
Learning Outcomes
Design safer RLM execution loops
Evaluate recursive systems with explicit failure taxonomies
Choose between RLM, RAG, and long-context prompting with a defensible systems memo
Modules
Runtime Safety and Control
Move from a toy REPL to a controllable execution loop.
1.1 Threat Model for REPL-Based Agents
Goal
Shift your mental model from "can this work?" to "what can go wrong, and where?"
Threat Surfaces
The model can emit unsafe code.
The model can loop too long or recurse too aggressively.
The execution environment can expose secrets, files, or network access.
The trace can become too noisy to diagnose failures.
Humans can misread a confident but incorrect chain of actions as evidence of correctness.
Minimum Threat Model
Describe each risk with three fields:
Trigger
Blast radius
Mitigation
For an RLM system, that means being specific about what happens when the model emits code, when that code runs, and what state it can observe or mutate.
Exercise
Take your toy harness and write one sentence each for:
a confidentiality risk
an integrity risk
a cost risk
an observability risk
1.2 Sandboxing and Step Budgets
Objective
Add two controls before you add more intelligence: a policy gate and a step budget.
Why These Two First
A recursive system fails in two boring ways before it fails in interesting ones:
it runs code it should never have been allowed to run
it keeps reasoning after the marginal value of another step has collapsed
Both failures are easier to prevent than to recover from.
Design Pattern
Parse or inspect proposed code before execution.
Maintain an explicit step_count.
Stop on a hard limit, not on vibes.
Log why the loop stopped.
Lab
Use the playground to implement a simple AST-based allowlist gate. Then write down where that gate is still insufficient for production.
Code Playground
Implement should_allow(code: str) -> bool using Python AST inspection.
The policy for this exercise is intentionally simple:
allow ordinary expressions and assignments
reject all import statements
reject calls to open, exec, eval, and __import__
reject attribute access to system and popen
This is not a full sandbox. It is a first-pass policy gate.
1.3 Control Plane Checklist
Control Plane Checklist
If you had to explain your runtime to another engineer in one screen, what knobs would you show them?
Baseline Controls
maximum recursive depth
maximum total steps
per-step timeout
executor policy version
allowed tools
allowed filesystem scope
network policy
trace retention
cost ceiling
Checkpoint
Write a short checklist for your own harness with:
Which control exists now
Which control is missing
Which missing control is the next highest leverage
Evaluation and Observability
Make recursive behavior measurable instead of anecdotal.
2.1 Benchmark Design for Long-Context Workloads
Objective
Build evaluation tasks that actually stress the reason you would choose an RLM.
Bad Benchmarks
Bad benchmarks reward generic summarization, short-context guessing, or superficial retrieval. They do not force deliberate inspection.
Better Benchmark Families
multi-hop extraction across distant sections
codebase questions that require walking multiple files
contradiction detection in long documents
timeline reconstruction from scattered evidence
constrained synthesis where intermediate state matters
Exercise
Draft three benchmark tasks of your own. For each one, write:
what makes the context hard
why naive prompting is likely to fail
what evidence would tell you the RLM actually helped
2.2 Failure Taxonomy and Trace Review
Why Taxonomy Matters
If every miss is labeled "hallucination," you do not have an evaluation program. You have a complaint.
A Practical Taxonomy
omission: the system failed to surface relevant evidence
wrong synthesis: the evidence was found but combined incorrectly
premature stop: the system answered before enough inspection
over-recursion: the system kept going without improving the answer
unsafe action: the model attempted a prohibited operation
trace opacity: the logs do not explain the behavior well enough to debug it
Review Exercise
Take one failed run and label it using exactly one primary failure mode and one contributing factor. That discipline forces sharper fixes.
2.3 Instrumentation Lab
Lab Prompt
Instrument your toy harness so every step records: