Raw Gradients
01:57 AM, 14th June 2026
Middle of the 4th-semester end-sem break. Computer Networks exam still hanging over me. But the idea hit anyway, so I decided to build the project and document everything from the start.
About nbForge
It’s my experiment: an AI system that takes messy ML notebooks and converts them into working FastAPI backends. Then it keeps iterating and fixing issues until the whole thing actually runs.
Repo: https://github.com/grvwrk/nbForge
I started by sketching out the data collection plan. Wanted to be careful with the first 5–10 high-quality examples.
Spent time going through some key material:
Reading
- Transformers and LLMs by Afshine Amidi & Shervine Amidi
(Section 4.4.1 : Supervised Fine-Tuning, Section 1.3.1 : Data Splits)
Stanford Lectures
- CME295: Lecture 5 : LLM Tuning
- CS336: Lectures 13–15 (Data sources, datasets, mid/post-training)
02:54 AM, 15th June 2026
Finished reviewing the material. Gained clearer insights into where modern LLMs source their data, public datasets, copyright issues, and the lawsuits hitting major AI labs. It was a solid reminder of why licenses matter before touching any data.
Also revisited how instruction tuning and post-training approaches have evolved. Most of the concepts felt familiar. I’d like to dig deeper into the reinforcement learning side of alignment later, but the exam is too close. Taking a pause here.
04:47 AM, 18th June 2026
Data Formatting and Tokenization
Finally nailed down the data structure and tokenization approach.
Standard FLAN-style instruction tuning doesn’t fit well here. The model starts adding conversational fluff which breaks the strict, structured output we need for generating project files.
Reference: FLAN
I’m shifting to a more rigid, domain-specific format using custom special tokens to define clear boundaries:
[JUPYTER_CELL] ... [FILE_MODELS] ... [FILE_MAIN] ... [END_PROJECT]
These tokens will be added to the tokenizer vocabulary, and the model’s embeddings will be resized so they can be properly trained.
Biggest Realization
If I only train on clean, perfect Notebook → FastAPI examples during supervised fine-tuning, the self-healing system will fall apart.
The model would only know how to generate correct code. It would have no experience with errors, so when the Docker sandbox inevitably fails, it won’t know how to recover.
Teaching the Model to Self-Heal
I’m planning to embed a ReAct-style workflow directly into the SFT dataset.
Reference: ReAct
Training examples will include multiple turns:
[OBSERVATION] Traceback... [THOUGHT] The import path is incorrect... [ACTION] Updated the code...
This should teach the model to observe failures, diagnose problems, generate fixes, and retry, making it far more capable inside an automated build-and-test loop.
Looking Ahead
I also want the system to stay lightweight enough to run on regular hardware.
One path I’m considering:
- Use a 7B model as a teacher.
- Generate a strong, high-quality dataset.
- Distill it into a smaller 1B–1.5B student model.
- Quantize it for efficient local inference.
References: Knowledge Distillation, LLM Distillation Survey, LLM.int8(), Chinchilla scaling laws.
More updates soon.