Songe, a 4-Day-Old Open-Source Tool, Trains Your Local Coding Model Overnight on What Went Wrong During the Day
Songe, an Apache-2.0 project from sous-labs, proposes that a local coding model should get better at your work the more you use it, without sending anything off the machine. The repository was created on November 20, reached 470 GitHub stars and 55 forks within four days, and sits at alpha release 0.1.0a15 on PyPI. It reached the Hacker News front page on November 24.
How it works
Songe runs as a pass-through proxy on 127.0.0.1:7613. Your agent (opencode, pi or any OpenAI-compatible client) talks to Songe, which forwards requests to the model server (LM Studio, vLLM, Ollama, llama.cpp or mlx-lm) and records each exchange to SQLite.
The training signal is what happened after each model action: the tool result, the error, the test output, or your next message. The design document calls this hindsight. The argument is that a model cannot learn from its own output alone, and the only new information it ever receives is the consequence of acting.
When the agent has been quiet, Songe runs a “Dream”:
- Clean. Drop steps that carry no signal: interrupted calls, empty tool arguments, loops of identical actions.
- Review. The local model reads each step with its outcome and writes what went wrong and a reusable lesson.
- Train. The student is the model plus a LoRA adapter, seeing only the original context. The teacher is the same model shown the context plus the hindsight. The student samples its own answer, and the loss is a forward KL against the teacher, token by token. This is on-policy self-distillation, citing the OPSD and SDFT papers and Thinking Machines’ on-policy distillation work.
- Gate. The new version is fused and served only if it beats the current one on held-out conversations, with checks that tool-call validity does not drop and repetition and empty-output rates do not rise. One command rolls back a version.
There is also a cheaper “Quick Dream” that takes minutes and only adds stated preferences to the model’s instructions. Deep Dreams take an hour or more.
The training settings
The design document lists LoRA rank 64, alpha 128, learning rate 5e-6, AdamW, gradient clipping at 1 and an effective batch of 4. The batch is deliberately small: with only dozens of new steps per cycle, the OPSD paper’s batch of 32 would mean about one gradient update per cycle.
Agent contexts are never truncated. For contexts too long to backpropagate through, Songe reads the early part with no gradient and trains on the tail. The document admits this introduces bias and lists measuring gradient fidelity at 2k to 8k tokens as an open verification item.
Limits it states itself
- Hardware support is uneven. Training runs on Apple Silicon (MLX) and on NVIDIA and AMD via PyTorch, but end-to-end testing covers only Apple Silicon and NVIDIA. LM Studio on macOS and vLLM on Linux are the tested servers. Machines without a GPU serve and record but do not train. Ollama is unsupported because it removed adapter support in September.
- Small models may not use hindsight. The design cites the SDFT finding that a 3B model’s in-context learning was too weak to beat supervised fine-tuning, and tracks a
teacher_gainmetric. If that is near zero for a model, the tool is meant to say so rather than claim learning. - Fused 4-bit artefacts can lose the gain. LM Studio cannot load LoRA adapters, so each accepted version is written as a fused model folder. If quantisation erases the improvement, Songe re-fuses at higher precision when memory allows.
- No measured results yet. The README reports no benchmark showing a model improving on real work, and the roadmap lists “a stronger check before a new version is used” as in progress. The gate guards against regressions. It is not evidence of gains.
What is planned
The roadmap’s next item is reinforcement learning: the model builds a sandbox from what you work on, practises there and learns from the results. Songe currently never runs your tools and trains only on logged evidence. Further out, sous-labs sketches a local model that does more of the work under a frontier agent such as Claude, learning from that collaboration.
The repository’s “not planned” list rules out cloud training, accounts, telemetry and any sending of conversations or learned versions off the machine.
Why it matters
Fine-tuning a local model on personal usage is usually a manual job: collect data, curate it, run a trainer, evaluate by hand. Songe packages that loop around a safety gate and a scheduler that yields the moment you return. Whether a few dozen hindsight steps per night move a small model measurably is the open question, and the project has not yet published an answer.