Skip to content

2300: Framework Engineering - Quiz

⏱ 6 min read·📅 Last updated: 2026-10-22

Test your knowledge of framework design patterns and deployment.


Contents


Instructions

  1. Answer all questions
  2. You need 80% to pass
  3. Take your time - no time limit
  4. Reference materials are allowed

Passing Score: 20/25 (80%)


Multiple Choice Questions

Question 1: Model Abstraction

What is the primary benefit of using a model abstraction layer?

  • A) Framework-agnostic code
  • B) Better accuracy
  • C) Faster training
  • D) Smaller model size

Question 2: Design Patterns

Which pattern allows runtime algorithm selection?

  • A) Registry Pattern, a lookup that never swaps algorithms at runtime
  • B) Strategy Pattern
  • C) Factory Pattern
  • D) Observer Pattern

Question 3: Configuration Management

Why use dataclasses for configuration?

  • A) Faster execution, a speedup dataclasses have never been measured to deliver
  • B) Better serialization
  • C) Type safety and validation
  • D) Lower memory usage

Question 4: Throughput via Batching

What is the main benefit of request batching?

  • A) Smaller models, a size change batching never applies to any weights
  • B) Better accuracy
  • C) Lower latency
  • D) Higher throughput

Question 5: Model Parallelism

When should you use model parallelism?

  • A) For small models, workloads that fit a single GPU with room to spare
  • B) When model doesn't fit on one GPU
  • C) Always
  • D) For faster training

Question 6: Blue-Green Deployment

What is a key advantage of blue-green deployment?

  • A) Better performance
  • B) Lower cost
  • C) Zero downtime
  • D) Faster deployment

Question 7: Canary Rollout Strategy

What is canary deployment?

  • A) Deploy to production immediately, a full-traffic jump that skips measurement entirely
  • B) Deploy multiple versions simultaneously
  • C) Gradual rollout to small percentage of traffic
  • D) Automatic deployment

Question 8: REST API Design

Which HTTP method is most appropriate for model prediction?

  • A) POST
  • B) GET
  • C) PUT
  • D) DELETE

Question 9: Rate Limiting

Why implement rate limiting?

  • A) To reduce model size, a footprint rate limiting has no mechanism to touch
  • B) To improve accuracy
  • C) To prevent abuse and manage load
  • D) To speed up requests

Question 10: Plugin Architecture

What problem do plugin registries solve?

  • A) Faster model training, a speedup registration machinery has never produced
  • B) Reduced memory usage
  • C) Better model accuracy
  • D) Dynamic component loading

Question 11: A/B Testing

What is the purpose of A/B testing ML models?

  • A) To reduce training time, a saving traffic splitting cannot deliver on its own
  • B) To compare model performance in production
  • C) To reduce model size
  • D) To improve model accuracy

Question 12: Rolling Updates

What happens during a rolling update?

  • A) No instances updated
  • B) Instances updated one by one
  • C) All instances updated at once
  • D) Only some instances updated

Question 13: API Error Handling

What HTTP status code indicates rate limiting?

  • A) 429
  • B) 404, a code for missing resources rather than exhausted quotas
  • C) 400
  • D) 500

Question 14: Docker in ML

Why use Docker for ML model deployment?

  • A) Better models
  • B) Less memory usage
  • C) Faster training, a speed gain containerization itself never supplies
  • D) Consistent environment

Question 15: Streaming APIs

When would you use Server-Sent Events (SSE)?

  • A) For real-time token generation
  • B) For data loading
  • C) For batch predictions, a workload where streamed events add overhead, not value
  • D) For model training

Coding Questions

Question 16: Implement Abstract Base Class

Create an abstract base class for ML models with forward() and train_step() methods.

from abc import ABC, abstractmethod

class BaseModel(ABC):
    @abstractmethod
    def forward(self, x):
        pass

    @abstractmethod
    def train_step(self, batch):
        pass

Score: __/2


Question 17: Implement Configuration Class

Create a configuration class with validation:

from dataclasses import dataclass

@dataclass
class ModelConfig:
    hidden_size: int
    learning_rate: float = 0.001

    def __post_init__(self):
        if self.hidden_size <= 0:
            raise ValueError("hidden_size must be positive")

Score: __/2


Question 18: Implement Plugin Registry

Create a simple plugin registry:

class PluginRegistry:
    def __init__(self):
        self._plugins = {}

    def register(self, name):
        def decorator(cls):
            self._plugins[name] = cls
            return cls
        return decorator

    def get(self, name):
        return self._plugins.get(name)

Score: __/2


Question 19: Implement Batch Processing

Write code to process requests in batches. The model is passed in explicitly so the function has no hidden dependencies:

def process_batch(requests, model, batch_size=32):
    """Run model.predict over requests in fixed-size batches."""
    results = []
    for i in range(0, len(requests), batch_size):
        batch = requests[i:i+batch_size]
        batch_results = model.predict(batch)
        results.extend(batch_results)
    return results

Score: __/2


Question 20: Deploy with Docker

Write a Dockerfile for ML API:

FROM python:3.13-slim
WORKDIR /app
# Official uv-in-Docker pattern: copy the uv binary from the uv image
# (https://docs.astral.sh/uv/guides/integration/docker/)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Dependency layer: only manifest/lockfile changes rebuild this.
COPY pyproject.toml uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
    uv sync --locked --no-install-project
COPY . .
EXPOSE 8000
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]

Score: __/2


Answer Key

Multiple-choice answers for Questions 1-15. Questions 16-20 are self-graded coding questions — score them against the model solution using the Self-Grading rubric below.

Question Answer Explanation
1 A Abstraction layers swap PyTorch, TensorFlow etc. without app changes
2 B Strategy Pattern selects algorithms at runtime
3 C Dataclasses give type hints, validation and dict serialization
4 D Batching raises GPU utilization and throughput
5 B Split the model across GPUs when it exceeds one GPU
6 C Blue-green keeps blue running while green deploys, instant rollback
7 C Canary ships to a small percentage, grows as metrics hold
8 A POST carries complex prediction payloads
9 C Rate limiting blocks abuse and protects resources
10 D Registries load and discover components dynamically
11 B A/B compares versions on real production traffic
12 B Rolling updates replace instances gradually, keeping availability
13 A 429 Too Many Requests signals rate limiting (RFC 6585)
14 D Docker keeps environments consistent across stages
15 A SSE streams token-by-token generation in real time

Scoring

Calculate Your Score

Multiple Choice: 15 questions x 1 point = 15 points
Coding Questions:  5 questions x 2 points = 10 points
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total: 25 points

Results

  • 23-25 points: Excellent! 🌟
  • 20-22 points: Pass ✅
  • 18-19 points: Review recommended
  • Below 18: Retake module

Self-Grading

Grade your coding questions honestly (each is worth up to 2 points):

  • 2 points: Complete and correct
  • 1 point: Mostly correct with minor issues
  • 0 points: Incomplete or incorrect

Need to Review?

Each question maps to the lesson that teaches it:


Summary

  • 20 questions covering all four module lessons plus the hands-on guide: model abstraction and design patterns (2301), serving and batching (2302), API design (2303), deployment strategies (2304), and end-to-end framework building (2306).
  • 25 points total — 15 multiple-choice (1 point each) plus 5 coding questions (2 points each); 20/25 (80%) passes.
  • Self-graded: score the coding questions against the reference code using the honest 2/1/0 scale.
  • Every wrong answer points back to the exact lesson that teaches it — use the review map above before retaking.
  • Once you pass, you're ready to move on! 🎉

References

External References


Next Steps

  1. Score below 20? Work through the review map above, then retake.
  2. Passed? Deepen the hands-on skills with 2300: Framework Engineering - Practice Exercises, then do the practical labs:
  3. Next Module: 2400: LLM Pretraining

Related: 2300: Framework Engineering · 2304: Production Deployment Patterns · TUTORIAL-003: RAG Basics - Give Your LLM Knowledge

Experiment: No EXP_23xx exists yet — nearest relevant: EXP_1403: TGI (Text Generation Inference) Tuning Experiments (serving-layer performance, matches this module's serving themes).