Вопрос про production ML
A new perception detector improves some offline metrics but degrades others. How do you decide whether to ship it to production?
Сначала проговорите ответ вслух или тезисами.
Формулы, план решения, риски и примеры.
Откройте разбор только после своей попытки.
Показать разбор
Короткий ответ
Do not average metrics blindly. Map them to product and safety costs, inspect critical slices, require guardrails, and roll out only if the target operating point improves without violating constraints.
Подробный разбор
For an autonomous-driving detector, the decision is not simply "two metrics up, two down". First define what each metric means for the product and safety case. A small recall regression on pedestrians can be unacceptable even if mAP improves, while extra false positives might be tolerable if the planner can safely slow down.
The practical flow is to choose primary metrics and guardrails, inspect per-class and per-scenario slices, evaluate at the intended threshold or operating point, and compare against regression budgets. Important slices can include pedestrians, cyclists, night, rain, occlusion, distance buckets and rare critical scenarios.
Only after offline checks pass should the team consider shadow mode, canary, simulation replay or staged rollout. The stronger answer explicitly ties metrics to downstream system behavior and business/safety constraints rather than treating every offline metric equally.
Типичные ошибки
- Average unrelated metrics into one score with no justification.
- Ignore safety-critical slices.
- Ship directly from offline improvement without rollout controls.
Как сказать на собеседовании
- Say which error is worse for this product.
- Mention threshold choice and per-slice validation.
ML System Design
You are given an uncertain research-heavy ML project that eventually must be shipped as a working артефакт. How do you decompose the work and communicate progress?
Сначала проговорите ответ вслух или тезисами.
Формулы, план решения, риски и примеры.
Откройте разбор только после своей попытки.
Показать разбор
Короткий ответ
Decompose into deterministic milestones first: data and eval setup, runnable baseline, reproducible experiments, artifact packaging and rollout checks. Do not commit early to unreachable metric targets.
Подробный разбор
For uncertain research, the first goal is to reduce unknowns while producing concrete artifacts. Start by clarifying the product objective, constraints, available data, evaluation protocol and what "usable" means. Then create milestones that are under engineering control: collect or freeze a dataset, build the metric harness, reproduce a known baseline, make one model run end to end, package inference, and prepare failure analysis.
Metric targets can be aspirational, but early commitments should be about evidence-producing steps. For example, commit to "we will run baseline X on dataset Y and produce slice metrics and examples" rather than "we will hit 99.9%". After the baseline, decide whether to continue, pivot or narrow scope based on measured gaps.
Progress communication should show artifacts: experiment tables, model cards, qualitative examples, bad-case buckets, ablations, cost/latency numbers and a clear next decision. This keeps stakeholders informed without pretending research is deterministic.
Типичные ошибки
- Commit to a final metric before knowing baseline feasibility.
- Spend weeks chasing papers before building the eval harness.
- Report only activity instead of evidence and decisions.
Как сказать на собеседовании
- Use the phrase runnable baseline early.
- Name both technical artifacts and stakeholder-visible artifacts.
Reservoir sampling: один равномерный элемент из потока
Опишите алгоритм reservoir sampling для одного элемента из потока и объясните, почему каждый увиденный элемент выбирается с одинаковой вероятностью.
Сначала проговорите ответ вслух или тезисами.
Формулы, план решения, риски и примеры.
Откройте разбор только после своей попытки.
Показать разбор
Короткий ответ
Храним счетчик n и текущий sample. На n-м элементе заменяем sample новым элементом с вероятностью 1/n. После этого каждый из n увиденных элементов хранится с вероятностью 1/n.
Подробный разбор
Это reservoir sampling с reservoir size = 1. Храним два состояния: сколько элементов уже увидели и текущий выбранный элемент. Первый элемент сохраняем сразу. Когда приходит n-й элемент, заменяем сохраненный элемент с вероятностью 1/n, иначе оставляем старый.
Доказательство идет по индукции. Новый n-й элемент выбран с вероятностью 1/n. Любой старый элемент после n - 1 шагов хранился с вероятностью 1/(n - 1) и переживает n-й шаг с вероятностью 1 - 1/n = (n - 1)/n. Произведение равно 1/n.
Для m samples без возвращения используется reservoir размера m: сначала заполняем первые m элементов, затем для n-го элемента выбираем случайный индекс из [1, n] и заменяем элемент reservoir, если индекс попал внутрь reservoir.
Типичные ошибки
- Хранить весь поток и выбирать элемент в конце.
- Использовать фиксированную вероятность замены.
- Доказать вероятность для нового элемента, но забыть проверить старые элементы.
Как сказать на собеседовании
- Сформулируй инвариант после n увиденных элементов.
- Дай короткое индукционное доказательство.