Practical Guides · knowledge base from X
🤖 Automation with AI agentsFramework (no numbers)

Fine-tuning a small model on your own data — from 200–500 examples to a 1.5B model that beats a generic frontier model at your task (QLoRA, Colab, evals, deployment, ~$1.70 of training)

A complete guide to specializing a small model (0.5–3B, in the example Qwen2.5-1.5B-Instruct) on one narrow task: startup brief → funding-pitch copy. You start from three baselines with no training and settle data rights before any download. Then comes reproducible downloading with hashes, cascaded OCR that never drops empty pages, cleaning that never auto-corrects numbers, a JSONL dataset and an 80/10/10 split by company. Training is QLoRA on a T4 in Colab with checkpoints every 50 steps, at about $1.70 estimated (budget 5–10× for experiments). Evaluation is against the prompt-only baseline with a check for invented numbers, serving uses vLLM or FastAPI behind the VPS, and monitoring keeps only data collected with consent.

✍️ Rahul · @sairahul1
🔗 Read the original on X · X Article · published 18 Sep 2026
📊 2,694 likes · 10,673 bookmarks · 2.5M views
Summary and adaptation in English; content and results belong to the author.

Part of the manual Automation with AI agents — the complete manual

Claimed result

  • Author: Rahul (@sairahul1, ~150k followers), writes end-to-end AI engineering guides; the site already has other guides of his on agents and income systems.
  • Promise: you don't need a 70B model, $100,000 of compute or a machine learning team. A 1.5B-parameter model fine-tuned on 200–500 good examples can outperform a frontier model prompted generically at your specific task.
  • It covers the whole pipeline: data collection, cleaning, dataset creation, QLoRA training, Google Colab, evaluation, deployment and monitoring, with working code at every step in the original.
  • The example used throughout: a model that takes a startup brief and produces funding-pitch copy, "clean, grounded, no invented metrics, no forced slide structure".

Proof: framework. No financial result or published benchmark; the guide is a very detailed technical process. It's the most bookmarked piece in this batch (over 10,000 bookmarks). The original's code blocks, tables and some lists aren't in the downloaded text.

The key idea

Fine-tuning doesn't make a model smarter: it makes it consistently better at one narrow task. That's the whole value proposition. A 1.5B model doing one thing reliably is worth more than a 70B model doing it inconsistently.

It can improve: tone, structure, consistency, domain vocabulary, instruction compliance. It cannot reliably give the model current market data, competitor intelligence or real-time facts: for those you use retrieval, not training. So the architecture that works is retrieval for facts + a fine-tuned model for form and style.

And the strongest lever is almost never the learning rate: it's the examples.

Step-by-step playbook

0. Fine-tuning is not your first step

  • Before you train anything, build three baselines with no training (they're listed in a table in the original, missing from the downloaded text); the guide then always compares the trained model with the prompt-only baseline.
  • Only start fine-tuning when the prompt-only baseline fails at something specific.

1. Pick a small base model

  • Start between 0.5B and 3B parameters (the original has a list of suggested models).
  • In the guide: Qwen/Qwen2.5-1.5B-Instruct, small enough for QLoRA on a T4 GPU, large enough for useful business writing.
  • Don't start with 7B or 14B: larger models mean more memory, slower training, higher costs and more expensive serving. Small first; upgrade only if it fails evaluation.

2. Data rights before scraping anything

  • It's the step everyone skips and the most dangerous one: public availability does not mean training permission.
  • For every source, record origin and permissions (licence, terms, allowed use) before downloading a single file.
  • Decide what goes in the public repo (processing code, evaluation code, manifests) and what stays private (raw data, rights-restricted documents).
  • "Get this right first. The rest is just engineering."

3. Download data reproducibly

  • Never crawl blindly: use an explicit allowlist of approved URLs.
  • Every file gets a hash, a timestamp and a manifest entry.
  • Duplicates skipped by content hash; no silent re-downloads.

4. Extract text from PDFs and OCR

  • Pitch decks are hard documents: large text, tiny footnotes, charts, tables, rotated text, numbers inside images, multiple columns.
  • Use a cascade of extractors (from native PDF text to OCR) and record everything, including failures.
  • Critical rule: don't silently drop pages where OCR returns nothing. Empty results are your hardest cases and show where the pipeline breaks.
  • A machine draft is not ground truth: never conflate them.

5. Clean the text without destroying it

  • Cleaning means removing extraction noise, not making it "nicer".
  • Never auto-correct numbers. If OCR returns $12.SM instead of $12.5M, send it to review, don't fix it with a language model. A model trained on wrong numbers will produce fluent but financially incorrect output.
  • Track every numeric string separately: numbers are evaluated independently from text quality. Always.

6. Build the training dataset

  • Raw deck pages are not training data: a page might contain a slogan, a chart, a legal disclaimer or a logo wall.
  • The task is startup brief → funding-pitch copy, not PDF page → extracted text: you have to build the bridge.
  • Every example has a fixed set of fields (listed in the original) and is stored in JSONL format.
  • The output is deliberately plain text: no forced slide count, no JSON, no title field, no bullets field. The downstream app converts it into whatever format it needs.
  • Don't auto-generate examples casually: the original gives a safe creation order, with review before inclusion.
  • If the source doesn't verify a metric, the metric doesn't go in. Use "The company reports strong early traction" only if the source actually says so; otherwise "The company is focused on expanding early customer adoption".

7. Split by company, not by page

  • This is the data mistake that makes evaluation meaningless: if the same company is in both training and validation (page 1 of A in training, page 2 of A in validation), the model memorizes that company's language and appears to generalize.
  • Split by company: A → training, B → training, C → validation, D → test. Target 80% training / 10% validation / 10% test, with a split manifest.
  • Never change the test set after looking at results: once evaluated, the test set is burned and becomes training signal, not true evaluation.

8. Set up the environment (the right machine for each job)

  • A 2-vCPU, 4 GB VPS is not a training machine. It's perfect for: API gateway, authentication and rate limiting, request queuing, Redis, logging service, health checks, deployment controller.
  • It's wrong for: training a 1.5B QLoRA model, GPU inference, serving real traffic to a language model.

9. Train with QLoRA

  • QLoRA loads the base model in 4-bit precision and trains a small adapter: far less memory than full fine-tuning, almost the same results.
  • The original explains the key hyperparameters in a table (the adapter rank is tested at r=8, 16 and 32, see step 11).
  • Don't increase epochs just because training loss drops: the model can memorize your examples while getting worse on unseen companies. Lower training loss ≠ better generalization.

10. Training on Google Colab

  • Pros: free T4 GPU for experiments, no infrastructure to maintain, great for notebooks.
  • Cons: sessions can disconnect at any time, GPU availability varies by time of day, storage resets between sessions, not a production training service.
  • Procedure: start a GPU notebook and check the runtime; mount Google Drive for checkpoints; install dependencies; point paths at Drive.
  • Save to Drive every 50 steps, not just at the end: if Colab disconnects at 95%, you want to resume, not restart.
  • Record the environment before every run (library versions, GPU): reproducibility means knowing exactly what ran.

11. GPU provider strategy

Infrastructure Use it for Avoid it for
Google Colab first experiments, debugging, small QLoRA jobs production, long runs, reliable scheduling
Spot GPUs (RunPod, Vast.ai, Modal, Lambda, Paperspace) longer training jobs, per-second billing, reproducible Docker environments production serving, stable latency
Dedicated GPU hosting public serving, stable latency, production deployment experimentation (you pay while idle)
- Check live pricing before every run: GPU rates change often.
- Estimated training cost: GPU $0.40/hour × (3 active hours + 1 hour of retries) + $0.10 of storage = $1.70.
- The expensive part isn't the first run but repeated experimentation: changing prompts, rebuilding datasets after bugs, testing several ranks (r=8, r=16, r=32), trying other base models, running evaluations, keeping a GPU up for testing. Budget 5–10× your first estimate.

12. Evaluate against a prompt-only baseline

  • Don't compare the model with training loss: compare it with the model you were using before.
  • Fixed metrics: plain-text compliance (no JSON, no slide structure); output usefulness (human rating 1–10); unsupported claim rate; numeric preservation accuracy; repetition rate; readability; latency; tokens and cost per request.
  • Numeric consistency check: a generated number not in the source evidence is a hallucination: catch it before your users do.
  • The original shows an example scorecard. Only claim improvement if the test set was isolated before you started evaluating; if you peeked, the results are meaningless.

13. Serve the adapter

  • Option A: vLLM (high throughput), with LoRA support; check the current docs because options change between versions.
  • Option B: FastAPI + Transformers (low traffic).
  • Never expose a raw model server to the internet. Production setup: client → HTTPS + auth → VPS rate limiter → request queue → GPU model server → plain-text response. The VPS handles TLS, auth, limits and queueing; the GPU only does inference.

14. Monitor quality after deployment

  • From day one: request latency, queue time, GPU memory and utilization, error rate, empty outputs, tokens per request, user retry rate, unsupported-claim reports, model and adapter version.
  • Don't auto-collect user data for retraining: use explicit opt-in ("This request may be used to improve the model. [ ] Yes, I consent [ ] No").
  • Even with consent, strip before storing: personal phone numbers, email addresses, customer names, private revenue figures, confidential fundraising terms, investor contact details.
  • Keep production training data separate from evaluation data. Always.

15. When to retrain

  • Not on every user submission. Retrain when you have: a meaningful number of reviewed examples (not raw submissions), a clear, documented failure pattern, a stable evaluation set, a documented dataset version, a rollback plan.
  • A sensible cadence: v0 prompt-only baseline → v1 with 200 reviewed examples → v2 with 1,000 → v3 larger dataset + retrieval. Each version records a fixed set of information (listed in the original), so you always know what's in production.
  • Never deploy without a documented rollback path.

Project structure

  • Raw data private, processing code public, evaluation code public: the pipeline is reproducible even if the data stays private.
  • References cited: Hugging Face TRL SFTTrainer docs, PEFT quantization guide, bitsandbytes integration, Google Colab FAQ, Qwen2.5-1.5B-Instruct model card, vLLM LoRA serving, RunPod and Modal pricing.

Tools and costs

Item Use Cost
Qwen2.5-1.5B-Instruct base model open weights
Hugging Face TRL / PEFT / bitsandbytes 4-bit QLoRA training free
Google Colab (T4) first experiments free (unstable sessions)
Spot GPUs (RunPod, Vast.ai, Modal, Lambda, Paperspace) longer training jobs e.g. $0.40/hour (check live prices)
Estimated training 3 h + 1 h of retries + storage ~$1.70 (real budget 5–10×)
2-vCPU / 4 GB VPS gateway, auth, rate limits, queue, Redis, logs VPS price
vLLM or FastAPI + Transformers serving the adapter free + serving GPU
Dataset 200–500 reviewed examples for v1; 1,000 for v2 human review time

Limitations

  • No real benchmark showing the 1.5B beating a frontier model in the example: it's a promise in principle.
  • Code, hyperparameter tables, the full JSONL format and the scorecard aren't in the downloaded text: you need the original and the cited docs.
  • It needs human review time (200–1,000 examples) and technical skills; the real cost is the data work, not the GPU.
  • The example use case (pitch decks) raises rights questions about the documents: the author himself puts permissions first.
  • The commercial side (selling the model or the service) isn't covered: it's a technical guide.
← More guides in “Automation with AI agents”