# AI Lab (lab.militou.com) > AI Lab is a free, interactive learning site that explains how AI models work and how they are made smaller and faster. It covers LoRA, quantization, knowledge distillation, diffusion models, sampling, inference optimization, and evaluation in 14 lessons (64 steps) with hands-on diagrams, sliders, and quizzes. Available in Japanese, English, and Chinese. No sign-up; progress is stored locally and can be transferred between devices with a progress code. Operated by militou (https://militou.com/). The lessons are grouped into "Intro" (widely encountered concepts, explained without deep dives) and "Deep Dive" (the underlying mechanisms). ## Lessons - [How Models Are Made](https://lab.militou.com/#/lesson/overview): The full pipeline of a modern language model: large-scale pretraining on raw text, then instruction tuning and RLHF to make it follow instructions, then fine-tuning for specific uses. Most "training" people do at home is only the last stage. - [LoRA Basics](https://lab.militou.com/#/lesson/lora): LoRA freezes the original weights and learns a low-rank update W + BA. With rank r = 8, trainable parameters drop to roughly 0.1% of full fine-tuning, which is why a single consumer GPU can adapt a large model. Rank 8 is usually enough for style changes; rank 16-32 suits more complex changes. - [Quantization Basics](https://lab.militou.com/#/lesson/quant): Quantization stores weights in fewer bits. Going from FP16 (16 bits) to INT8 halves the model size, and INT4 quarters it, at the cost of some precision. An 8B model needs about 16 GB at FP16, about 8 GB at INT8, and about 4-5 GB at INT4. - [Knowledge Distillation Basics](https://lab.militou.com/#/lesson/distill): A small student model learns from a large teacher's output distribution, not just the correct answer. A temperature T above 1 softens the teacher's probabilities so the student can learn the teacher's "near-miss" knowledge; T = 1 is ordinary probabilities. - [Diffusion Model Basics](https://lab.militou.com/#/lesson/diffusion): Image generation models learn to reverse a noising process: noise is added step by step until the image is pure noise, and the model learns to remove it step by step. Generation runs this denoising for tens of steps, guided by the text prompt. - [Parts of a Model](https://lab.militou.com/#/lesson/parts): The building blocks of a Transformer: token embeddings, attention (which mixes information across positions), MLP blocks (which store much of the knowledge), layer normalization, and the output head. Parameter counts are dominated by embeddings, attention projections, and MLPs. - [Three Ways to Shrink a Model, and Pruning](https://lab.militou.com/#/lesson/compress): The three main compression routes are quantization (fewer bits per weight), distillation (a smaller student model), and pruning (removing unimportant weights or structures). They can be combined, and each trades size/speed against quality differently. - [Making Inference Faster](https://lab.militou.com/#/lesson/infer): Inference speed is often limited by memory bandwidth, not compute. Key techniques: the KV cache (reusing attention keys/values instead of recomputing them), batching multiple requests, and reducing the bytes moved per token through quantization. - [Sampling at Generation Time](https://lab.militou.com/#/lesson/sampling): Temperature and top-p control randomness when a model picks the next token. Lower temperature makes output more deterministic; top-p restricts choices to the smallest set of tokens covering p of the probability mass. This temperature is a generation setting and is different from the temperature used in distillation. Context length is the maximum number of tokens the model can consider at once. - [How to Evaluate and Compare](https://lab.militou.com/#/lesson/eval): Fair comparison requires fixed conditions: the same prompts, the same generation settings, and metrics matched to the purpose (accuracy benchmarks, perplexity, speed, memory). Changing one variable at a time is what makes a measured difference meaningful. - [The PEFT Family](https://lab.militou.com/#/lesson/peft): Parameter-efficient fine-tuning methods such as LoRA, adapters, and prefix/prompt tuning all share one idea: freeze almost all of the base model and train only a small added part, so one base model can host many cheap, swappable adaptations. - [QLoRA in Practice](https://lab.militou.com/#/lesson/qlora): QLoRA quantizes the frozen base model to 4-bit (NF4 format) and trains LoRA adapters on top, with double quantization and paged optimizers to fit large-model fine-tuning into a single GPU's memory. - [Datasets and Training Tuning](https://lab.militou.com/#/lesson/practice): Practical fine-tuning is mostly data work: curating examples, formatting them consistently, and choosing learning rate, epochs, and rank. Too many epochs on a small dataset causes overfitting; data quality usually matters more than dataset size. - [The Few-Step Family](https://lab.militou.com/#/lesson/fastgen): Few-step generation methods (such as consistency models and step distillation, e.g. LCM and Lightning-style LoRAs) compress a diffusion model's tens of denoising steps into roughly 1-8 steps, trading a little quality for a large speed gain. ## Other pages - [All lessons summary (static HTML)](https://lab.militou.com/lessons): A JavaScript-free summary of all 14 lessons. - [Hub site](https://militou.com/): The operator's hub with experiment notes, including a record of a Wan 2.2 image-to-video failure caused by mixing node generations.