xAI

Verified interview challenge

Build a dynamic batching engine

Keep a generation batch useful as requests arrive with different lengths and finish at different times.

Unlock with Full Access

The challenge

Implement an inference engine around a supplied model that returns one token per batch row. Requests have different prompt lengths and generation limits, with callbacks that must receive the correct result.

Once the common engine works, extend it for fixed-size padded calls or per-request stop sequences. The variants exercise different assumptions about when a request finishes and which rows still need model work. Guided practice lets you try both separately.

What you'll practise

  • Request lifecycle

    Keep each request's tokens, completion and callback associated with the right state.

  • Batch evolution

    Adapt scheduling to padding or stopping rules without mixing requests.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.