Fine-tuning and training

LLM fine-tuning labs

Eight GPU labs from data preparation to a model you trained yourself.

8 labs ~6 hours total 8 on real GPUs 0 hosted

Fine-tuning changes a model's weights on your own data. Parameter-efficient methods such as LoRA (training small low-rank adapter matrices instead of the full model) and QLoRA (LoRA on a 4-bit quantized base) make that possible on a single GPU, which is why they dominate both production practice and the NVIDIA NCP-GENL and NCA-GENL blueprints. The concepts are simple to state and easy to get subtly wrong: the wrong learning rate, a leaking eval set, forgetting that the adapter rank trades capacity for memory.

This collection is ordered the way a real project runs. Prepare and deduplicate the data and train a BPE tokenizer; fine-tune Llama 3 8B with LoRA and then QLoRA on an instruction set; align a model with Direct Preference Optimization using TRL; domain-adapt GPT-2 to Python and measure catastrophic forgetting; train a small GPT-style model from zero on TinyStories. Two labs cover the parts teams skip: an evaluation lab (perplexity, why BLEU misses paraphrase, side-by-side comparison, an LLM judge) and a reproducibility lab that flips PyTorch determinism flags until same-seed runs match bit for bit. A final lab applies LoRA to Stable Diffusion, which shows the technique is not specific to text.

Every lab runs on a live NVIDIA GPU pod inside the browser (Jupyter or terminal), takes 40 to 55 minutes, and is checked step by step.

The labs, in order

All labs
  1. 1
    # dedup + tokenize
    $ filter_lang("en")
    raw ............ 52k → 18k
    tokenizer ...... BPE 32k
    train_ready .... 16,420
    GPU Pro
    ncp-genl · data-prepIntermediate

    Data Preparation for LLM Training

    Build a real pretraining/instruction data pipeline: load a raw corpus, apply quality filters, deduplicate, train a BPE tokenizer, and batch-validate on GPU. This is the unglamorous work that actually decides how good your model will be.

    ncp-genlnca-genlncp-ads
    45 min5 steps
    Launch
  2. 2
    # lora · r=16 · alpha=32
    $ trainer.train()
    trainable ....... 0.8%
    eval_loss ....... 1.24
    perplexity ...... 3.45
    GPU Pro
    ncp-genl · fine-tune-llm-lora-jupyterIntermediate

    Fine-Tune an LLM with LoRA and QLoRA (Jupyter)

    Fine-tune Meta Llama 3 8B on a custom instruction dataset using LoRA and QLoRA. Learn parameter-efficient fine-tuning from data preparation through evaluation — the #1 most demanded AI skill.

    ncp-genlncp-adsnca-genl
    45 min7 steps
    Launch
  3. 3
    GPU Pro
    ncp-genl · dpo-alignmentAdvanced

    RLHF & DPO Alignment

    Run real Direct Preference Optimization on a small language model with TRL's DPOTrainer. Capture a baseline, build a preference dataset, train, and measurably shift the model's behavior in four steps.

    ncp-genlncp-adsnca-genl
    55 min4 steps
    Launch
  4. 4
    GPU Pro
    ncp-genl · continued-pretrainingAdvanced

    Continued Pre-Training: Adapt a Pretrained LM to a New Domain

    Take GPT-2 and domain-adapt it to Python code in 150 steps, measuring both the gain on code and the cost in catastrophic forgetting on English. The exact recipe behind Code Llama, BloombergGPT, and every domain-specialized LLM of the last three years.

    ncp-genlncp-adsnca-genl
    45 min4 steps
    Launch
  5. 5
    GPU Pro
    ncp-genl · train-slmAdvanced

    Train a Small Language Model from Scratch

    Train a real GPT-style language model from zero on TinyStories: tokenize, wire up the optimizer and LR schedule, run the training loop with validation perplexity, and generate coherent text from your own weights. End-to-end pretraining in minutes on one GPU.

    ncp-genlncp-adsnca-genl
    55 min4 steps
    Launch
  6. 6
    GPU Pro
    ncp-genl · evaluationIntermediate

    Evaluation & Benchmarking LLMs

    Four evaluation lenses in one lab: compute real perplexity, expose BLEU's blindness to paraphrase, run side-by-side model comparisons, and build an LLM-as-judge harness with position-bias detection.

    ncp-genlnca-genlncp-ads
    45 min4 steps
    Launch
  7. 7
    # determinism flags
    $ torch.use_deterministic_…
    seed ............ 42
    cudnn.benchmark . False
    reproducible .... TRUE
    GPU Pro
    ncp-genl · reproducible-trainingIntermediate

    Reproducible Training: The Flags, The Cost, The Artifacts

    Measure the non-determinism noise floor in default PyTorch, flip every determinism flag until same-seed runs match bit-for-bit, quantify the perf cost, and capture a content-addressable training config that makes a run reproducible forever.

    ncp-genlncp-aioncp-ads
    40 min4 steps
    Launch
  8. 8
    GPU Pro
    nca-genm · sd-loraIntermediate

    Fine-Tune Stable Diffusion with LoRA: Custom Text-to-Image

    Load Stable Diffusion, attach LoRA adapters to the U-Net's attention layers, run a tiny overfit training loop, and generate with the adapted weights to prove that a few million trainable parameters actually move pixels.

    nca-genmncp-genl
    45 min4 steps
    Launch

Before you start

  • PyTorch basics: tensors, a training loop, what a loss curve is
  • The idea of a tokenizer and of train/validation splits
  • No fine-tuning experience required; the LoRA lab starts from a base model download
Preporato Pro

Every lab in this collection, plus every practice test on the platform

$29.99 per month or $290 per year. Cancel any time. Free labs need only an account.

Frequently asked questions

More lab topics