Sutra
Teaching a small local LLM a brand new language
Created on 24th October 2026
•
Sutra
Teaching a small local LLM a brand new language
The problem Sutra solves
Small local models are useless when there is no training data for a task, like a company's own internal language, a rare config format or custom rules. You can ask a big model to write examples, but you cannot tell which of them are correct, and if you train on wrong examples, the small model learns the mistakes too.
During this hackathon I made Sutra, a tiny Haskell-like language. Since it is brand new, there is zero training data for it anywhere. So the question is: how do you teach a small local model a language that has no data?
My answer: let one program decide what is correct. I wrote an interpreter for Sutra in Elm that runs a program one small step at a time, and that one interpreter does six jobs:
- Playground: you can watch every step. The part that changed is shown in yellow, and when map, filter or fold runs, the list is drawn as boxes with the current box lit. It works offline in any browser.
- Data filter: a 7B model on SGLang writes programs, and the interpreter keeps only the ones that pass their tests.
- Repair teacher: when a program fails, the exact error goes back to the 7B model so it can fix it.
- Ranker: CuratorKIT keeps the checked programs, removes duplicates and prefers the ones that finish in fewer steps.
- Grader: AlignTune trains a 1.5B model on checked data and on raw data (same size, same tasks), SGLang serves both, and AuditKIT scores them with the interpreter on 39 tasks the model never saw.
- Test-time judge: from 10 answers by the small model, it picks one, using only the example given in the prompt.
None of these ideas is new on its own. Putting all six on one interpreter is what makes a zero-data language trainable.
Results (39 unseen tasks, 20 tries each):
- Base 1.5B model: 7.9%. Trained on raw data: 45.3%. Trained on checked data: 53.3%.
- Checked beats raw by +8.1 points (95% CI [+2.8, +13.2]). It is better on 24 tasks, raw on 8.
- The small checked model is about as good as its 7B teacher on the tasks both answered (49.2% vs 43.1%, the difference is not significant).
- With 10 tries and the interpreter picking the answer, it reaches 80.0%, without using any hidden test.
- A 0.5B model shows the same pattern (1.0%, 30.1%, 35.8%, and 73.5% with 10 tries).
In the Model answers tab you can pick any test task, see what each model wrote, and run it step by step.
The same idea works anywhere an answer can be checked by a program: DSLs, config files, SQL, spreadsheet formulas.
Code, data, all run outputs and the trained adapters: https://github.com/akshatodiya/sutra
Challenges I ran into
- SGLang did not run on free T4 GPUs. New SGLang versions have no kernels for the T4 (sm_75) and crashed with
no kernel image is available. I found where SGLang picks its kernels (CustomOp) and made it use the plain PyTorch path (forward_native) with a 3-line patch on SGLang 0.5.4, plus the Triton attention backend. - A silent bug between two toolkits. My trained model was good in Transformers (48/88 correct) but gave half-garbage in SGLang (1/220). AlignTune's merger saves
config.jsonin the Transformers 5 format, and SGLang's older Transformers could not findrope_theta, so it quietly used 10,000 instead of 1,000,000. Copying the base model's config back fixed it. - Training did less than I asked. AlignTune stopped after 10 steps unless
max_steps=-1was set, and installing it pulled in vLLM, xformers and PyICU. I tested training on a tiny model on my laptop first and installed only what SFT needs. - SGLang under load. Asking for many samples at once (
n > 1) crashed the scheduler, and sorting the full vocabulary ran out of GPU memory. One request per sample and setting the sampling values myself fixed both. - Keeping the evaluation honest. A review found that 4 tests per task let some wrong programs pass, one test task was a copy of a training task, and raw and checked data had a different mix of tasks. I added edge-case tests (empty lists, negative numbers), removed the copy, matched the task mix exactly, and report intervals that resample whole tasks.
- Free GPU quota only. Everything ran on Kaggle's free 2xT4, so every job was first tried on my laptop against a fake server before I pushed it.
Tracks Applied (3)
Open Track - Development
Functional Programming Track
FP Launchpad
Local LLM Track
RadixArk
