Manage Context Windows in an Applied AI System

Quick Overview

An applied-AI system-design interview about building model context from user requests, conversation history, retrieved evidence, and tool results. It tests token budgeting, evidence ranking, summarization, provenance, prompt-injection boundaries, and graceful degradation.

Manage Context Windows in an Applied AI System

Company: Rogo

Role: Machine Learning Engineer

Category: ML System Design

Difficulty: medium

Interview Round: Onsite

# Manage Context Windows in an Applied AI System Design the context-building layer for an applied AI assistant. It must combine the current request, conversation history, retrieved evidence, and tool results while staying within a model's context limit and keeping important evidence traceable. ### Constraints & Assumptions - The model has a fixed token budget shared by input and expected output. - Retrieved documents can conflict, repeat one another, or contain untrusted instructions. - Conversation history can grow indefinitely. - The system must explain which evidence supported the answer. ### Clarifying Questions to Ask - Which information is authoritative, and which is merely conversational context? - What output-token reserve and latency target are required? - Can old conversation turns be summarized, and must summaries be reversible to source turns? ### Part 1 — Context construction Propose a budget and ordering policy for system instructions, user request, history, retrieved evidence, and tool results. #### What This Part Should Cover - A token budget with output reserve - Priority and truncation rules - Deduplication and provenance ### Part 2 — Safety and quality Handle prompt injection, conflicting evidence, stale summaries, and evaluation of context selection. #### What This Part Should Cover - Trust boundaries and instruction hierarchy - Evidence recency and conflict reporting - Retrieval and answer-quality measurements ### What a Strong Answer Covers - A deterministic context policy - Traceable evidence and summaries - Evaluation that separates retrieval from generation ```hint Budget by information role Do not concatenate until the limit is reached. Reserve explicit budgets for instructions, user intent, evidence, history, and output, then choose content within each role. ``` ### Follow-up Questions - When should a larger-context model be chosen? - How would you detect that summarization removed a critical constraint?

Quick Answer: An applied-AI system-design interview about building model context from user requests, conversation history, retrieved evidence, and tool results. It tests token budgeting, evidence ranking, summarization, provenance, prompt-injection boundaries, and graceful degradation.

|Home/ML System Design/Rogo
Rogo logo
Rogo
Jun 24, 2026, 12:00 AM
mediumMachine Learning EngineerOnsiteML System Design
0
0

Manage Context Windows in an Applied AI System

Design the context-building layer for an applied AI assistant. It must combine the current request, conversation history, retrieved evidence, and tool results while staying within a model's context limit and keeping important evidence traceable.

Constraints & Assumptions

  • The model has a fixed token budget shared by input and expected output.
  • Retrieved documents can conflict, repeat one another, or contain untrusted instructions.
  • Conversation history can grow indefinitely.
  • The system must explain which evidence supported the answer.

Clarifying Questions to Ask Guidance

  • Which information is authoritative, and which is merely conversational context?
  • What output-token reserve and latency target are required?
  • Can old conversation turns be summarized, and must summaries be reversible to source turns?

Part 1 — Context construction

Propose a budget and ordering policy for system instructions, user request, history, retrieved evidence, and tool results.

What This Part Should Cover Guidance

  • A token budget with output reserve
  • Priority and truncation rules
  • Deduplication and provenance

Part 2 — Safety and quality

Handle prompt injection, conflicting evidence, stale summaries, and evaluation of context selection.

What This Part Should Cover Guidance

  • Trust boundaries and instruction hierarchy
  • Evidence recency and conflict reporting
  • Retrieval and answer-quality measurements

What a Strong Answer Covers Guidance

  • A deterministic context policy
  • Traceable evidence and summaries
  • Evaluation that separates retrieval from generation

Follow-up Questions Guidance

  • When should a larger-context model be chosen?
  • How would you detect that summarization removed a critical constraint?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...