Requirements Gathering and Scoping Questions
Eliciting, analyzing, and translating stakeholder and user needs into clear, scoped requirements and specifications. Covers cross-functional discovery, distinguishing needs from requests, and writing specs engineering can build against. Assesses the ability to bridge business intent and buildable definition.
Explain how you would translate a requirement for 'explainable batch decisions' (e.g., mass loan approvals) into a computational pipeline that supports both batch scoring and per-decision explanations. Include storage, computation, and downstream reporting considerations.
Sample Answer
Requirements clarification:
- Functional: run large-scale batch scoring (e.g., nightly 1M loan applicants), produce per-decision explanations accessible on-demand and in downstream reports, preserve audit trail.
- Non-functional: explainability fidelity, reproducibility, throughput (batch window), storage cost, security & privacy, regulatory auditability.
High-level architecture:
- Ingest → Feature Store → Batch Scorer → Explainability Engine → Decision Store → Reporting/API → Monitoring & Lineage
Components & responsibilities:
- Feature Store (online + offline)
- Store jailed feature definitions, transformations, timestamps.
- Materialize feature vectors for batch runs and for on-demand scoring to guarantee parity.
- Batch orchestration
- Use Spark/Kubernetes jobs scheduled via Airflow. Use autoscaling for throughput. GPUs for heavy models if needed.
- Batch job steps: fetch feature vectors from offline store → apply model(s) → write raw scores & metadata.
- Explainability Engine
- Two-tier approach:
- Precomputed explanations for deterministic/cheap methods: store SHAP values or additive feature attributions computed during batch scoring (using optimized TreeSHAP or explainers batched via XGBoost/LightGBM internals).
- On-demand higher-fidelity explanations: for black-box NN models use model-agnostic methods (KernelSHAP with sampling, LIME, or counterfactual generation) or local surrogate models. Explanations run via an async API for requests outside batch window.
- Store explanation artifacts (feature attributions, counterfactuals, surrogate model parameters) alongside score with pointers to model version and feature snapshots.
- Decision Store / Audit log
- Append-only store (e.g., columnar Parquet in data lake + metadata in OLTP DB for quick lookup) containing: applicant id, feature snapshot id, model id & hash, score, decision rule applied, explanation artifact id, timestamp, job id.
- Retain provenance: model registry entry, Git commit for transformations, container image tag.
- Reporting & Downstream
- Pre-aggregate metrics (approval rates, fairness metrics, explanation summaries) into BI tables nightly.
- Provide dashboards for regulators with sampled individual records and explanation views.
- Expose a low-latency API to fetch per-decision explanation artifacts and human-readable summary (top 3 drivers, actionable recourse).
Operational considerations:
- Reproducibility: tie every decision to model version, feature snapshot, random seed; store seeds for sampling explainers.
- Cost/fidelity trade-off: precompute cheap attributions for all records; run expensive, high-fidelity explainers on demand for audits or sample subsets.
- Latency: precompute to avoid heavy on-demand loads. Use caching (Redis) for recent explanation artifacts.
- Security & privacy: encrypt PII in storage, access controls, redact or aggregate sensitive features in reports. Apply differential privacy where required.
- Monitoring & QA: monitor explanation stability (distribution drift of top features), explanation runtime, and faithfulness (e.g., fidelity metrics for surrogates). Run synthetic tests asserting explanation consistency on known patterns.
- Governance: model registry for approvals, explainability policy (what kinds of explanations per audience), SLA for on-demand explanations.
Trade-offs:
- Storing full SHAP vectors increases storage but enables instant retrieval and consistent auditability. Alternative: store compressed top-k features and recompute full attribution on demand.
- On-demand high-fidelity explanations ensure best quality but require compute and longer latency.
Example flow (nightly):
- Airflow triggers Spark job → reads offline features → model scores → computes TreeSHAP attributions batched → write scores + attribution arrays to Parquet + register metadata in Decision Store → downstream ETL builds BI metrics and refreshes dashboards.
This pipeline balances scale, fidelity, auditability and cost, giving instant batch decisions with accessible per-decision explanations and governance-ready provenance.
Create a migration plan with success criteria for moving training pipelines from on-prem clusters to a managed cloud ML platform. Address data transfer and residency, reproducibility, environment parity, cost estimation, CI/CD changes, and a rollback plan if the cloud migration causes regressions. Provide measurable gates for each phase.
Sample Answer
Requirements & constraints (clarify up-front)
- Must preserve data residency/legal constraints (region-level)
- Preserve reproducibility and identical/acceptable model quality
- Support current GPU/accelerator requirements
- Minimal training downtime and ability to rollback quickly
- Budget cap / target ROI timeline
High-level phased migration (with measurable gates)
- Discovery & baseline (2–4 weeks)
- Actions: Inventory pipelines, dataset sizes, model compute (GPU hours), dependencies, baseline metrics (train time, validation metrics, cost/epoch).
- Gate: Baseline report completed; for 95% of pipelines we have metrics: epoch time, peak mem, dataset size, current infra cost estimate.
- Proof-of-Concept (pilot) — single representative model (2–6 weeks)
- Actions:
- Choose representative training job (largest GPU, or most common).
- Recreate environment via container image + infra-as-code (Terraform/CloudFormation).
- Transfer a subset/full dataset using secure multipart upload to cloud storage; use VPC endpoints, SSE, and KMS keys in chosen region to satisfy residency.
- Use ML metadata tracking (MLflow/Artifact Store) and dataset hashes + checksums to ensure reproducibility.
- Run N=5 repeat trainings deterministically (fixed seeds, same dataset snapshot).
- Success criteria (gates):
- Functional parity: validation metric within ±1–3% absolute of baseline OR within business-agreed tolerance.
- Performance: median epoch time ≤ 1.2x baseline (or target SLA).
- Reproducibility: identical evaluation outputs for deterministic runs; if non-deterministic, within statistical bounds (e.g., mean ± std within tolerance).
- Security/compliance: data stored only in allowed region; encryption verified.
- Cost estimate: cloud cost per epoch measured and projected monthly cost with 95% CI.
- Scale & performance optimization (4–8 weeks)
- Actions:
- Benchmark multiple instance types (GPUs, CPUs), use spot/preemptible for non-critical, autoscaling for distributed training.
- Implement caching, sharded dataset reads; test network I/O (use direct attach GPUs or NVLink equivalents).
- Update CI to run a smoke distributed training job.
- Gates:
- Throughput: end-to-end training time decreased or within agreed window (e.g., ≤1.1x).
- Cost: projected monthly training bill ≤ target (e.g., within 1.25x on-prem TCO), or clear ROI timeline.
- Reliability: job success rate ≥ 99% over 100 runs; mean time to recover from preemptions < configured threshold.
- Canary / staged rollout (4–8 weeks)
- Actions:
- Run production jobs in parallel (dual-run) for a subset (10–25%) of workloads for 2–4 weeks.
- Compare model metrics, training logs, artifacts, and downstream validation.
- Automate checks in CI/CD: unit tests, integration, and end-to-end training acceptance tests; add gating that compares model metric deltas.
- Gates:
- Model parity: held for 100% of canary jobs (within tolerance).
- Operational: monitoring (prometheus/cloud watch) shows acceptable resource usage and <5% failure rate.
- Stakeholder sign-off (data owners, compliance, model owners).
- Cutover & decommission
- Actions:
- Switch remaining jobs to cloud in batches, maintain dual-run for last batch for X days.
- Finalize cost monitoring, autoscaling rules, lifecycle policies for datasets.
- Run decommission checklist for on-prem GPUs and sensitive storage.
- Gates:
- No critical regressions in first 30 days (predefined SLA).
- Cost within projected envelope.
- All datasets validated for residency.
Reproducibility & environment parity (concrete practices)
- Build immutable runtime images (containerized training images) and store image hashes in registry.
- Capture infra as code (Terraform) with GPU SKU mapping table.
- Version datasets via content-addressed storage; record dataset snapshot IDs and checksums in experiment metadata.
- Use deterministic training flags where possible; log seeds, cudnn flags; record non-determinism sources.
- Maintain model registry with provenance (training config, code commit, container hash, dataset snapshot).
Data transfer & residency
- Use secure, resumable transfer (rclone/aws cli multipart, gsutil) with client-side and server-side encryption.
- For large datasets, consider physical transfer services or direct high-speed links (AWS Direct Connect / Azure ExpressRoute) if needed.
- Enforce region restrictions via VPC, KMS keys scoped to region, IAM policies; implement automated audits to check residency.
CI/CD changes
- Add training-stage pipelines:
- Pre-commit/build: container image build + unit tests.
- Integration: small-data smoke training on cloud runner.
- Pre-deploy canary: full-config training but on smaller budget/inputs.
- Gate: automated metric comparer that fails if metric delta > threshold.
- Add automatic artifact upload to registry/MLflow and automated deployment rollback triggers.
Cost estimation & controls
- Measure cost/epoch and extrapolate monthly with expected run counts.
- Use spot/preemptible VMs for fault-tolerant workloads; set max hourly budgets and alerts.
- Rightsize via benchmarking and autoscaling.
- Use budgets/alerts and automated policies to pause non-critical experiments once thresholds hit.
Rollback plan (if regressions detected)
- Immediate: abort offending cloud jobs and route workloads back to on-prem via dual-run fallback; maintain on-prem infra in warm-standby for X weeks.
- Revert: use model registry to deploy last-good model; restore dataset snapshots and container images.
- Post-mortem: triage logs, compare training artifacts, identify root cause (data skew, environment, precision).
- Criteria to rollback: any model metric drop beyond agreed SLA (e.g., >3% absolute), or production downstream alert rate increase >X%, or cost spike > Y% unexpectedly.
- Automation: CI/CD to support automated rollback when gates fail.
Monitoring & observability
- Track training metrics, system metrics, cost-per-job; set alerts for drift, failures, and cost overruns.
- Maintain audit logs for data access (for compliance).
Final success criteria (project-level)
- 100% of training pipelines can run in cloud with documented parity or acceptable tolerances.
- Reproducible artifacts with provenance for every trained model.
- Monthly training cost within projected budget or ROI achieved within defined window.
- No data residency violations; security and compliance audits pass.
- Rollback path validated with recovery RTO < agreed SLA (e.g., 4 hours) and RPO (dataset snapshot frequency).
This plan gives phased, measurable gates and concrete technical controls so migration can proceed safely, remain auditable for compliance, and be rolled back quickly if regressions occur.
A business owner asks for a quantitative estimate of the maximum tolerable false-positive rate for an automated content takedown feature to keep moderation costs under budget. Describe how you would model the relationship between false-positive rate, downstream moderation cost, and user harm, and how you'd find the acceptable operating point.
Sample Answer
Approach — build a simple, interpretable economic model that links false-positive rate (α) to expected moderation workload, direct costs, and user-harm costs, then solve for the largest α that satisfies the budget/harm constraints.
Model variables
- N = content items processed per period
- p_harm = prevalence of harmful content
- TPR, FPR = true-/false-positive rates (TPR = 1 − false-negative rate)
- c_manual = cost to manually review one takedown (labor + tooling)
- c_auto = incremental cost per automated decision (compute, infra) — often negligible
- c_FP = expected monetary-equivalent harm when a legitimate user is wrongly taken down (e.g., support cost, churn, legal risk)
- c_FN = harm of miss (policy risk, brand cost)
Expected flows
- Items flagged for takedown by model = N * (p_harm * TPR + (1 − p_harm) * FPR)
- If policy: automated takedown triggers manual review only for uncertain items, introduce threshold t; but for simplicity assume all flagged items incur manual review cost unless auto-action allowed.
Cost functions
- Manual cost = c_manual * N * (p_harm * TPR + (1 − p_harm) * FPR)
- User-harm from FPs = c_FP * N * (1 − p_harm) * FPR
- Harm from FNs = c_FN * N * p_harm * (1 − TPR)
- Total expected cost C(α) = manual_cost(α) + FP_harm(α) + FN_harm(α) + infra_costs
Constraint (budget) — e.g., manual_cost ≤ Budget_manual, or total C(α) ≤ Budget_total.
Solve for α_max
- If budget targets manual moderation: solve c_manual * N * (p_harm * TPR(α) + (1 − p_harm) * α) ≤ Budget_manual
- Rearranged: α ≤ [Budget_manual / (c_manual * N) − p_harm * TPR(α)] / (1 − p_harm)
- If TPR is a function of α (ROC curve / precision-recall tradeoff), plug in empirical TPR(α) from validation data and solve numerically for α_max (root-finding or simple grid search).
Practical steps
- Empirically estimate p_harm and ROC/precision-recall from labeled data.
- Quantify c_manual, c_FP, c_FN (business finance + legal + ops + estimated churn).
- Build C(α) using real TPR(α) curve; solve numerically for α that satisfies budget or minimizes weighted sum of cost+harm: minimize C(α) or constrained optimization using Lagrangian if multiple constraints.
- Run sensitivity analysis on c_FP, p_harm, and labor cost; choose conservative α if uncertainty high.
- Validate with A/B test and monitor live metrics (manual queue size, overturn rate, user appeals, churn). Adjust thresholds and retrain model.
Example (toy): N=1M/month, p_harm=0.01, c_manual=$5, Budget_manual=$20k → allowable flagged volume = 4k reviews → with TPR(α)=0.9 at α=0.02, flagged = 1M*(0.010.9 + 0.990.02)=1M*(0.009+0.0198)=28.8k → exceeds budget → reduce α until flagged ≤4k; compute numerically to find α_max ≈ 0.003.
Notes
- Use empirical ROC curves; include downstream costs (appeals, legal).
- Prefer optimizing total expected cost (including user harm) rather than manual-only, and run continuous monitoring and sensitivity updates.
Create an infrastructure assessment checklist to decide if a legacy production system can support a new model that requires GPU inference. Include questions about throughput requirements, model size, latency targets, deployment automation, monitoring, rollback, and budget constraints.
Sample Answer
Situation: You're evaluating whether a legacy production system can host a new GPU-based inference model. Use this checklist to scope feasibility, risks, and gaps.
- Functional & model requirements
- What is the model type (FP32/FP16/INT8), exact size (GB parameters + peak memory during inference)?
- Is model quantizable or needs FP32? Is GPU-only runtime required (CUDA, ROCm, TensorRT, ONNX)?
- Throughput & latency
- Required QPS and concurrency (requests/sec, peak vs sustained)?
- Latency SLOs (p50/p95/p99) per request and tail-latency budget.
- Batchability: can requests be batched? Target batch sizes and acceptable added latency.
- Hardware capability
- Current servers: CPU, RAM, GPU presence, PCIe/NVLink topology, GPU memory per card.
- Do GPUs match model needs (memory, compute capability, tensor cores)? Availability for dedicated or multi-tenant use?
- Network I/O and storage performance (model load times from disk/object store).
- Deployment & automation
- CI/CD readiness: automated builds, image signing, reproducible environments?
- Container orchestration: Kubernetes version, GPU device plugin, node labeling, scheduling for GPU pods.
- Inferencing runtimes supported (Docker, containerd, Triton, KFServing).
- Scaling & resilience
- Autoscaling policy (horizontal GPU nodes vs vertical multi-GPU pods).
- Load balancing, request routing, and backpressure handling.
- Cold-start behavior and model warm-up time.
- Monitoring & observability
- Metrics: throughput, latency histograms, GPU utilization, memory, temperature, model errors, input distribution drift.
- Tracing and request-level logs to correlate performance to inputs.
- Alerting thresholds and dashboards.
- Rollout & rollback
- Can you do canary/blue-green deployments and traffic shifting?
- Automated rollback triggers (error spike, latency breach, SLO violations).
- Versioned model artifacts and reproducible rollback images.
- Reliability & safety
- How is input validation, adversarial protection, and output sanity-checking handled?
- Data privacy/regulatory constraints for GPU-hosted inference.
- Cost & budget
- Total cost estimate: GPU instances (on-prem amortized or cloud hourly), storage, networking, licenses, engineering effort.
- Run cost per 1k predictions and break-even vs business value.
- Budget limits and acceptable trade-offs (latency vs cost via batching/quantization).
- Gap analysis & mitigation plan
- For each unmet requirement, propose remediation (add GPUs, upgrade drivers, implement quantization, add autoscale policies) and estimate time/cost.
Use this checklist to score readiness (Green/Yellow/Red) and produce a short remediation plan with prioritized fixes and cost estimates.
A stakeholder wants to know how long it will take to move an OCR prototype to production. Provide a breakdown of phases (data collection/labeling, infra, model training, integration, testing), estimate durations for each given a small to medium enterprise team, and list major risks that could extend timelines.
Sample Answer
Assumptions: small–medium enterprise team = 1 ML engineer lead + 1-2 ML engineers, 1 data engineer, 1 software engineer, 1 QA, access to cloud GPUs, and stakeholder availability. Target: deploy a reliable OCR microservice (document images → structured text) for production use, not research-grade SOTA.
Phased breakdown with durations (ranges):
- Discovery & requirements (1–2 weeks)
- Define languages, document types, accuracy targets, throughput, privacy/compliance, success metrics, and acceptance criteria.
- Data collection & labeling (4–8 weeks)
- Collect representative images (scanned, photos), annotate text bounding boxes + transcription. If using synthetic augmentation and pre-trained models, time on lower end. Deliverables: labeled dataset, data schema.
- Infrastructure & tooling (2–4 weeks, parallelizable)
- Set up storage, data pipeline, labeling tools, CI/CD, GPU instances, monitoring, and model registry. Containerization and infra-as-code included.
- Model selection & training (3–6 weeks)
- Fine-tune pre-trained OCR/transformer models, iterate on hyperparameters, augmentation, domain adaptation. Includes validation and initial robustness tests.
- Integration & API development (2–3 weeks)
- Wrap model into service, build inference pipeline, batching, scaling, auth, logging.
- Testing & validation (2–4 weeks)
- Unit, integration, performance, A/B tests, user acceptance testing, error-analysis, and edge-case tests. Includes building automated regression tests.
- Deployment & monitoring (1–2 weeks)
- Canary rollout, monitoring dashboards, alerting, rollback plan, SLOs.
Total estimated time: 15–29 weeks (≈4–7 months). With strong reuse of pre-trained models and extensive automation this can compress to ~8–12 weeks.
Major risks that can extend timelines:
- Insufficient or unrepresentative labeled data — mitigation: synthetic data, active learning.
- Complex document variability (layouts, languages, handwriting) — mitigation: phased scope, incremental support.
- Labeling throughput and quality issues — mitigation: clear guidelines, QA sampling, labeling tool support.
- Integration/performance surprises at scale (latency, memory) — mitigation: load testing early, model optimization (quantization).
- Compliance/privacy constraints slowing data access — mitigation: early legal engagement, synthetic data.
- Dependency bottlenecks (stakeholder availability, infra quotas) — mitigation: clear timelines, parallelize tasks.
Key metrics to track: character/word accuracy, F1 on extraction tasks, latency P95, error rates by document type, and labeling velocity.
Unlock Full Question Bank
Get access to all Requirements Gathering and Scoping interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.