Level 2 — RecallMLOps & Deployment

MLOps & Deployment

30 minutes40 marksprintable — key stays hidden on paper

Difficulty: Level 2 (Recall & Standard Problems) Time Limit: 30 minutes Total Marks: 40


Instructions

Answer all questions. Show working for numeric problems. Use appropriate units where required.


Q1. Define the following in one line each and state the key difference between them: (4 marks) (a) Data drift (b) Concept drift

Q2. List the four broad stages of the ML project lifecycle in correct order. (4 marks)

Q3. Explain the difference between batch inference and real-time inference. Give one suitable use case for each. (4 marks)

Q4. A REST endpoint served with FastAPI receives requests. In one deployment, the model handles 250 requests/second and each request occupies a worker for 20 ms on average. Using Little's Law, compute the average number of requests being processed concurrently (in-system). (4 marks)

Q5. State the purpose of the following tools and to which MLOps concern each belongs: (6 marks) (a) DVC (b) A model registry (c) A feature store

Q6. A container image is built in layers. The base layer is 900 MB, the dependencies layer is 350 MB, and the application code layer is 15 MB. If only the application code changes between two builds, how many MB must be rebuilt/re-pushed (assuming layer caching)? What is this saving as a percentage of the full image size? (5 marks)

Q7. Define CI/CD in the context of ML pipelines and name two things a continuous integration stage typically validates for an ML project. (4 marks)

Q8. What is ONNX and why is it useful for edge deployment? State two benefits. (4 marks)

Q9. A quantized LLM stores weights in INT8 instead of FP32. For a model with 7 billion parameters, compute the memory required to store weights in each format (in GB, using 1 GB = 10910^9 bytes) and the reduction factor. (5 marks)


End of paper.

Answer keyMark scheme & solutions

Q1. (4 marks)

  • (a) Data drift: change in the statistical distribution of the input features P(X)P(X) over time, while the input→output relationship may be unchanged. (1.5)
  • (b) Concept drift: change in the relationship between inputs and target P(YX)P(Y\mid X) over time. (1.5)
  • Key difference: data drift affects the inputs' distribution; concept drift affects the mapping/decision boundary itself. (1)

Q2. (4 marks) — 1 mark each, order matters:

  1. Data collection & preparation → 2. Model development/training → 3. Deployment/serving → 4. Monitoring & maintenance (retraining). (Accept "problem definition" as stage 0.)

Q3. (4 marks)

  • Batch inference: predictions computed on a large set of data at scheduled intervals; high throughput, latency tolerant (1). Use case: nightly churn scoring of all customers (1).
  • Real-time inference: predictions served on-demand per request with low latency (1). Use case: fraud detection at transaction time / recommendation on page load (1).

Q4. (4 marks) — Little's Law: L=λWL = \lambda W.

  • λ=250\lambda = 250 req/s, W=20 ms=0.02W = 20\text{ ms} = 0.02 s (1).
  • L=250×0.02=5L = 250 \times 0.02 = 5 (2).
  • Answer: on average 5 requests are being processed concurrently (1).

Q5. (6 marks) — 2 marks each (purpose 1 + concern 1):

  • (a) DVC: version-controls large datasets/model files alongside Git — concern: data versioning / reproducibility.
  • (b) Model registry: central store to version, stage (staging/production), and track model artifacts — concern: model versioning & governance.
  • (c) Feature store: central repository serving consistent features for training and inference (avoiding train/serve skew) — concern: feature management & serving.

Q6. (5 marks)

  • Only the changed application code layer is rebuilt/re-pushed = 15 MB (2).
  • Full image = 900+350+15=1265900 + 350 + 15 = 1265 MB (1).
  • Saving = 126515=12501265 - 15 = 1250 MB not re-pushed; as percentage: 1250/1265×10098.8%1250/1265 \times 100 \approx 98.8\% (2).

Q7. (4 marks)

  • CI/CD = Continuous Integration / Continuous Delivery(Deployment): automating the building, testing, and releasing of code/models so changes are integrated and deployed reliably and frequently (2).
  • CI stage validates (any two, 1 each): unit tests on code, data validation/schema checks, model training runs successfully, model quality/metric thresholds, linting/reproducibility checks.

Q8. (4 marks)

  • ONNX (Open Neural Network Exchange): an open, framework-agnostic format to represent/export trained models (2).
  • Benefits (any two, 1 each): interoperability across frameworks; optimized/portable runtime (ONNX Runtime) for edge/CPU; smaller/faster inference; hardware acceleration without framework dependency.

Q9. (5 marks)

  • FP32 = 4 bytes/param: 7×109×4=2.8×10107\times10^9 \times 4 = 2.8\times10^{10} bytes = 28 GB (2).
  • INT8 = 1 byte/param: 7×109×1=7×1097\times10^9 \times 1 = 7\times10^{9} bytes = 7 GB (2).
  • Reduction factor = 28/7=4×28/7 = 4\times (1).
[
  {"claim":"Little's Law: L = 250 req/s * 0.02 s = 5 concurrent requests","code":"lam=250; W=0.02; result=(lam*W==5)"},
  {"claim":"Docker rebuild saving is 1250 MB, ~98.8% of full image","code":"full=900+350+15; changed=15; saved=full-changed; pct=saved/full*100; result=(saved==1250 and abs(pct-98.814)<0.01)"},
  {"claim":"FP32 weights = 28 GB, INT8 = 7 GB, 4x reduction","code":"p=7e9; fp32=p*4/1e9; int8=p*1/1e9; result=(fp32==28 and int8==7 and fp32/int8==4)"}
]