← Openai Interview Insights

Openai·Machine Learning Engineer·Onsite - System Design / Architecture·Senior

Senior
Jul 2026

Summary

System design round at OpenAI for an ML Engineer role, focused entirely on building a RAG-based search and QA system over a large mixed-format document corpus. The whole session was basically one giant design problem with follow-ups layered on top, which felt more like a technical deep-dive than a typical interview.

Questions Asked (7)

Q1

Design an LLM-powered search and question-answering system over a large corpus of documents including internal wikis, PDFs, logs, contracts, and web pages. Both documents and user queries can exceed the model's context window.

System DesignTechnical Trade-offs
Author's notes

This is the main question and it's a lot.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (corpus size, latency, accuracy, freshness) and then propose a modular RAG pipeline: ingestion, chunking, embedding, hybrid retrieval, and generation with long-context handling. Emphasize trade-offs at each stage, especially chunking strategies, retrieval methods, and how to handle queries/documents exceeding context windows.

Pro tip: Show awareness of evaluation and iteration: propose a golden dataset and metrics (e.g., recall@k, faithfulness) to measure retrieval and generation quality, and discuss how to monitor and improve the system over time.

1. Clarify Requirements and Constraints

Ask about corpus size, document types, query types, latency/throughput needs, accuracy targets, and privacy/security requirements to scope the design.

2. Design Ingestion and Indexing Pipeline

Outline document parsing (PDF, HTML, logs), chunking strategies (semantic, recursive), embedding model selection, and vector database choice with hybrid search support.

3. Implement Retrieval and Ranking

Combine dense and sparse retrieval (e.g., embeddings + BM25), use re-ranking (cross-encoder) to improve precision, and handle long queries via query expansion or decomposition.

4. Generate Answers with Long-Context Handling

Use retrieved chunks to form a prompt within the model's context window; for long documents, employ hierarchical summarization or iterative refinement; for long queries, use query-focused summarization.

5. Evaluate, Monitor, and Iterate

Define offline and online metrics, build a golden dataset, and set up monitoring for retrieval quality, answer faithfulness, and latency to continuously improve the system.

Key Points to Mention

  • Chunking strategies: fixed-size vs. semantic vs. recursive, with overlap to preserve context.
  • Hybrid retrieval: combining dense (embedding) and sparse (BM25) methods for better recall.
  • Re-ranking: using cross-encoders to refine top-k results and improve precision.
  • Handling long documents: hierarchical summarization, map-reduce, or iterative retrieval-augmented generation.
  • Handling long queries: query decomposition, expansion, or summarization before retrieval.
  • Evaluation metrics: retrieval recall@k, answer faithfulness, latency, and cost.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How do you handle documents that are hundreds of pages long and far exceed what you can fit into the context window?

System DesignTechnical Trade-offs
Author's notes

I talked about chunking with overlap and using natural boundaries like section headers.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the goal: is the task retrieval, summarization, or question answering? Then describe a hierarchical or retrieval-based approach that chunks the document, embeds chunks, and uses a model to process relevant parts, possibly with iterative refinement. Emphasize trade-offs between accuracy, latency, and cost, and mention evaluation to ensure the approach works.

Pro tip: Show awareness that context window limits are not just about size but about attention dilution and cost; propose a hybrid approach that combines retrieval with summarization to balance performance and efficiency. Also, mention that you would benchmark against a baseline like truncation to quantify improvements.

1. Clarify the task and constraints

Ask what the end goal is (e.g., extract specific info, summarize, answer questions) and note constraints like latency, cost, and accuracy requirements.

2. Choose a chunking and retrieval strategy

Split the document into overlapping chunks, embed them, and use a retriever to fetch only the most relevant chunks for the query or task.

3. Apply a hierarchical or iterative model

Use a model to process retrieved chunks, then aggregate or refine results (e.g., map-reduce summarization, iterative refinement) to produce a final answer.

4. Evaluate and iterate

Measure performance against a baseline (e.g., truncation) and iterate on chunk size, retrieval method, and aggregation to optimize trade-offs.

Key Points to Mention

  • Chunking strategies (fixed-size, semantic, recursive) and handling overlap
  • Embedding models and vector databases for efficient retrieval
  • Retrieval-augmented generation (RAG) and its variants
  • Hierarchical summarization (map-reduce) and iterative refinement
  • Trade-offs: accuracy vs. latency vs. cost, and context window limitations
  • Evaluation metrics and benchmarking against baselines

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How would you process a long user query, like a multi-page pasted log or contract, without losing the user's original intent?

System DesignAdaptability & Ambiguity
Author's notes

Honestly the trickiest sub-problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the user's goal and the query's structure, then propose a multi-stage pipeline that preserves intent through hierarchical summarization and retrieval-augmented generation. Emphasize evaluation and iterative refinement to ensure the final response aligns with the original ask.

Pro tip: Anchor your answer in concrete ML system design patterns (e.g., map-reduce summarization, RAG with intent embeddings) and mention how you'd measure intent preservation (e.g., human eval, intent classification accuracy).

1. Clarify Intent and Constraints

Ask clarifying questions to understand the user's goal, expected output format, and any latency/cost constraints. Identify key entities or sections in the long query that signal intent.

2. Segment and Index the Input

Break the long query into logical chunks (e.g., paragraphs, log entries) and create embeddings or metadata for each. This enables efficient retrieval and preserves local context.

3. Hierarchical Summarization and Intent Extraction

Apply a map-reduce summarization approach: summarize each chunk, then combine summaries to form a global view. Simultaneously, extract and track the user's intent using a classifier or LLM prompt.

4. Retrieve and Generate with Intent Conditioning

Use the global summary and intent representation to retrieve relevant chunks and generate a response. Condition the generation on the original intent to avoid drift.

5. Evaluate and Iterate

Measure intent preservation via human evaluation or automated metrics (e.g., intent classification accuracy, ROUGE). Iterate on the pipeline based on feedback.

Key Points to Mention

  • Chunking strategies (e.g., sliding window, semantic segmentation) to handle long inputs
  • Retrieval-augmented generation (RAG) to ground responses in the original text
  • Hierarchical summarization (map-reduce) to maintain global context
  • Intent detection and tracking using LLMs or classifiers
  • Evaluation metrics for intent preservation (e.g., human eval, intent accuracy)
  • Trade-offs between latency, cost, and accuracy in system design

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How would you evaluate whether your chunking strategy is causing missed answers?

Technical Trade-offsProduct Analytics & Metrics
Author's notes

Blanked for a second here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining what a 'missed answer' means in your RAG system—likely a retrieval failure where the correct chunk isn't in the top-k results. Then, propose a systematic evaluation: create a labeled set of queries with known relevant chunks, measure retrieval recall and answer accuracy, and compare against alternative chunking strategies to isolate the impact.

Pro tip: Don't just look at aggregate metrics—slice by query type (e.g., multi-hop, factoid, long-context) to see if chunking hurts specific categories. Also, inspect the actual retrieved chunks for failed queries to diagnose whether the issue is chunk boundaries, size, or overlap.

1. Define success metrics and failure modes

Clarify what constitutes a missed answer: retrieval miss (correct chunk not retrieved), context miss (chunk retrieved but answer not extractable), or generation miss. Choose metrics like recall@k, answer accuracy, and chunk-level precision/recall.

2. Build a labeled evaluation set

Curate a diverse set of queries with ground-truth relevant chunks and answers. Ensure coverage of different query types and document structures to detect chunking-specific weaknesses.

3. Run controlled experiments

Compare your current chunking strategy against alternatives (e.g., fixed-size vs. semantic, different sizes/overlaps) while keeping the retriever and generator constant. Measure the chosen metrics and perform statistical significance testing.

4. Analyze failures qualitatively

For queries where answers are missed, inspect the retrieved chunks and the original document. Determine if the answer spans chunk boundaries, is split across chunks, or if the chunk is too large/small to be retrieved effectively.

5. Iterate and validate

Based on findings, adjust chunking parameters or switch strategies, then re-evaluate on the same set to confirm improvement. Monitor for regressions on other query types.

Key Points to Mention

  • Retrieval recall@k and answer accuracy as key metrics
  • Creating a labeled dataset with ground-truth relevant chunks
  • Controlled A/B testing of chunking strategies
  • Analyzing chunk boundary issues (e.g., answers split across chunks)
  • Segmenting evaluation by query type (multi-hop, factoid, etc.)
  • Using error analysis to diagnose root causes (retrieval vs. generation)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

How would you handle questions that require synthesizing information across many documents rather than finding a single fact?

System DesignTechnical Trade-offs
Author's notes

This is where multi-hop retrieval comes in and I knew the concept but fumbled the explanation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame the problem as multi-hop retrieval and synthesis, then walk through a concrete system design that combines retrieval, reasoning, and generation. Emphasize trade-offs between accuracy, latency, and cost, and how you would evaluate such a system.

Pro tip: Show that you understand the difference between retrieval and synthesis: retrieval finds relevant documents, but synthesis requires reasoning over them. Mention that you would use a combination of dense retrieval, re-ranking, and a large language model with chain-of-thought or iterative reasoning to aggregate information.

1. Clarify the problem

Ask clarifying questions to understand the scale, document types, and what 'synthesizing' means (e.g., summarization, comparison, inference).

2. Design the retrieval pipeline

Propose a multi-stage retrieval system: initial dense retrieval to get candidate documents, then re-ranking with a cross-encoder to improve precision.

3. Incorporate reasoning and synthesis

Use a large language model to iteratively read and reason over retrieved documents, possibly with chain-of-thought or a graph-based approach to connect information.

4. Address trade-offs

Discuss trade-offs between accuracy and latency (e.g., number of retrieval rounds), and between cost and performance (e.g., model size).

5. Evaluate and iterate

Describe evaluation metrics (e.g., answer correctness, faithfulness) and how you would set up an offline evaluation pipeline with human feedback.

Key Points to Mention

  • Multi-hop retrieval and iterative reasoning
  • Dense retrieval (e.g., DPR) and re-ranking (e.g., cross-encoders)
  • Large language models for synthesis (e.g., GPT-4) with chain-of-thought
  • Trade-offs: latency vs. accuracy, cost vs. performance
  • Evaluation metrics: exact match, F1, faithfulness, human evaluation
  • Handling conflicting information and source attribution

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

How do you handle permissioned documents in retrieval and caching without leaking data across users or teams?

System DesignTechnical Trade-offs
Author's notes

Permission filtering at retrieval time, metadata tags on chunks, cache keys scoped to user or team.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the core challenge: retrieval and caching must respect access control boundaries to prevent data leakage. Then describe a layered architecture that enforces permissions at query time and cache key design, and discuss trade-offs between security, latency, and cost.

Pro tip: Emphasize that permission checks must happen at the data layer, not just the application layer, and that cache keys should incorporate user/team identifiers and permission scopes to avoid cross-contamination. Also mention the importance of auditing and monitoring for permission leaks.

1. Clarify requirements and constraints

Ask about the scale, latency requirements, and the granularity of permissions (e.g., per-user, per-team, per-document). Understand the sensitivity of data and compliance needs.

2. Design permission-aware retrieval

Ensure that document retrieval queries include permission filters at the database or search index level. Use row-level security or document-level ACLs to enforce access.

3. Implement secure caching

Design cache keys that include user/team IDs and permission scopes. Consider using separate caches per user/team or a shared cache with strict key isolation. Invalidate cache on permission changes.

4. Discuss trade-offs and optimizations

Balance security with performance: e.g., caching permission checks, using short TTLs, or employing a permission service. Mention potential latency and cost implications.

5. Address monitoring and auditing

Describe how to log access and detect anomalies. Implement regular audits to ensure no permission leaks and to comply with regulations.

Key Points to Mention

  • Row-level security and document-level ACLs in databases/search indexes
  • Cache key design incorporating user/team IDs and permission scopes
  • Cache invalidation strategies on permission changes
  • Trade-offs between security, latency, and cost (e.g., per-user caches vs. shared caches)
  • Use of a centralized permission service or policy engine (e.g., OPA)
  • Auditing and monitoring for permission leaks and compliance

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q7

What would change in your design if the task were summarizing an entire 200-page document rather than answering search queries over a corpus?

System DesignTechnical Trade-offs
Author's notes

Good closer question.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Contrast the two tasks by highlighting the shift from retrieval-based, query-focused answering to holistic, long-context summarization. Discuss how this changes the model architecture, training objective, and evaluation metrics, emphasizing trade-offs between context length, computational efficiency, and summary quality.

Pro tip: Emphasize that summarization requires capturing global coherence and salience across the entire document, not just local relevance to a query. Mention techniques like hierarchical attention or memory mechanisms to handle long contexts efficiently.

1. Clarify task differences

Explain that search queries over a corpus involve retrieval and localized answer generation, while summarizing a 200-page document requires global understanding and compression of information.

2. Adjust model architecture

Consider using hierarchical models (e.g., segment-level encoding then document-level fusion) or sparse attention to handle long inputs, as standard transformers may exceed memory limits.

3. Modify training objective

Shift from retrieval-augmented or question-answering losses to sequence-to-sequence summarization losses (e.g., cross-entropy on summary tokens) with techniques like teacher forcing or reinforcement learning for coherence.

4. Address computational constraints

Discuss memory and latency trade-offs: use gradient checkpointing, mixed precision, or model parallelism; consider retrieval-based summarization to select salient passages first.

5. Redefine evaluation

Move from precision/recall of retrieved answers to summarization metrics like ROUGE, BERTScore, or human evaluation of coherence, coverage, and conciseness.

Key Points to Mention

  • Context length limitations and techniques to extend them (e.g., sparse attention, hierarchical models, memory networks)
  • Change in training data and objective: from query-document pairs to document-summary pairs
  • Computational trade-offs: increased memory and compute for long documents, need for efficient attention mechanisms
  • Evaluation metrics: ROUGE, BERTScore, human evaluation for summarization vs. retrieval metrics like MRR, NDCG
  • Potential need for multi-stage approaches: extract salient sections then summarize
  • Handling of redundancy and ensuring global coherence in the summary

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.