Design a Low-Latency Grammatical Error Correction Serving System

Last updated: November 29, 2026

Quick Overview

Design the ML system that turns a user's sentence into grammar corrections with a p95 latency under 150 ms at very high request volume, including model choice, serving infrastructure, and how you keep precision high as models are retrained.

Grammarly
ML System Design
Machine Learning Engineer
Grammarly
November 29, 2026
Machine Learning Engineer
System Design Round
ML System Design
Hard

0

0

0 solved


Design the ML system that turns a user's sentence into grammar corrections with a p95 latency under 150 ms at very high request volume, including model choice, serving infrastructure, and how you keep precision high as models are retrained.

Grammatical error correction is Grammarly's flagship ML problem, and its research group has published sequence-tagging approaches precisely because autoregressive decoding is slow. The interviewer wants model trade-offs tied to latency and cost, a sound offline and online evaluation story, and attention to user trust.

What the Interviewer Expects
  • Compare sequence tagging (edit labels per token) with seq2seq or LLM rewriting on latency and controllability
  • Lay out a serving path with batching, quantization and caching
  • Choose precision-weighted metrics offline and acceptance-based metrics online
  • Describe data sources and how user feedback flows back without leaking private text
  • Include confidence thresholds per error category and a safe rollout
Key Topics to Cover
sequence tagging
GEC
F0.5
quantization
dynamic batching
feedback loops
How to Approach This
  1. Start by mapping the business objective to a concrete ML objective and metric.
  2. Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
  3. Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
  4. Address the serving latency budget and whether batch or real-time inference is needed.
  5. Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
  • How do you handle multiple iterative edits in one sentence with a tagger?
  • How would you use an LLM to improve the system without putting it on the hot path?
  • What changes for a new dialect or language with little labeled data?
Sharpen Your Skills on Codemia

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

Practice ML System Design Problems
Sample Answer
Requirements

Input: sentence plus context (dialect, domain, user settings). Output: edits with span, replacement, category and confidence. Constraints: p95 150 ms end to end per sentence, hundreds of thousands of ...

High-Level Design

Pipeline: sentence splitter and tokenizer, then a tagging model (transformer encoder predicting per-token edit tags such as KEEP, DELETE, REPLACE_x, APPEND_x, or verb-form transforms), applied for...


Submit Your Answer
Markdown supported

Related Questions