Cartesia interview prep

50 PyTorch Implementation Problems

This set is built around Cartesia's public domain: efficient sequence models (state-space models, selective scans, linear recurrences) for real-time voice, plus the transformer and training-engineering mechanics that surround any modern model-training stack. Problems are grouped into three families — SSM/sequence-model core ops (the recurrences and scans that are Cartesia's architectural signature), attention and transformer internals (the adjacent architecture family every ML engineer is expected to know cold), and training mechanics & engineering tradeoffs (the optimizer, normalization, and systems-level code that turns an architecture into a trained model).

How to read the grounding badges: every problem page states plainly whether its scenario is Confirmed — tied to a specific, well-established mechanism from published SSM/sequence-model research (S4, S4D, Mamba, GateLoop) — or General Pattern — a standard, industry-wide PyTorch/deep-learning implementation exercise (attention internals, normalization, optimizers, training-loop mechanics) that is not a claim about Cartesia's specific internal code.

What's on each problem page

  • The scenario, framed around efficient sequence-model and training-engineering practice, with its grounding badge.
  • The actual stub function signature and docstring from the corresponding .py file in ../ (the code you'd run locally to practice).
  • A step-by-step walkthrough of the solution approach — the reasoning, not just the final code.
  • A "how to recognize this pattern in general" section, for transferring the approach to a novel problem in an interview.

Running the code yourself

Every problem has a matching pair of files one level up, in code/problems/cartesia-pytorch/src/:

src/1_sequential_linear_recurrence_scan.py            # stub — implement the function, then run it
src/1_sequential_linear_recurrence_scan_solution.py    # reference solution — run it directly

python3 N_slug.py runs your implementation against the built-in test cases and asserts they pass. python3 N_slug_solution.py runs the reference solution and prints a step-by-step trace of its execution.

Start with Problem 1: Sequential Linear-Recurrence Scan, or jump to any problem from the sidebar.