FreeExam
A closed notebook, a blank card, and a pencil on a wooden desk.

Training stack

50 cards

Which library owns the model, the rows, the adapter, and the GPUs in a 2026 fine-tune.

Card 1 of 50

Front. Jobs. What are the separate jobs in a 2026 fine-tuning stack?

These cards are original study material. They are not questions from a named employer or a live hiring loop.

All 50 cards in this deck

  1. 1.Jobs

    What are the separate jobs in a 2026 fine-tuning stack?

    One library loads the weights, one reads the rows, one places the run on devices, one stores the adapter, and one applies the SFT or preference loss.

  2. 2.Torch

    What does PyTorch own in that stack?

    The tensors, the autograd graph, and the kernels that run the step. Transformers, PEFT, and TRL call into that runtime.

  3. 3.Tf-now

    When is TensorFlow still the framework you ship?

    When the production graph, the SavedModel, and the serving path already are TensorFlow. New LLM training in 2026 usually starts in PyTorch.

  4. 4.Keras

    What is Keras in 2026?

    A high-level model API that can sit on TensorFlow, JAX, or PyTorch. Custom LLM training still drops to the framework underneath.

  5. 5.Jax

    When is JAX the training framework?

    When the lab wants NumPy-style code compiled and sharded by XLA across devices. The training step is a pure function, not a module full of in-place state.

  6. 6.Sklearn

    Where does scikit-learn sit next to a neural net?

    It fits the linear or tree baseline, the split, and the metrics. The neural net is compared with that baseline on the same split.

  7. 7.Boost-when

    When is gradient boosting the model?

    On tabular rows with mixed numeric and category columns, where a boosted tree usually trains faster and is easier to explain than a net.

  8. 8.Xgb-lgb

    How do XGBoost and LightGBM differ in the fit?

    Both are histogram boosters. LightGBM grows leaf-wise, which can fit faster and overfit a small table sooner. You compare them on a locked validation fold.

  9. 9.Catboost

    What does CatBoost handle that the others make you encode?

    Categorical columns. It builds ordered target statistics so a row's encoding is fit without that row's own label.

  10. 10.Vision

    What is torchvision for beside an LLM stack?

    Image datasets, transforms, and pretrained vision weights. An LLM fine-tune does not import it unless the model actually consumes pixels.

  11. 11.Hf-model

    What does the transformers library load?

    The architecture class, the config, and the weights for a named checkpoint, plus generate(). The tokenizer and the rows come from sibling libraries.

  12. 12.From-pretrained

    What must you record with from_pretrained?

    The repo id and the revision, commit or tag. A floating name can resolve to different weights tomorrow.

  13. 13.Tokenizers

    What does the tokenizers library own?

    The fast encode and decode, implemented in Rust and called from Python. Special tokens and the chat template have to be the same ones the serving process uses.

  14. 14.Datasets

    What does the datasets library store a split as?

    Arrow tables with a named train, validation, and test split. A map() rewrite is cached, so a changed function must change the cache key or you will train on stale rows.

  15. 15.Streaming

    When do you stream a dataset instead of downloading it?

    When the corpus is larger than the disk on the training node. You then cannot assume a random shuffle of the whole set without a buffer.

  16. 16.Trainer

    What does the Hugging Face Trainer hide?

    The step loop, the accumulation, the log, and the checkpoint. You still own the collator, the label mask, and the metric that decides the best checkpoint.

  17. 17.Accelerate

    What does Accelerate configure?

    The device map, mixed precision, and gradient accumulation, and it launches one process per GPU. The model definition stays ordinary PyTorch.

  18. 18.Acc-yaml

    What belongs in an Accelerate config rather than in code?

    How many processes, which precision, and whether FSDP or DeepSpeed is on. Those change with the machine. The loss function stays in the training code.

  19. 19.Peft-lib

    What does the PEFT library attach?

    A small trainable module, usually LoRA, on frozen base weights, and it saves only that module. The preference or SFT loss is computed by the trainer, not by PEFT.

  20. 20.Peft-wrong

    When is a PEFT adapter the wrong artifact?

    When you must change every layer's behavior and you have the memory for a full update, or when the serving stack you will use cannot load that adapter format.

  21. 21.Lora-cfg

    What do you choose in a LoRA config?

    The rank, the alpha, the dropout, and which projections get the adapter. Rank sets capacity. The target modules decide which parts of the block can change.

  22. 22.Qlora-pair

    Which libraries does a QLoRA run use together?

    bitsandbytes loads the frozen base in 4-bit, and PEFT trains a LoRA adapter in higher precision on top. Neither library alone is the whole method.

  23. 23.Bnb

    What does bitsandbytes provide in training?

    An 8-bit optimizer and a 4-bit weight load so the base model fits. Those formats are for the training process. The server may want a different quantized file.

  24. 24.Trl

    What does TRL run that PEFT does not?

    The training objective: SFT on completions, or a preference loss such as DPO or GRPO. PEFT only says which weights move.

  25. 25.Sft-rows

    What rows does an SFT trainer in TRL expect?

    Prompts and target completions, turned into tokens with the chat template, with the loss on the completion tokens.

  26. 26.Dpo-rows

    What does a DPO trainer need that SFT does not?

    For each prompt, one chosen completion and one rejected completion, plus a frozen reference model, usually the SFT checkpoint you started from.

  27. 27.Grpo

    What is GRPO in the 2026 TRL trainers?

    A reinforcement step that scores a group of completions for one prompt. Reasoning runs often use a checkable reward, such as a unit test, instead of a learned reward model.

  28. 28.Ref-model

    Why is the reference model part of the preference run?

    The loss measures how far the policy moves from that reference. A different reference revision is a different experiment.

  29. 29.Ds

    What does DeepSpeed change about a training step?

    It shards optimizer state, gradients, and sometimes parameters across GPUs, and it can offload some of that state to CPU, under a JSON config.

  30. 30.Zero-1

    What does ZeRO stage 1 shard?

    The optimizer state. Weights and gradients still sit on each GPU. It cuts the Adam memory, which is often the first thing that does not fit.

  31. 31.Zero-3

    What does ZeRO stage 3 shard?

    Optimizer state, gradients, and the parameters themselves. A layer is gathered for the forward and backward, so the step spends more time on communication.

  32. 32.Fsdp

    What is FSDP relative to DeepSpeed?

    PyTorch's own fully sharded data parallel. It shards parameters, gradients, and optimizer state. You use it when you want that sharding without a second framework's config.

  33. 33.Megatron

    What is Megatron-Core for?

    Training a transformer that needs tensor, pipeline, or expert parallelism, not only data parallelism. The model is split inside a layer, not only across data replicas.

  34. 34.Mega-when

    When do you pick Megatron over ZeRO alone?

    When one replica of the weights does not fit even after sharding the optimizer, so the layer itself has to be split across GPUs.

  35. 35.Lightning

    What does Lightning organize?

    The training loop, callbacks, loggers, and device setup around a PyTorch module. The sharding still comes from FSDP, DeepSpeed, or the strategy you pass in.

  36. 36.Torchtune

    What is torchtune?

    PyTorch's own recipe set for LLM fine-tunes: configs for LoRA or full updates, the tokenizer, and the checkpoint, without the Hugging Face Trainer loop.

  37. 37.Unsloth

    What does Unsloth change in a LoRA run?

    It patches the attention and MLP path with kernels aimed at adapter training, so the step is faster and uses less memory. Confirm the saved adapter still loads in stock PEFT.

  38. 38.Ray-train

    What does Ray Train schedule?

    Copies of your training function across a cluster, with GPUs assigned to each worker and a place to write the checkpoint. The step itself is still PyTorch.

  39. 39.Ray-vs-acc

    When is Ray Train the launcher instead of Accelerate?

    When the run spans a cluster that must place workers, retry a dead node, and collect one checkpoint. Accelerate launches the processes you already have.

  40. 40.Mp

    Who turns on mixed precision?

    The launcher, Accelerate or Lightning or a DeepSpeed config, selects bf16 or fp16 for the compute. Master weights and the optimizer often stay in fp32.

  41. 41.Ckpt-act

    What does gradient checkpointing trade?

    Memory for compute. Activations are dropped and recomputed on the backward. PyTorch and transformers both expose the switch, and the objective stays the same.

  42. 42.Compile

    What does torch.compile change about a step?

    It traces the forward and fuses kernels. The first steps pay for the compile. Dynamic sequence lengths can trigger a new compile.

  43. 43.Packing

    What is sequence packing in a fine-tune?

    Short examples are concatenated up to the context length, with an attention mask that stops one example from seeing the next. Tokens per step go up.

  44. 44.Template

    Who applies the chat template?

    The tokenizer, with the same template string in training and in the server. A trainer that concatenates roles by hand will not match generate().

  45. 45.Save-adapter

    What files does a LoRA run need to save?

    The adapter weights and the adapter config, plus the base model id and revision. The base weights are not copied if the server will load them separately.

  46. 46.Eval-hook

    What should decide the best checkpoint?

    A fixed evaluation set scored the way you will serve, not the training loss. Train loss falls when the model memorizes the fine-tune rows.

  47. 47.Log-what

    What does the run log besides the loss?

    Learning rate, gradient norm, tokens per second, and the eval score. A tracker such as the one in the trainer is useless if those are missing.

  48. 48.Boundary

    What stays in Python when the step is in a CUDA library?

    The config, the batch, and the launch. bitsandbytes, FlashAttention, and DeepSpeed run compiled kernels. A Python error at step time is often a mismatched kernel build.

  49. 49.Lock

    What do you lock so the fine-tune can be rerun?

    Package versions, the base revision, the data fingerprint, the seed, and the PEFT and trainer configs. A notebook that imported 'latest' cannot be rerun.

  50. 50.Default-stack

    What is a practical 2026 stack when the model fits on a few GPUs?

    PyTorch, transformers, datasets, PEFT, and TRL, launched with Accelerate. Add bitsandbytes for a 4-bit base, and FSDP or DeepSpeed when the full weights do not fit.