KatInterview

Design a Decoupled Online RL Fine-Tuning Pipeline for a Live Chatbot

System DesignModel answer
HardModel answerSystem Designreinforcement-learningrlhfllm-infrastructure

Last updated

Design an asynchronous RL fine-tuning pipeline that improves a deployed chat LLM from live traffic, covering staleness, KL control, reward hacking, safety gates and cost.

Your company runs a large conversational LLM in production. You want to keep improving it with reinforcement learning (RLHF or RLAIF style), using prompts and feedback drawn from live usage, without hurting the serving experience.

Design the asynchronous RL post-training system. In your answer, cover:

  1. Components and dataflow. Generation workers, reward scoring, learner(s), experience buffers or queues, and the orchestrator. Describe how data moves between them, how batches are formed, and how backpressure works.
  2. Off-policy handling. Samples come from a policy that lags the learner. Explain how you bound and correct for staleness (for example importance ratios, clipping, or V-trace) and how you would detect that it is too high.
  3. Staying close to the base model. How you apply KL regularization to a reference model and control its strength.
  4. Feedback and credit assignment. How delayed, sparse and noisy user signals (thumbs, regenerations, abandonment) are ingested and turned into a usable training signal, including for multi-turn conversations.
  5. Reward hacking. Concrete defenses and the signals that tell you it is happening.
  6. Safety and compliance. Prompt and content filtering, consent and PII handling, rate limits, and gating of new checkpoints.
  7. Versioning and rollout. How checkpoints are registered, evaluated, canaried and rolled back.
  8. Infrastructure and operations. How serving and training are separated, what you monitor (reward drift, response diversity, quality), and how cost stays predictable under load spikes and uneven feedback arrival.

State your scale assumptions explicitly (model size, traffic, step cadence, GPU budget) and call out the main trade-offs.

Hints

Hint 1

Start by writing down numbers: model size, tokens generated per learner step, step cadence, and a fixed GPU budget. Then decide what must never be blocked (serving) and what may be dropped (stale samples).

Hint 2

Tag every sample with the policy version and behavior log-probs at generation time. Bound queues and discard samples older than a few versions, then watch the importance-ratio clip fraction as your staleness alarm.

Hint 3

Do not optimize raw user feedback directly. Join it to logs with a watermark window, train reward models on it, and let those models provide dense rewards. Layer on defenses: RM ensembles with an uncertainty penalty, a held-out judge model, length controls, and a KL budget that pauses training automatically.