Going unreasonable with repo history insights.
Some time ago, I ran the repo-arch tooling (delivers repo git insights quickly) on a 47-commit smaller-scale repo. It worked. So the obvious next step was to try it on something real.
Target: Pi Coding Agent — ~4,100 commits, active monorepo, harness people are actually building with.
The outcome at that scale:
- 4,089 commits mined and indexed
- Hybrid BM25 (keyword search) + embedding retrieval over the full history
- 200 teacher targets generated with a 7B model (much better context quality) on Modal (total spend: under $1)
- 1.5B Qwen2.5-Coder LoRA adapter trained with MLX, using teacher targets from the 7B
Results on the eval: 35/45 answers with correct package-specific references, zero deflections, subsecond time-to-first-token, quick generation because of a small local runtime model.
Being completely honest, the first two LoRA attempts failed completely. Both produced useless/repetitive nonsense. Obvious fix — get retrieval in the chain. Pulling the right commit facts at inference time was what made the answers grounded. The adapter learned to synthesize; retrieval supplied the truth.
One extra reality check: the fused retrieval (cards/commits history -> model synthesis) baseline slightly beat the final adapter head-to-head - mainly on the cases where exact knowledge is required. So this isn’t “fine-tuning replaces retrieval.” It’s “retrieval plus a small adapter makes a practical repo-native assistant.”
On Modal: raw Function interface was a good fit — flexible, warm-container reuse, easy local orchestration. API surface is moving fast though (a few renames, lookup method changes, batch ID mapping issues), but nothing that blocked progress.
The architecture that came out of this:
- 7B on Modal → teacher only (cheap, one-time distillation)
- 1.5B + hybrid retrieval locally → fast, private, always-on
So yeah - it did not work in the way I imagined (pure LoRA without retrieval was a disaster 😂). The outcome is more interesting than I planned.
Experiment PR: https://github.com/fiale-plus/pi/pull/1
Tool: https://github.com/fiale-plus/repo-arch
#LoRA #MLX #Modal #OpenSource #LocalAI
