Summarize a Multi-Gigabyte Eval Results File Without Loading It Into Memory

Last updated: November 29, 2026

Quick Overview

Given a JSONL file of model eval results that is too large for RAM, each line holding a task name and whether the model was correct, compute per-task accuracy and return a uniform random sample of k failing rows for manual review, in one pass with bounded memory.

OpenAI
Software Engineering Fundamentals
Software Engineer
OpenAI
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Given a JSONL file of model eval results that is too large for RAM, each line holding a task name and whether the model was correct, compute per-task accuracy and return a uniform random sample of k failing rows for manual review, in one pass with bounded memory.

OpenAI researchers and engineers run evals that produce huge result dumps, and tooling that calls json.load on the whole file falls over. The interviewer is checking streaming I/O, memory reasoning, reservoir sampling, and robustness to dirty data.

What the Interviewer Expects
  • Iterates the file line by line instead of reading it whole
  • Keeps memory proportional to the number of tasks plus k
  • Implements reservoir sampling correctly
  • Skips and counts malformed lines instead of crashing
  • Explains how the Python object overhead would blow up a naive approach
Key Topics to Cover
streaming I/O
reservoir sampling
memory efficiency
generators
data robustness
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you parallelize this across many shards and merge the results?
  • How would you merge reservoir samples from different shards correctly?
  • What if you need the median latency per task as well?
  • Why might the process still use more memory than you expect?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

One pass, memory independent of file size. Outputs: {task: accuracy}, a uniform sample of up to k failures, and a count of bad lines....

High-Level Design

A Python file object is an iterator that yields one line at a time from a buffered reader, so memory stays flat. Loading 10 GB of JSON into dicts can take several times that in RAM because every strin...


Submit Your Answer
Markdown supported