Skip to content
mentorship

ML primitives in code

Frontier ML implementation set

These exercises test whether modern ML abstractions are mechanisms you can build and debug, not names you can recite.

Five sessions, 35 to 50 minutes eachStarter modules plus public unit tests

Do this only if the format matches

Confirm the round with recruiting first. This is an original practice exercise, not a claim that a specific company uses this exact prompt.

Protocol

  1. Choose one primitive and restate its tensor or graph contract before coding.
  2. Implement the smallest correct baseline without importing the target abstraction.
  3. Run the focused test, localize the first failure, and add two edge tests.
  4. State time, memory, and numerical behavior.
  5. Handle one changed constraint without replacing the design.
  6. Explain how the production implementation differs from the toy version.

Deliverables

  • A passing implementation for each chosen primitive.
  • Two candidate-written tests per primitive.
  • A complexity and numerical-stability note.
  • One production follow-up per primitive.

Graduation gates

01

Tests cover shape, edge behavior, and gradient or probability semantics.

02

Causal and incremental paths agree with full computation.

03

Frozen and trainable parameters are explicit.

04

You can explain every operation without framework magic.

Starter files

Answer key is a rubric, not a solution dump

The linked question explains what strong performance looks like, common failure modes, and senior follow-ups. Attempt the lab before reading it.

Start with the decoder rubric →

← All executable labs