
You can build your own large language model (LLM) from scratch in about 10 months of part-time study, and the core of it runs on a free Google Colab GPU. ChatGPT, Llama and Gemini all rest on the same few ideas: the Transformer, tokenization, good data and a lot of training. Learn those ideas by building them yourself, and a home-grown LLM stops being a mystery.
This roadmap takes you from basic math to a deployed model in 9 phases. Each phase lists what to learn, the best free resources, and a milestone that tells you when you're ready to move on. It assumes you already know Python.
| 9 phases | ~42 weeks | ₹0 to start | 10 hrs/week |
| math → deployed model | 8–12 months part-time | phases 1–4 run on free Colab | the pace this plan assumes |
Each coloured block is one month (M1 = month 1). Phases overlap a little where one ends mid-month.
| Phase | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | M9 | M10 | M11 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1. Math | |||||||||||
| 2. Deep learning | |||||||||||
| 3. Transformer | |||||||||||
| 4. Tokenization | |||||||||||
| 5. Data | |||||||||||
| 6. Pretraining | |||||||||||
| 7. Fine-tuning | |||||||||||
| 8. Evaluation | |||||||||||
| 9. Deployment |
Yes, if you pick the right size. A small model of 100 million to 1 billion parameters, trained on a focused dataset, is within reach of one person with a modest cloud GPU budget. A GPT-4-class model is not: it needs thousands of GPUs, a large team and hundreds of crores of rupees.
| Model size | Who can build it | Rough compute |
|---|---|---|
| 10M–50M | Anyone, on a laptop or free Colab | Hours |
| 100M–1B | One person with a cloud GPU budget | Days to weeks on a few GPUs |
| GPT-4 class | Large labs only | Thousands of GPUs for months |
So the goal of this roadmap is simple: understand every piece by building it small, then scale up to the biggest model your budget allows.
Phase 1 ⏱ Weeks 1–4 💰 Free
You don't need a math degree. You need just enough to read papers and debug training.
The two formulas you'll meet in every LLM. Softmax turns raw scores into probabilities:
$$\mathrm{softmax}(z_i) = \frac{e^{z_i}}{\sum_j e^{z_j}}$$
Cross-entropy loss is small when the model gives the correct next token a high probability:
$$\mathcal{L} = -\log p(\text{correct token})$$
Try it yourself in NumPy:
import numpy as np
def softmax(z):
e = np.exp(z - z.max()) # subtract max for numerical stability
return e / e.sum()
def cross_entropy(probs, target):
return -np.log(probs[target])
logits = np.array([2.0, 1.0, 0.1]) # scores for 3 possible next tokens
p = softmax(logits)
print(p) # [0.659 0.242 0.099]
print(cross_entropy(p, 0)) # 0.417 (low loss: token 0 was likely)🎯 Milestone: you can code softmax and cross-entropy in NumPy and explain what they do.
Phase 2 ⏱ Weeks 5–10 💰 Free
nn.Module, optimizers, DataLoaders and running on a GPU. You'll use it for everything that follows. The official Learn the Basics tutorial is the best start.
🎯 Milestone: you've rebuilt micrograd from memory and trained a small network that you deliberately overfit, then fixed.
Phase 3 ⏱ Weeks 11–14 💰 Free
The Transformer is the heart of every modern LLM. Here is how text flows through it:
| Text | → | Tokenizer | → | Embeddings | → | Transformer blocks × N | → | Next-token probabilities |
The core equation of the whole architecture, scaled dot-product attention:
$$\mathrm{Attention}(Q,K,V) = \mathrm{softmax}\left(\frac{QK^\top}{\sqrt{d_k}}\right)V$$

🎯 Milestone: you've built a GPT from scratch and trained it on a small text dataset, such as Shakespeare or a few Hindi books, on one GPU. Karpathy's video above and his nanoGPT repository walk you through exactly this.
Phase 4 ⏱ Weeks 15–16 💰 Free
tokenizers or SentencePiece.
🎯 Milestone: you've trained a tokenizer on Hindi and English text and measured how many fewer tokens it uses per Hindi word than GPT-2's tokenizer.
Phase 5 ⏱ Weeks 17–21 💰 Low
At small scale, data quality matters more than model size.
datasets and datatrove process data at scale.$$\text{training tokens} \approx 20 \times \text{parameters}$$
| Model size | Tokens needed (≈ 20×) |
|---|---|
| 124M parameters | ≈ 2.5 billion |
| 350M parameters | ≈ 7 billion |
| 500M parameters | ≈ 10 billion |
| 1B parameters | ≈ 20 billion |
🎯 Milestone: a cleaned, tokenized dataset sharded into training files.
Phase 6 ⏱ Weeks 22–29 💰 GPU budget
💡 Tip: set a hard spending limit with your GPU provider before you start, and save checkpoints often so a crash never costs you more than an hour of training.
🎯 Milestone: you've pretrained a 100M–500M parameter base model on your own data. Karpathy's nanochat repository shows the full pipeline, from tokenizer to chat interface, for a small ChatGPT-style model at a cost of a few hundred dollars.
Phase 7 ⏱ Weeks 30–35 💰 Low to moderate
A pretrained base model only continues text. This phase turns it into an assistant.
| Base model | → SFT → | Instruction model | → DPO → | Helpful assistant |
TRL library implements both.🎯 Milestone: your model follows instructions, and testers prefer its answers after DPO.
Phase 8 ⏱ Weeks 36–38 💰 Low
lm-evaluation-harness. For Indian languages, add IndicXTREME and similar benchmarks.Perplexity is just the exponential of the average loss, so lower is better:
$$\mathrm{PPL} = e^{\bar{\mathcal{L}}}$$
🎯 Milestone: scores logged for every model you've trained, and a clear answer to "is it good enough to ship?"
Phase 9 ⏱ Weeks 39–42 💰 Low
🎯 Milestone: real users are chatting with your model, and you're collecting their feedback.
At about 10 hours a week, the full roadmap takes 8–12 months.
| Phases | Time | Approximate cost |
|---|---|---|
| 1–4: Math, deep learning, Transformer, tokenization | 16 weeks | Free (free resources + Google Colab) |
| 5: Data | 5 weeks | Low (storage and CPU time) |
| 6: Pretraining | 8 weeks | A few thousand to ₹2 lakh in GPU time, depending on model size |
| 7–9: Fine-tuning, evaluation, deployment | 13 weeks | Low to moderate (a single GPU) |
Don't try to beat ChatGPT at everything. Pick a narrow area where you have an edge: Hindi-medium education, board-exam maths and science, interview preparation, or a regional language that big models handle poorly. High-quality data from your own field is what gives a small model its advantage.
Many successful teams also take a hybrid approach. They learn by building small models from scratch, then fine-tune a strong open model such as Llama, Qwen or Gemma for the actual product, because that gives much better quality per rupee spent.
| Train from scratch | Fine-tune an open model | |
|---|---|---|
| Best for | Learning how LLMs really work | Shipping a product |
| Cost | Higher (pretraining GPU time) | Lower (one GPU, LoRA/QLoRA) |
| Quality per rupee | Lower | Much higher |
| Control | Full: your tokenizer, your data | Limited by the base model |
👉 Watch Karpathy's Let's build GPT: from scratch, in code, spelled out and train the model yourself on a free Colab GPU. Once it runs, you'll understand the core of every LLM. The rest of this roadmap is making it bigger and better.
Found this roadmap useful? Bookmark codingbattle.in for more guides on DSA, machine learning and placement preparation, and share this post with a friend who wants to build in AI.
You can learn phases 1–4 on a laptop and free Google Colab GPUs. Pretraining a useful model needs rented cloud GPUs, but only for a few weeks.
A 100M–500M parameter model costs from a few thousand rupees to about ₹2 lakh in GPU time, depending on its size and how much data you train on.
No. Basic linear algebra, the chain rule from calculus and basic probability are enough to start.
Python. Almost all LLM work uses Python and PyTorch.
Train from scratch to learn how LLMs work. For a product, fine-tuning an open model like Llama or Qwen usually gives better results for less money.
Yes. Start with a custom tokenizer and Indian-language datasets from AI4Bharat. It's one of the best opportunities for independent builders in India.
Comments