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

LLM fine-tuning and hallucination

50 cards

Ways to adapt a language model, how preference tuning works, and what hallucination is and how to reduce it.

Card 1 of 50

Front. Pretraining. What is pretraining?

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.Pretraining

    What is pretraining?

    Training a model from scratch on a very large body of text to predict the next token. It produces a base model.

  2. 2.Base-model

    What is a base model?

    A pretrained model that continues text but has not been tuned to follow instructions or chat.

  3. 3.Fine-tuning

    What is fine-tuning?

    Continuing to train a pretrained model on a smaller, targeted dataset to change its behavior for a task or domain.

  4. 4.Sft

    What is supervised fine-tuning (SFT)?

    Fine-tuning on example inputs paired with desired outputs, using the next-token loss.

  5. 5.Instruction-tuning

    What is instruction tuning?

    SFT on many different tasks written as instructions and responses, so the model learns to follow new instructions in general.

  6. 6.Continued-pretraining

    What is continued pretraining?

    Further next-token training on large amounts of raw domain text, such as legal or medical writing, to adapt the model's language.

  7. 7.Loss-masking

    What is loss masking in chat SFT?

    Computing the loss only on the assistant's tokens, not the prompt, so the model learns to write responses.

  8. 8.Chat-template

    What is a chat template?

    The exact format, including special tokens and role markers, used to turn a conversation into model input. Training and serving must match.

  9. 9.Full-ft

    What is full fine-tuning?

    Updating every weight in the model. It is the most flexible and needs the most memory.

  10. 10.Peft

    What is parameter-efficient fine-tuning (PEFT)?

    Methods that train only a small number of new or selected parameters while the base weights stay frozen.

  11. 11.Lora

    What is LoRA?

    Low-rank adaptation: the base weights are frozen, and two small matrices are trained per chosen layer whose product is added to the weight.

  12. 12.Lora-rank

    What does the LoRA rank control?

    The inner width of the two small matrices. Higher rank gives the adapter more capacity and more parameters.

  13. 13.Lora-params

    How many parameters does a rank-r LoRA adapter add to a d × k weight?

    r × (d + k).

  14. 14.Qlora

    What is QLoRA?

    LoRA trained on top of a base model stored in 4-bit precision, which lets large models be fine-tuned on much less memory.

  15. 15.Adapter-merge

    What does merging a LoRA adapter mean?

    Adding the adapter's update into the base weights, producing one model with no extra serving step.

  16. 16.Weight-memory

    How much memory do model weights take?

    Parameter count times bytes per parameter: 2 bytes in 16-bit, 1 byte in 8-bit, half a byte in 4-bit.

  17. 17.Catastrophic-forgetting

    What is catastrophic forgetting?

    A model losing abilities it had before fine-tuning because the new training overwrote them.

  18. 18.Overfit-sft

    What does overfitting look like in SFT?

    Training loss keeps falling while held-out quality peaks and then drops, often after only a few epochs on a small dataset.

  19. 19.Data-quality

    Why does SFT data quality matter so much?

    The model imitates its examples, including errors and inconsistent formats.

  20. 20.Synthetic-data

    What is synthetic training data?

    Examples generated by a model rather than written by people. It needs filtering and checks, since errors carry over.

  21. 21.Contamination

    What is evaluation contamination?

    When evaluation examples, or near copies, appear in the training data, which inflates scores.

  22. 22.Rlhf

    What is RLHF?

    Reinforcement learning from human feedback: train a reward model on human comparisons, then optimize the model to score high on it.

  23. 23.Reward-model

    What is a reward model?

    A model trained on human preference comparisons to give a score to any response.

  24. 24.Kl-penalty

    What is the KL penalty in RLHF?

    A term that keeps the tuned model close to a reference model, limiting how far it can drift while chasing reward.

  25. 25.Dpo

    What is DPO?

    Direct preference optimization: training directly on pairs of preferred and rejected answers with a simple loss, without a separate reward model.

  26. 26.Reward-hacking

    What is reward hacking?

    The model learning to raise its reward through shortcuts, such as longer answers, that do not reflect real quality.

  27. 27.Sycophancy

    What is sycophancy?

    A model telling users what they want to hear, such as agreeing with a wrong claim.

  28. 28.Distillation

    What is distillation for LLMs?

    Training a smaller model on a larger model's outputs so it can match the larger one on a task at lower cost.

  29. 29.When-prompt

    When is prompting the right first step?

    Almost always. It is cheap to change and often enough, and it sets a baseline for any later fine-tune.

  30. 30.When-rag

    When is retrieval the right tool?

    When the model needs specific or frequently changing facts, or answers need sources.

  31. 31.When-finetune

    When is fine-tuning the right tool?

    When you need consistent behavior, format, or style that prompting cannot get reliably, or want to shorten long prompts at high volume.

  32. 32.Finetune-facts

    Is fine-tuning a reliable way to add facts?

    Not usually. Recall of specific facts is unreliable, and there is no source to check. Retrieval is better for facts.

  33. 33.Hallucination

    What is hallucination?

    A model producing fluent, confident content that is false or not supported by its sources.

  34. 34.Why-hallucinate

    Why do language models hallucinate?

    They are trained to produce likely text, not verified facts, and training often rewards a confident guess over admitting uncertainty.

  35. 35.Faithfulness

    What is a faithfulness error?

    An answer that contradicts or goes beyond the source text it was given.

  36. 36.Factuality

    What is a factuality error?

    An answer that is wrong about the world, whether or not a source was given.

  37. 37.Grounding

    What is grounding?

    Giving the model trusted source text and instructing it to answer from that text.

  38. 38.Abstention

    What is abstention?

    The model declining to answer, or saying it does not know, when it lacks the information.

  39. 39.Abstention-tradeoff

    What is the tradeoff of encouraging abstention?

    Fewer wrong answers, but more refusals of questions the model could have answered.

  40. 40.Citation-check

    How is citation support checked?

    By testing whether each cited passage actually supports its claim, using an entailment model, an LLM judge, or people.

  41. 41.Self-consistency

    What is self-consistency as a hallucination signal?

    Sampling several answers and treating disagreement among them as a sign the model is unsure.

  42. 42.Temperature-hallucination

    Does lowering temperature fix hallucination?

    No. It makes answers more consistent, but a wrong most-likely answer is still wrong.

  43. 43.False-premise

    What is a false-premise question?

    A question that assumes something untrue, such as asking about a paper that does not exist. It tests whether the model pushes back.

  44. 44.Context-conflict

    What is a context-knowledge conflict?

    When the provided document says something different from what the model learned in training. A grounded model should follow the document.

  45. 45.Calibration-llm

    Is a model's stated confidence reliable?

    Often not. Phrases like 'I'm 95 percent sure' need to be checked against measured accuracy.

  46. 46.Llm-judge

    What is an LLM judge?

    A model used to grade outputs against a rubric. Its agreement with human ratings should be checked.

  47. 47.Judge-bias

    What biases do LLM judges commonly show?

    Favoring longer answers, favoring the first or second position, and favoring outputs from their own model family.

  48. 48.Eval-set

    What makes a good evaluation set for an LLM task?

    Realistic questions with expert reference answers and sources, including hard, out-of-scope, and unanswerable cases.

  49. 49.Regression-suite

    What is a regression suite for an LLM system?

    A fixed set of checks run on every change to the prompt, retrieval, or model to catch anything that got worse.

  50. 50.Memorization

    What is memorization risk in fine-tuning?

    The model repeating training text word for word, which can leak private or licensed content. Duplicates make it worse.