✦ Inspired by GenAcademy · My Field Notes

Fine-Tuning Part 2:
The Production Protocol

You trained the model. Now what? LoRA deployment paths, RL alignment methods, synthetic data strategies, GPU cost tiers, distillation, and running your own stack with Ollama — the full playbook for what comes after training.

🔀
2 LoRA deployment paths decoded
🧠
RL methods: RLVR, RLHF & GRPO
🎓
Distillation & synthetic data
🏠
Ollama: AI that runs anywhere
Start Reading ↓ ← Part 1: The Specialist Protocol
01

After Training: Two Ways to Deploy a LoRA Adapter

You've trained your LoRA adapter — a compact set of weights that specialize your base model for a task. Before you can call it in production, you face a decision that shapes your entire serving architecture.

My field notes

Building the VocabForge pipeline end-to-end taught me that the initial training run is the smaller half of the work. Everything after — packaging it so it doesn't become a black box, choosing a deployment path that doesn't overextend you on day one, building feedback loops so the model improves rather than just repeating itself — that's where most of the decisions live. The sections below are the ones I had to figure out in practice.

The fork in the road
Do you merge the adapter into the base model, or keep them separate and load both at inference time?
The right answer depends on how many adapters you have and what your inference stack supports.
Option A — Single Adapter
🔗

Merge Into Base Model

Compute the combined weights mathematically (base + adapter = new model). Deploy this merged artifact. Every inference call hits the single combined model — no PEFT stack, no extra steps.

Same API call as any standard model No special serving stack required Zero added inference latency
One merged copy per adapter (storage cost) Can't hot-swap tasks without re-merging Platform must support merging (not all do)
OR
Option B — Multiple Adapters
📦

Keep Adapters Separate

One base model, many task-specific adapters stored independently. At inference time, load the base model and the chosen adapter together. You share one large base model across all your specializations.

Share one base model across many tasks Hot-swap adapters without copying the base Storage efficient at scale
Requires a PEFT-aware serving stack Adds latency at each inference call Not all platforms support it yet
⚠️
Platform dependency matters: Before choosing Option A, check that your inference provider supports adapter merging. Some platforms (e.g. Fireworks AI had merging arriving in Q3, Nebius had not enabled it) require the separate-adapter approach by default. Always read the docs before designing your serving architecture around either option.
02

Model Cards — Your Model's Passport

Every fine-tuned model is a new artifact with its own identity. A model card documents that identity completely — so anyone (including future you) can understand exactly what was trained, how it was trained, and what it replaced.

⚖️
Adapter Weights

The actual trained LoRA adapter weights or full fine-tuned checkpoint. The core artifact of everything you built.

🔤
Tokenizer Config

Critical. Using the wrong tokenizer at inference breaks the model silently. Document the exact tokenizer version used during training.

🏗️
Architecture Details

Which base model, which version, LoRA rank, target modules, and all hyperparameters used. Reproducibility depends on this.

📊
Eval Results

Base model performance vs fine-tuned performance on your golden dataset. The delta is why you trained.

🗓️
Training Metadata

Dataset used, training date, framework version, GPU type. Needed for debugging and for regulatory audit trails.

🔗
Stack Dependencies

Every piece of infrastructure this model depends on — vector stores, retrieval pipelines, API endpoints, memory layers.

Where to store it: Google Cloud has a Model Card Kit that feeds into a Model Registry. HuggingFace model cards are the standard for open-source releases. AWS and GCP both have model registries. The platform matters less than the habit — document before you deploy, not after something breaks.

Model Cards in the Wild

Every major lab publishes them. They are the canonical reference point for what a model is and what it was designed to do:

🤗
HuggingFace (the standard)

Every model on HuggingFace has a model card. The format — created by Google Brain researchers — is now the de facto industry standard. Meta's Llama 3, Mistral 7B, Qwen all use it. The card lives in the repo, versioned alongside the weights.

🦙
Meta — Llama 3 Model Card

One of the most detailed public examples. Covers intended use, out-of-scope uses, benchmark evals, safety red-teaming results, carbon footprint of training, and hardware specs. Often cited as the template for responsible release.

🔵
Anthropic — Claude Model Card

Published for each Claude version. Details training approach, safety evaluations, alignment properties, known limitations, and intended deployment contexts. Available at anthropic.com alongside the model release.

🟢
OpenAI — System Cards

OpenAI calls theirs "system cards" for major releases (GPT-4, DALL-E 3, Sora). The scope is broader — covers the full deployed system, not just the model weights. Same concept, different name.

🔷
Google — Gemini Model Cards

Google publishes model cards for Gemini models and maintains the open-source Model Card Toolkit on GitHub. They pioneered the formal model card concept in a 2019 paper (Mitchell et al.) that the whole industry now references.

🏢
Internal registries (enterprise)

At companies like LinkedIn, Pinterest, and Airbnb, internal ML platforms host private model registries — same idea, proprietary tooling. AWS SageMaker Model Registry and Vertex AI Model Registry are the managed equivalents teams use without building from scratch.

💡
The rollback rule: When something goes wrong in production and you need to roll back, you cannot just change an API key back. You roll back the entire stack — the model version, the retrieval pipeline pointing at it, the serving config, the prompt templates. The model card is what tells you what everything was pointing to before the incident.
03

Canary Deployments & Stack Rollback

Never replace a running model with a new version in one shot. The same principle that governs software deploys applies to model updates — and the cost of a bad ML deployment can be harder to diagnose than a bad code deploy.

  • 1%

    Canary phase — 1% of traffic

    Route a tiny slice of real production traffic to the new model version. Watch for unexpected outputs, error rates, latency changes. Compare directly against the current version side by side.

  • 5%

    Ramp phase — 5% and growing

    If 1% shows no regressions, expand the rollout. Sample across demographics, user types, and edge-case query patterns. No model improvement should degrade another part of the behavior.

  • →

    Full rollout — confirmed better

    Only after the new model demonstrably outperforms the old one on your eval metrics — and shows no regressions — do you complete the cutover.

  • ↺

    Rollback — the whole stack, not just the model

    If something goes wrong post-rollout, reverting the model version is not enough. All dependent services — retrieval layers, routing logic, prompt templates, A/B configs — must be rolled back together. This is exactly why the model card exists: it documents what all those dependencies were pointing to.

🔁
Regression testing is non-negotiable: Run the same evals you ran on your base model on your fine-tuned model, and re-run them after every subsequent update. Looking at fine-tuning loss going down is not sufficient — you can fix one behavior and silently break another. Treat every model version as a separate artifact deserving its own full eval suite.
04

Reinforcement Learning — The Alignment Engine

Core concept
SFT teaches the model what good looks like. RL teaches the model to actively optimize for it.
With SFT you show examples. With RL you give the model a scoring function and let it figure out how to maximize it — learning from trial, feedback, and iteration.

Reinforcement Learning was built for games — environments where an agent can take actions, observe outcomes, and receive rewards. The maze is the classic example: go left, right, forward, or back; get a reward for moving toward the goal; take a penalty for wrong turns. Collect all those (action, state, reward) tuples and use them to update the agent's weights.

The same loop maps directly to LLM fine-tuning. The "maze" becomes a task. The "actions" become response choices. The "rewards" come from a grader.

📋
Prompt Library
Input queries
→
🧠
LLM
5 responses each
→
⚖️
Grader / Judge
Reward function
→
🎯
Score
+reward / penalty
→
🔄
Update Weights
GRPO / PPO
↺

Because LLMs are non-deterministic, you generate multiple responses for each prompt. The grader scores each one. Responses that score high push the model's weights in that direction; low-scoring responses push it away. Repeat across thousands of prompts and iterations. The model learns not just what you showed it, but how to generate the kind of output your grader rewards.

Why multiple responses? A single attempt doesn't tell you much. Generating five responses to the same prompt reveals the model's probability distribution — some approaches work better than others, and the reward signal gives the model contrast to learn from.

📌
GRPO vs PPO: PPO (Proximal Policy Optimization) was the dominant algorithm for RL fine-tuning. GRPO (Group Relative Policy Optimization) is the current industry standard — it's what DeepSeek-R1 used, and what most practitioners mean today when they say "RL fine-tuning." Both achieve the weight update step, but GRPO is more efficient for LLMs.
05

How Rewards Work: RLVR vs RLHF

The grader is the heart of RL fine-tuning. Who builds it — and how — defines two distinct approaches. Choose based on whether your task is quantifiable.

Reinforcement Learning with Verifiable Rewards

✓ Fully automated ✓ Scalable & cheap Best for quantifiable tasks

You write a deterministic Python function that scores every model output. No humans in the loop at all. The function is the judge: it takes the model's response, checks it against verifiable criteria, and returns a number.

Works best when the task has a right answer — math problems, code generation, SQL queries, classification tasks. The score can be binary (correct/wrong = 1/0) or nuanced:

Math grader — nuanced scoring
7/10 steps correct, wrong final answer
0.7
All steps + correct final answer
1.0
Wrong steps, wrong answer
0.0

By rewarding correct intermediate reasoning steps — not just the final answer — you train the model to think through problems, not just guess the output. This is how reasoning models are built. The more nuanced the grader, the faster and better the model learns.

Reinforcement Learning from Human Feedback

Human annotators ✗ Expensive to scale ✓ Qualitative tasks

When the task has no deterministic right answer — writing, summarization, creative content, tone matching — you can't write a function that scores it. You need humans.

How RLHF works: Humans rank or rate multiple model responses. That ranking data trains a separate model — called a reward model — to approximate human preferences. You then use that reward model as the grader in the RL loop.

Key distinction from DPO: DPO (Direct Preference Optimization) also uses good/bad labels — but there is no separate reward model. You label responses as preferred/rejected and directly fine-tune the main LLM on those labels. It's a supervised approach. RLHF builds an intermediary model first; DPO skips that step.

DPO is cheaper and simpler. RLHF is more expensive but gives a reusable reward model that can be continuously updated with new human ratings without retraining from scratch.

Knowledge Check
You're training a model to fix broken SQL queries. A test database exists — you can run any SQL query against it and see if it executes correctly. You also want to reward partial credit for queries that run but return the wrong result. Which reward approach fits?
👤
RLHF — hire SQL experts to rank the model's query rewrites weekly
🎯
RLVR — write a grader that runs each query and assigns partial credit based on execution outcome
📝
DPO — label a dataset of correct vs incorrect SQL examples as preferred/rejected
🔤
SFT only — just show the model correct SQL rewrites without a reward function
06

The Method Ladder — Always SFT Before RL

The cardinal rule
You never jump from a base model to RL. The ladder must be climbed in order.
Skipping SFT to go straight to RL produces unstable, unpredictable training. Each step is a prerequisite for the next.
1
Prompt Engineering

System prompts, few-shot examples, format rules. Free and reversible. Always the first move.

→
2
Context Engineering

RAG, memory layers, tool descriptions, structured injection. Still no weight changes.

→
3
Supervised Fine-Tuning

Input→output pairs. Improves response quality on your eval metric. More control, visible progress.

→
4
RL Fine-Tuning

Alignment and behavior improvements on top of SFT. Cutting-edge, complex, high-expertise.

What each step delivers: SFT improves quality metrics — your model gets better at producing the kind of output your dataset shows. RL gives alignment and behavioral improvements — the model learns to reason, follow complex constraints, and generalize the goal rather than just imitate examples.

Who actually uses RL? As of today, RL fine-tuning is only running at companies with cutting-edge, niche product needs and specialized ML teams — Cursor for code generation, Notion for structured editing, similar products. It requires deep expertise, significant compute, and a well-maintained SFT base to build on top of. Most teams stop at step 3.

✅
RAG and prompts still work on top of fine-tuning: Completing the fine-tuning ladder doesn't mean replacing earlier techniques. A fine-tuned model can still use RAG for live data retrieval, and prompt engineering still shapes its outputs. Fine-tuning is additive — it changes the base behavior, which the rest of your stack layers on top of.
07

Synthetic Data — Teaching Without Enough Real Examples

Fine-tuning requires data. But real-world, cleanly labeled data is often scarce. Synthetic data — generated by AI — fills the gap. It's not a perfect substitute, but it's a standard part of the practitioner toolkit.

📈
Expand the Dataset

You have 100 real examples but need 10,000. Use AI to generate variations: rephrase the prompt, add synonyms, change domain context, simulate edge cases. This is exactly what image augmentation (flip, rotate, brightness) did for vision models — applied to text.

🧹
Clean Messy Data

Real-world data is noisy — inconsistent formatting, typos, missing structure. Use a strong model to clean and standardize it for fine-tuning. The cleaned version is synthetic; the underlying meaning came from real data.

🌍
Simulate Missing Groups

Your product runs in North America. You have no data for how 35+ year-olds in other markets use it. Synthesize plausible examples based on assumptions. Imperfect, but better than training with a systematic blind spot.

Two Pitfalls That Corrupt Everything

⚠️
Low diversity: Synthetic data generators often over-index on the most common patterns. If your 10,000 "expanded" examples are really just 100 examples rephrased slightly, the model learns nothing new. Explicitly measure diversity in your dataset before training.
⚠️
Train/test contamination: Synthetic examples don't have exact duplicates, but they can be close enough to be informationally equivalent. If the same underlying pattern appears in both your training set and your holdout test set, your eval metrics will look great while the model has actually overfit. Keep test data isolated before you generate synthetic training data — not after.
08

Distillation — The Teacher-Student Protocol

When DeepSeek was accused of "stealing" from Anthropic's models, the actual methodology being described was knowledge distillation — a standard, well-documented technique that every major lab uses internally. Understanding it clarifies both the controversy and the strategy.

🎓
Teacher Model
Large, capable, expensive
→
Send queries · collect responses
📝
Synthetic Dataset
(input, output) pairs
→
SFT fine-tune
👨‍🎓
Student Model
Small, fast, task-specific

The process: pass a large set of domain-specific queries to a powerful teacher model (GPT-4, Claude, Gemini). Collect its responses. Now you have a synthetic dataset of (input, output) pairs. Fine-tune a much smaller model on those pairs. The student learns to approximate the teacher's behavior on your specific domain — at a fraction of the inference cost.

Why do this? A 10B parameter distilled model handling your specific task can be cheaper to run, lower latency, and privately owned — compared to paying per-token to a frontier API forever. You get the intelligence of the large model, distilled into something you control.

My field notes — the DeepSeek reframe

When the DeepSeek headlines dropped, the framing in most coverage was competitive threat. The reframe I landed on: a large model can effectively train a smaller, faster one to replicate the job — which is exactly the pattern of an expert whose work a junior learns from. That's not a controversy, that's a workflow. Once you see it that way, distillation stops being an advanced technique and starts being the obvious next step after your first successful fine-tuning run.

I built VocabForge — a fine-tuned Qwen3 model for transforming raw performance descriptions into structured professional narrative — to test this end-to-end. The hard parts weren't the AI. They were the debugging, the environment, the formats, the evaluation logic. The model was almost the easy part. Fireworks.ai's API wasn't OpenAI-compatible for fine-tuning; Colab lost my training run three times. Every section of this guide is something I hit in practice, not just in theory.

💡
Already available: HuggingFace has dozens of publicly distilled models — distilled Llama, Mistral, and Qwen variants that are significantly smaller but competitive in quality for specific task categories. Before training your own distilled student, check whether a pre-distilled model already fits your use case.
09

GPU Cost Architecture — Three Tiers

How you access GPUs for training determines your cost structure, your flexibility, and how much capacity risk you carry. Most individuals start at tier one; most enterprises migrate toward tier three as volume grows.

☁️
Serverless
Lowest entry cost

Sign up, add credits, and run. The platform allocates GPU capacity from a shared pool when available. No upfront commitment. Variable wait times when the pool is busy.

No setup cost Pay only for what you use Good for experiments
No guaranteed capacity Unpredictable wait times Failed experiment = sunk GPU cost
⚡
Reserved Capacity
Enterprise tier

Commit to a certain number of GPU hours with a cloud provider. Your training jobs are prioritized over serverless users. Predictable scheduling, consistent throughput.

Guaranteed GPU availability Predictable training timelines Better for production pipelines
Upfront commitment required Paying even when unused
🖥️
On-Premises
Maximum control

Own the physical hardware. Build a private GPU cluster (or negotiate a private cloud partition). Maximum optimization potential — LinkedIn runs this way for complete stack control. Maximum capital outlay.

Full control over hardware Data never leaves your network Best unit economics at scale
Huge upfront capital cost Requires MLOps expertise Slow to provision or scale
⚠️
Data labeling costs are separate: Before you even touch a GPU, data preparation costs money — human labelers, services like Scale AI, and the engineering time to write annotation guidelines and QA the results. For many fine-tuning projects, clean labeled data costs more than training compute. Budget for both.
10

Training vs Inference Cost — The Break-Even

A common misunderstanding: "fine-tuning is expensive, so using an API is cheaper." This is only true at low volume. At scale, it inverts — and understanding the break-even is what determines whether your fine-tuning project makes financial sense.

📞
API Only
No setup cost
High per-call cost
→
📊
Break-Even
Volume crossover point
Where costs cross
→
🎯
Fine-Tuned
High upfront, low per-call
Cheaper at volume

The economics: APIs charge per token with no upfront cost. Fine-tuning has significant upfront cost — compute, data, engineering time — but a smaller, task-specific model has lower per-inference cost than a large general API call. At sufficient volume, the cumulative API spend exceeds the fine-tuning investment, and the crossover point becomes your break-even.

Three cost components to compare:

Approach Setup Cost Per-Inference Cost Performance
API (no fine-tuning) ✓ None High General
RAG + Prompting ✓ Low Medium Good for knowledge
Fine-Tuned Model High Medium Task-optimized
LoRA Adapter Low–Medium ✓ Low High + efficient
💡
Cursor as a real example: Cursor runs AI inference on third-party providers (Fireworks AI) rather than owning hardware — because they're a startup and the upfront cost of a serving lab is prohibitive. As they scale, the break-even math will shift and self-hosting will eventually become more attractive. The decision is not permanent — it's a function of current volume vs capital.
11

Ollama & Local Inference — AI That Runs Anywhere

The one-liner
Ollama is Docker for LLMs. You pull a model, it runs locally as an HTTP server, and you call it exactly like a ChatGPT API.
No API key. No network dependency. No per-token bill. Your model, your machine, your data boundary.

Under the hood: Ollama downloads models in GGUF format — a single file that bundles the model weights, tokenizer configuration, prompt template, and metadata. It quantizes to 4-bit (trading a small amount of precision for a large reduction in memory and compute). It runs on CPU if no GPU is available — making it usable on a standard laptop.

Once running, Ollama starts a local HTTP server at localhost:11434. You make REST requests to it — and optionally configure it to behave like the OpenAI API format, which means existing LangChain code, RAG pipelines, and agent frameworks plug in with minimal changes. Build a local RAG app, run lightweight agents, classify intent from a fine-tuned model — all on your machine, all offline-capable.

✅
When local inference wins
  • Privacy-sensitive industries where data cannot leave your environment (HIPAA, GDPR, financial compliance)
  • Regulated workflows needing data residency guarantees — even signed contracts with cloud providers aren't always enough
  • Edge deployments — factory cameras, on-device inference, manufacturing defect detection where there's no reliable network
  • Fast prototyping without API keys, billing, or rate limits slowing you down
  • High token volume where the cost math crosses the break-even against a hosted API
⚠️
The real trade-offs
  • Hardware-constrained: you're limited to RAM and CPU of your laptop (or however many GPUs you own)
  • Open-source models only — the quality gap between frontier closed-source models and open-source alternatives is real for some tasks
  • Smaller context windows compared to hosted frontier models
  • Not production-grade for concurrency: Ollama is low-concurrency by design — serving thousands of simultaneous users requires different tooling
  • MLOps overhead at scale: redundancy, monitoring, and throughput optimization require engineering investment

The practical flow: Install Ollama → ollama run llama3.2 → model downloads in GGUF format → local HTTP server starts → call it from Python, LangChain, or your agent framework exactly as you would a cloud API. Your fine-tuned model can be converted to GGUF and loaded into Ollama the same way — so you can run your own trained model locally with a single command.

🔭
Edge ML is the bigger picture: Running models locally on a laptop is just the personal-use case. The same principle — inference without network dependency — powers factory cameras detecting textile defects, on-device healthcare monitoring, and offline-capable field tools. Ollama builds your intuition for the pattern; edge ML platforms scale it to industrial deployments.
12

The Production Checklist

The bottom line
Training the model is the beginning. Model cards, canary rollouts, eval regression testing, and cost architecture are what make it production-worthy.
✅
Production-ready means…
  • Model card written before deployment — weights, tokenizer, eval results, dependencies
  • Full eval suite re-run on the fine-tuned model (not just fine-tuning loss)
  • Canary deployment: 1% → 5% → full rollout with comparison at each stage
  • Stack rollback plan documented — not just the model, but every dependent service
  • GPU tier chosen to match your current volume and cost math
  • RL considered only after SFT is working and the use case is quantifiable or human-reviewable
🚫
Common production mistakes
  • Deploying without a model card — you have no rollback reference when something breaks
  • Using the wrong tokenizer at inference — breaks the model silently, hard to debug
  • Jumping straight to RL from a base model without SFT foundation
  • Generating synthetic data without separating train/test splits first — contaminates evals
  • Assuming low diversity in synthetic data is fine — models overfit to narrow patterns
  • Rolling back only the model version instead of the entire dependent stack
← Part 1: The Specialist Protocol RL Deep Dive

Public Sources & Further Reading

HuggingFace PEFT / LoRA

huggingface.co/docs/peft — LoRA & QLoRA documentation

QLORA Paper — Dettmers et al.

arXiv:2305.11206 — 4-bit quantization for fine-tuning

Ollama

ollama.com — run LLMs locally, zero infra

RLHF — OpenAI Research

Reinforcement learning from human feedback — original paper

My workflow: A GenAcademy session introduced me to the post-training landscape — LoRA paths, RLHF alignment, synthetic data, and distillation. From there I explored public research papers, HuggingFace documentation, and the Ollama/Unsloth open-source ecosystems, then built this guide to understand by doing. This is my personal learning synthesis — a live session has far more depth and takeaways than any set of notes captures. For the full curriculum, reach out to GenAcademy directly.