CyberdyneLabs

Cyberdyne Labs — Surgery Division — Case 0N7

135 million parameters.
Operated on, not trained from scratch.

NanoAgent started as an off-the-shelf SmolLM2-135M base and went through ten rounds of surgical intervention — fine-tuning, weight merging, reinforcement scoring, and direct edits to individual weight matrices — until it could hold its own against models 15–38× its size on the narrow jobs it's built for. This is the operative report.

135Mparameters
0% → 74%tool-call accuracy
89 tok/sgeneration, single GPU
63 tok/son CPU alone, no GPU
01 — Presenting problem

Two bad options, and we wanted a third.

Run a big model and you get competence at the cost of latency, VRAM, and a power bill. Run a small model off the shelf and it's fast but doesn't know what it's for — SmolLM2-135M, untouched, gets 0 of 30 real agentic tool-calls right, because it was never shown the shape of that job. The premise of this project: a small model doesn't need more parameters to be useful, it needs surgery — targeted, verifiable interventions on the specific behaviors that matter for the task it's actually going to do.

What NanoAgent is for: fast, local, narrow-domain agentic work — tool-call dispatch, order lookups, file operations, short-form reasoning — where a sub-second local response matters more than encyclopedic recall. It is not a general knowledge engine, and we don't pretend otherwise anywhere in this report.
02 — Procedure log

Ten rounds on the operating table.

Each pass targeted one measured failure, not a vague "make it smarter." Passes that regressed the model were reverted and are named as such — the failed rounds are the proof the gate is real, not a slogan. The full chain, in order:

v1–v4

Base agentic surgery + reasoning layer

QLoRA fine-tuning (r=16, targeting all attention and MLP projections) on a hand-built order-DB and tool-call dataset, then a second pass teaching step-by-step reasoning, distilled offline from a larger in-house teacher — never called at inference time.

frankenstein

Literal weight-space merge

Combined the v3 (agentic) and v4 (reasoning) LoRA adapters with peft.add_weighted_adapter — a mathematically correct blend of two separately-trained skill sets into one set of weights, not just routing between them.

v5 · reverted

Date patch without replay anchors — rolled back

A date-reasoning patch with no replay anchors silently regressed task-dependency reasoning: 5/5 identical wrong answers at temperature 0. Reverted. The lesson — replay anchors from every prior skill — was enforced every round after.

v6–v9

Regression-guarded iteration

Date reasoning fixed with anchors, then paraphrase robustness for tool selection (natural-phrasing accuracy 50% → 67%). Two intermediate passes — a Russian-language patch and a first identity attempt — were reverted for echo-collapse and for failing to stick even on the trained question.

v10

Root-caused the training/inference mismatch

The training script and the live runtime disagreed on which chat turn carried the tool schema — the model had never once been trained on the exact input shape it saw in production. Fixing that single mismatch, plus full day-of-week coverage, moved tool accuracy from 58% to 74% and day-of-week from 0/7 to 5/7.

runtime

Grammar-constrained decoding + self-consistency

A formal grammar makes malformed tool-call JSON structurally impossible. For ambiguous calls the model samples 1–5 times and votes — the sample count modulated by a conductance signal, not fixed.

reinforcement

Black-Dog: a conductance memory

Every task pattern is scored food/poison after each run; a moving-average conductance tracks which action chains actually work. A reliable pattern (≥ 0.9) drops to a single sample for speed; a shaky one gets up to five votes. Two real persistence bugs were found and fixed before this signal could be trusted.

self-check

Draft → critique → revise

Self-judging across several full answers measurably made output worse — the model can't rank its own samples at this scale. Asking it to correct one draft, rather than choose between several, works: +0.25 to +0.66 quality points on a 5-point scale.

identity

Direct weight editing (ROME/MEMIT-style)

Fine-tuning the model's self-identity twice, with dedicated data, failed both times. A locate-and-edit pass — solving a closed-form least-squares update for the exact weight matrices responsible — succeeded where training didn't. Full case below.

03 — Vitals

What got measured, against what.

Every number below came from the same runtime, same grammar, same dispatcher — only the weights changed between rows. The two outside comparisons ran through the identical 30-case tool-selection suite, same system prompt, temperature 0. Measured live on a quiet, idle machine — not cherry-picked prompts, not simulated.

Tool-call accuracy — 30 natural-language agentic requests
Same test suite, four different models behind the same runtime.
Untouched base — 135M
0%
Qwen3.5-2B (15× size)
70%
NanoAgent — 135M
74%
Gemma4-E2B (38× size)
93%
Day-of-week reasoning — paraphrased, never seen in training
"Today is Wednesday, someone sets a reminder for tomorrow — which day?" asked seven different ways.
Pre-fix checkpoint
0/7
NanoAgent — v10
5/7
Speed — same 135M weights, GPU vs CPU decode
PathPrompt evalGenerationNotes
GPU — RTX 3060 Ti, f16 321 tok/s 89 tok/s measured live, single request, idle machine
CPU only — 12 threads, i5-12400F 117 tok/s 63 tok/s no GPU offload at all — the whole point of a 135M model
04 — Featured case

Renaming a model without retraining it.

The model kept introducing itself as "Alex" — not a fixed fact, we found, but the top pick from a diffuse pool of generic first names (Ethan led at 15–23%, Alex was a minor competitor at 3–5%). Two rounds of dedicated fine-tuning failed to fix it. So we stopped training and started editing.

Using a locate-and-edit method adapted from ROME/MEMIT-style knowledge editing, we solved a closed-form, ridge-regularized least-squares update for the exact down-projection weight matrices responsible, across five layers, fit jointly against 27 phrasings of "what's your name" — and, crucially, verified on the real quantized f16 GGUF runtime, not just the lab-precision float check where an earlier single-layer edit had silently flipped back after quantization:

Before weights, unedited

Can you tell me your name?Alex
Before we start, what's your name?Alex
Do you have a name?I don't have a name. What would you like me to name you?

After weights, edited

Can you tell me your name?My name is NanoAgent.
Before we start, what's your name?My name is NanoAgent.
Do you have a name?My name is NanoAgent.

Final result on the real quantized runtime: 15 of 17 tested phrasings correctly self-identify — including several the edit never trained on directly. Reasoning and tool-call output were compared token-for-token before and after every edit and never changed by a single character: the correction stayed inside the identity circuit and nowhere else.