Context Management interview question

Generative AIContext ManagementConversational AIbasic

A chatbot's conversation history is growing longer than the model's context window. What is a common way to handle it?

  1. ASend the full history anyway, since the model automatically compresses any input that is longer than its context window.
  2. BDrop the system prompt first, since it is the oldest message in the history and usually the least relevant to the next reply.
  3. CKeep recent turns verbatim and replace older turns with a short running summary, so key facts stay within budget.
  4. DFine-tune the model on the conversation after each turn, so it memorizes earlier turns and they no longer need to be sent.
Show the answer and explanation

Correct answer: C, Keep recent turns verbatim and replace older turns with a short running summary, so key facts stay within budget.

Explanation Context Management

The model only sees what is in the current request, so the application must keep the history within the token budget. Standard strategies are a sliding window (keep the last N turns), summarizing older turns into a short running summary, and retrieving only the relevant earlier messages. A common hybrid keeps the system prompt and recent turns verbatim and summarizes the rest.

Why the other ideas are wrong:

  • The model does not compress oversized input: a request beyond the context window is rejected or truncated, losing information.
  • The system prompt carries the instructions and persona, so it is normally the last thing to drop, not the first.
  • Fine-tuning after every turn is slow, costly and not how chat memory works; history is handled in the prompt.

Interview tip: mention the trade-off: truncation is simple but forgets early facts, while summarization keeps them at the cost of an extra LLM call and possible loss of detail.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Generative AI questions

  1. Asked for "revenue and number of orders that contain electronics, by customer segment", a text-to-SQL bot generated the query below. The Gold segment has…
  2. The table shows the next-token distribution at one decoding step for the context "The customer wants to ___". With top-p = 0.9 (nucleus sampling, no top-k),…
  3. A team reports that a new prompt raised RAGAS faithfulness on a 300-question set from 0.81 to 0.86: the old score is from last month, the new one was computed…
  4. A loan pre-screening step uses the schema below with constrained decoding, which emits properties in schema order. Reviewers find that reasoning usually…
  5. The flow shows one generation step of a decoder-only LLM (GPT- or Llama-style). What happens at the highlighted step?