llamago is a small Go project that starts the journey toward a llama.cpp-style runtime in Go full engine.
The first version is intentionally tiny:
- a whitespace tokenizer
- a bigram language model
- JSON model save/load
- a CLI for training, sampling, and inspection
- no external dependencies beyond the Go standard library
This gives us a working baseline for the pieces every larger inference runtime needs: tokenization, model loading, sampling, testing, and a clean CLI.
A generated demo checkpoint is already included at ./models/demo.json, so you can jump straight to inspection or sampling if you want.
Train a demo model from the included corpus:
go run ./cmd/llamago train -input ./testdata/demo.txt -output ./models/demo.json -name demoInspect the saved model:
go run ./cmd/llamago inspect -model ./models/demo.jsonGenerate a deterministic sample:
go run ./cmd/llamago sample -model ./models/demo.json -prompt "go" -steps 6 -temperature 0Expected output:
go builds reliable tools
Run the tests:
go test ./...cmd/llamago: CLI entrypointinternal/tokenizer: starter tokenizer implementationinternal/model: model training, persistence, and inspectioninternal/generate: generation loopinternal/sampler: greedy and temperature samplingdocs/roadmap.md: gap analysis and next milestones toward a fullerllama.cpp-in-Go port