ELLMEngineering Large
Language Models
Download PDF

OPTIONAL COMPANION

All supplements

Optional professional-development exercises

These exercises are separate from the technical reading path.

Leadership Evidence and Reflective Practice

A leadership story demonstrates scope, judgment, and durable influence. It explains the technical mechanism and the organizational mechanism with equal precision.

The SCORE structure

One optional outline is SCORE. Use it to recover the evidence for a real decision, not to turn every experience into the same five-paragraph success story:

The account should make clear what you did without erasing the team. Use "I" for decisions and actions you owned, "we" for collective execution, and name partners' contributions. Use real evidence when describing your work; if an outcome was not measured, explain the observable change and the limit of the evidence instead of inventing a metric.

Customer obsession

Weak story: you optimized latency because a dashboard was red. Strong story: you traced how latency disrupted a customer workflow, discovered that the aggregate metric hid long-context users, changed the SLO and scheduler, and created a recurring customer-to-capacity review.

Include a hard tradeoff. Customer obsession is not saying yes to every request; it is understanding the underlying outcome and choosing the most durable response.

Growth mindset

Choose a failure or changed belief with consequence. Explain the evidence that contradicted you, how you created safety while revising course, and which mechanism changed afterward. "I learned to communicate more" is too generic.

Example: a custom kernel project missed launch because the team optimized a microbenchmark rather than engine replay. You stopped the rollout, rebuilt the benchmark contract, introduced shape-distribution review and numerical gates, and later achieved a smaller but real end-to-end gain.

Diversity and inclusion

Use engineering mechanisms, not slogans. Examples include changing design-review participation, reducing timezone bias in decisions, auditing data or evaluation slices, improving hiring calibration, sponsoring a colleague into visible ownership, or designing accessibility into a developer tool.

Name the observed barrier, your intervention, the voices included, and measured outcome. Avoid telling another person's private story or positioning yourself as the sole rescuer.

Ambiguity

Ambiguity stories should show how you created clarity without inventing certainty. State what was unknown, how you bounded it, which decisions were reversible, and what you deliberately postponed.

At broad organizational scope, ambiguity often spans organizations: no shared metric, unclear ownership, or incentives that reward local optimization. The story should show the mechanism that aligned those surfaces.

Hiring and mentorship

Mentorship is not only advice. It creates increasing ownership. Describe how you diagnosed a growth edge, set a stretch assignment with safety, provided feedback, opened stakeholder access, and stepped back. Hiring stories should include role definition, calibrated signal, closing, and the team's capability after hire.

An evidence notebook

Keep a small set of decision records for reflection, mentorship, and interviews. Record the original uncertainty and contrary evidence while they are still available; a polished retrospective can otherwise make an ambiguous choice look inevitable.

Story Primary signal Useful alternate prompts
Cross-org platform migration Influence, vision Conflict, customer, prioritization
Failed optimization and recovery Learning, judgment Risk, quality, delivery
Severe production incident Ownership, calm execution Ambiguity, communication
Architecture disagreement Technical depth, alignment Backbone, tradeoffs
Talent growth Mentorship Delegation, inclusion
Product-quality tradeoff Customer judgment Data, metrics, ethics

Design Exercises

  1. Tell a customer-obsession story with a non-obvious tradeoff.
  2. Describe a technical belief you changed after contradictory evidence.
  3. Show inclusion through an engineering or decision mechanism.
  4. Explain a cross-org disagreement without making the other side irrational.
  5. Demonstrate mentorship by the ownership the other person gained.

Leadership exercise criteria

Apply this rubric to every exercise in Part VIII. A strong answer names the decision and accountable owner; distinguishes evidence from uncertainty; presents a credible alternative or dissenting view; installs a mechanism with a cadence or trigger; and defines an observable reversal, escalation, or completion boundary. Prefer a smaller claim supported by durable evidence over a sweeping story whose outcome cannot be verified.

Three decision cases

The following cases are fictional teaching examples, not claims about the author's employment or measured project outcomes. They serve as model answers for migration, prioritization, and incident decisions: each uses a concrete choice to show what a leadership mechanism changes.

A migration that passes the average and fails a customer

A team proposes a new embedding model for the documentation assistant in Part VI. In this scenario, aggregate evidence recall rises from 88 to 92 percent, but recall for a small, heavily filtered tenant falls from 84 to 69 percent. These are invented scenario values. The new index also uses the same vector dimension as the old one, which makes an accidental mixed-version query look superficially valid.

The decision is to delay tenant-wide cutover, not to reject the model permanently. The retrieval owner creates versioned query/index pairs; the access-control owner checks eligibility at both retrieval and context assembly; the release owner adds a per-tenant regression gate. Keep the old pair routable during shadow traffic and canary deployment. The next experiment varies filtered candidate budgets on the failing slice while measuring latency.

The contribution is the release boundary: a visible owner, a customer-level guardrail, and a rollback unit. “The average improved” is insufficient evidence for the affected tenant. Conversely, demanding that every query improve would make change impossible; agree on material slice-level regressions and hard security gates before seeing results.

A faster kernel that does not change the roadmap

A kernel experiment is faster in isolation, but trace replay shows that the service still misses its latency target during long-prompt bursts. Profiling identifies queueing ahead of prefill as the dominant tail. The kernel result can be valid while its priority is wrong.

Keep the optimization and its reproducible benchmark, but move the next experiment to admission and prefill scheduling. Assign one engineer to reproduce the end-to-end trace with a fixed arrival process, and another owner to define the acceptable rejection policy with the product team. Compare SLO-constrained goodput, not just completed tokens per second.

The decision record should say which hypothesis failed: “kernel time dominates user-visible tail latency” was not supported by this workload. It should not say that the engineer's work failed. Preserve the useful code, the shapes where it wins, and the evidence that changed prioritization. This makes a negative result reusable instead of encouraging the team to hide it.

An incident where speed and confidentiality disagree

After a permissions rollout, the documentation assistant begins returning cached answers under an outdated access scope. Disabling the new permission service would restore response latency but could continue disclosure. The incident commander separates the objectives: stop unauthorized answers first, then recover availability inside the access boundary.

Disable affected answer-cache reads and fail closed for protected content whose authorization cannot be established. Preserve scoped diagnostic evidence without copying confidential answers into a broad incident channel. One owner validates revocation and cache invalidation, another estimates the availability impact, and a communications owner gives users a concrete reduced-service status.

Recovery requires replaying the failing access cases against the canonical authority, not merely observing fewer errors after rejection. The corrective action is a named-owner, authorization-aware cache contract with revocation tests; “be more careful” is not verifiable.

Cross-Layer Design Prompt Bank

The following compact prompts connect the major technical layers of the book. The first ten include diagnostic questions; the final five leave those questions to the reader. Expand every decision path through assumptions, equations, alternatives, failure modes, and measurement.

1. Design a draft model for speculative decoding

Decision path: Define target workload and exactness. Match tokenizer. Choose draft architecture from memory and latency budget. Train on production prompts with target logits or verified continuations, emphasizing rejection positions. Jointly tune draft size and proposal length. Evaluate acceptance per microsecond, committed tokens per cycle, target batch capacity, and tail latency. Establish target-distribution preservation from the verification algorithm and test its implementation on tractable distributions; finite task evaluations alone cannot prove exactness. Roll out by traffic slice with automatic fallback to ordinary decode.

Questions to resolve: Why not only teacher outputs? What changes at high temperature? When does a larger draft win? How do you handle domain shift? Can K/V state be shared?

2. Explain forward versus reverse KL

Decision path: Write both expectations. Forward KL weights error under the teacher and strongly penalizes missing teacher-supported modes. Reverse KL weights under the student and can select a mode when capacity is limited. For token distillation, minimizing teacher cross entropy equals forward KL up to teacher entropy. Temperature reveals non-argmax structure; sequence-level behavior still requires task evaluation.

Questions to resolve: What if teacher assigns zero probability? Why T^2? When could reverse KL be useful? How does limited student capacity change behavior?

3. Generate training data for reasoning or code

Decision path: Start from a capability taxonomy and seed distribution. Generate diverse candidates. Verify with independent executable, symbolic, retrieval, or expert checks. Score difficulty and novelty. Deduplicate against train and eval. Balance slices and preserve provenance. Train pilots, analyze failures, and feed verified failures back into generation. Protect private holdouts.

Questions to resolve: How much synthetic data? How do you prevent model collapse? What if the verifier is gameable? How do you measure coverage?

4. Evaluate a new data-quality filter

Decision path: Characterize what the filter removes by source and slice. Measure label precision and bias on adjudicated samples. Train controlled pilots with equal token budgets and matched schedules. Compare downstream capability, safety, memorization, and rare-slice floors. Evaluate whether gains come from quality or distribution change. Run counterfactual weight-versus-filter experiments.

Questions to resolve: What if validation loss improves but target tasks regress? How do you test contamination? How do you handle dialect or domain bias?

5. Prefill versus decode

Decision path: Prefill has many prompt positions, large GEMMs, and creates KV; it is often compute- or attention-IO-bound and controls time to first token. Decode adds one token per sequence, repeatedly reads weights and KV, and is commonly bandwidth- or launch-bound; it controls inter-token latency. Use roofline and byte estimates, then choose phase-specific scheduling and kernels.

Questions to resolve: What changes with batch? Why does GQA help decode? When should phases be disaggregated? What is chunked prefill?

6. How many draft tokens should be proposed?

Decision path: Expected accepted prefix grows with products of conditional acceptance, while draft and verification cost grow with proposal length. Benchmark committed tokens divided by cycle time, including memory and scheduling. Tune by batch, temperature, domain, and request class. Use a conservative adaptive policy if workload variation justifies it.

Questions to resolve: Can confidence predict acceptance? Why can a longer proposal hurt even if verification is parallel? What happens under continuous batching?

7. Improve decode efficiency

Decision path: Quantify weight and KV bytes and observed bandwidth. Increase safe batching, reduce bytes with quantization or GQA, improve KV allocation, fuse launch-bound operations, use graphs, cache prefixes, and consider speculation. Evaluate tail latency and capacity under production shapes. Do not optimize FLOPs if bytes are controlling.

Questions to resolve: Why can 4-bit be slower? When does batching violate the product? Which fusion is safe? How do you profile collectives?

8. Parallelize matrix multiplication

Decision path: Partition output tiles across blocks. Cooperatively load A and B tiles into shared memory with coalesced accesses. Accumulate register fragments, use tensor-core instructions when layout and precision allow, pipeline async copies, and handle edge tiles uniformly. Choose tile size from reuse versus registers, shared memory, and occupancy. Compare achieved compute and bandwidth ceilings.

Questions to resolve: Split-K? Bank conflicts? Register spilling? Persistent kernels? Why use a library?

9. Design continuous batching

Decision path: Maintain per-sequence state and admit/remove work at iteration boundaries. Protect decode deadlines, chunk long prefills, reserve KV pages, group compatible graph shapes, and enforce tenant fairness. Admission uses estimated tokens and state, not request count. Track queue, time to first token, inter-token gaps, utilization, and rejection.

Questions to resolve: Starvation? Cancellation? Prefix caching? Speculative sequences that advance unevenly? Overload policy?

10. Walk through a recent ML systems project

Decision path: State user outcome and scale. Explain the previous system and quantified bottleneck. Present alternatives and why your team chose one. Walk the critical technical mechanism. Show your personal decisions and cross-org influence. Report quality, performance, cost, and reliability outcomes. Close with what changed in the platform or organization and what you would do differently.

Questions to resolve: Hardest disagreement? Largest unknown? How did you test? What failed? How would the design change at ten times scale?

11. Design a distributed inference service

Decision path: Clarify model, traffic, SLO, context, availability, and cost. Estimate weights, KV, prefill, decode, and network. Choose parallel group inside fast topology, replicate for throughput and failure isolation, route by work and cache affinity, schedule continuously, and define admission. Add versioned control plane, observability, canary, rollback, and stateful failover semantics.

12. Design model evaluation

Decision path: Build a versioned matrix of tasks and critical slices. Separate capability, system, guardrail, and diagnostic metrics. Protect holdouts and provenance. Run unit, offline, replay, shadow, canary, and online stages. Predefine meaningful effect and hard guardrails. Localize regressions by data, model, engine, and policy version.

13. Handle distribution shift

Decision path: Define source versus target distribution and whether shift affects covariates, labels, or user behavior. Detect through input, representation, calibration, and outcome monitors. Confirm with labeled samples. Mitigate through reweighting, data acquisition, robust objectives, routing, fallback, or retraining. Protect critical slices and avoid self-reinforcing feedback.

14. Explain sampling

Decision path: Temperature rescales logits. Top-k truncates by count; top-p truncates to a cumulative mass. Greedy takes argmax. Sampling policy changes diversity, calibration, acceptance, and evaluation. Implement stable softmax, deterministic seeded streams where required, distributed top-k merge, and exact speculative correction.

15. Customer-centered engineering at organizational scope

Decision path: Identify the workflow and consequence behind a request. Segment the metric to reveal affected users. Make a tradeoff that improves the durable outcome, not merely the loud request. Align product and infrastructure owners. Ship with feedback and leave a mechanism that keeps customer evidence in planning.

Design review closing checklist

Use the worked assistant review in Part VI for technical completeness. Here, add the organizational check: can another team explain the latency budget, update the index without mixing versions, and stop an unauthorized answer without the original author present? The Part IX capstone tests that handoff through workload changes and injected failures.