DEV Community

Sudhanshu Shukla
Sudhanshu Shukla

Posted on

Release Announcement

Cloud coding assistants send your code to someone else's server. I wanted completions that never leave my laptop, so I built CodeMind. 🧠

CodeMind is a 1.5B-parameter fill-in-the-middle code model for Python, Java, JavaScript and TypeScript. It reads the code before and after your cursor and writes the missing part, offline, on a consumer-grade GPU.

How it was trained:

🔹 Stage 1, SFT: full fine-tuning of Qwen2.5-Coder-1.5B on 2 million FIM examples from permissively licensed code (The Stack Dedup), with hybrid sliding-window attention and a sparse mixture of adapter experts. It ran on a Cloud TPU v6e-8 with PyTorch/XLA FSDP: 4.6 hours, held-out perplexity 10.7.

🔹 Stage 2, RLHF with DPO, rewarded by real unit tests: the model wrote 8 solutions per problem, every one was compiled and run, and passing vs failing code became 402 preference pairs. No reward model, no human labels: the tests decide.

📊 Result: on held-out pairs, CodeMind now prefers the passing solution 81% of the time (chance is 50%). That's a ranking signal, not pass@1 yet. A full before-and-after benchmark is next.

🛠️ Along the way I fixed five PyTorch/XLA traps: generate() recompiling every token, an Accelerate deadlock on multi-chip hosts, bf16 silently downcasting an fp32 policy, gradient checkpointing crashing, and gradient accumulation becoming one giant graph.

🚀 What's live today:
• Model weights (fp32) on Hugging Face: huggingface.co/sudhanshu42844/codemind-1.5b-fp32
• Code, design docs (HLD, LLD, flow diagrams) and a VS Code extension that runs CodeMind locally: github.com/su394611-del/Code-Mind
• Results and the RLHF flow: su394611-del.github.io/codemind

If you run local models in your editor, I'd love your feedback. What would make you switch from a cloud assistant?

MachineLearning #LLM #GenAI #RLHF #DPO #CodeGeneration #OpenSource #VSCode #TPU #PyTorch #PrivacyByDesign

Top comments (1)

Collapse
 
jan_sytze profile image
Jan Sytze Heegstra •

Using real unit tests as the reward, with no human labels, is a clean idea. To your question: the first thing that would make someone switch is how long it takes from installing the extension to the first useful completion. Have you watched anyone else set up CodeMind? Extensions can be listed on testmybuild.app, the site I run where builders test each other's work.