KatInterview

From Raw Text to Aligned Assistant: Building and Testing an LLM

Machine LearningModel answer

Last updated

Walk through how a foundation model becomes a safe, helpful assistant: pretraining, SFT versus preference optimization, reward modeling pitfalls, and evaluation including reward hacking detection.

Question

You are on a team that will build a new large language model, starting from a blank slate and ending with a deployed chat assistant. Describe the technical path and justify why each stage is needed.

Cover these four areas:

  1. Pretraining. What loss is optimized, and how do you weigh the quality of the training data against its sheer volume?
  2. Alignment after pretraining. Compare supervised fine-tuning (SFT) on demonstrations with reinforcement learning from human feedback (RLHF). Suppose an SFT model already scores well on accuracy-style metrics. Why might you still need a preference-based stage?
  3. Preference learning. Whether you pick PPO with a separate reward model or DPO with a direct preference loss, what are the main difficulties in getting the reward signal or preference objective to work well?
  4. Evaluation. Propose an evaluation setup that covers both factual reliability and safety. Explain how you would notice that the policy is exploiting the reward signal (reward hacking).

A strong answer links the objectives of each stage, names concrete failure modes, and states trade-offs rather than only listing terminology.

Hints

Hint 1

Start from the objectives: next-token cross-entropy, then token-level imitation, then sequence-level preference optimization with a KL anchor to a reference model.

Hint 2

For the SFT versus RLHF question, think about exposure bias, the lack of negative examples in demonstrations, and the fact that judging two answers is easier than writing a perfect one.

Hint 3

For reward modeling and hacking, think about spurious features such as length and flattery, distribution shift as the policy moves, and what happens to a true quality measure as KL from the reference grows.

Hint 4

For evaluation, report paired metrics (harmful compliance with over-refusal, accuracy with abstention) and compare the proxy reward to an independent gold signal.