Bitpath

Lesson 2 · Unit 03

Continuous batching

Requests join and leave between decode steps

13 exercisesabout 3 min

What you practise

  • Requests join and leave between decode steps, a timeline read step by step, streaming tokens to the user, queues and fairness

Try a question from this lesson

Pick one

A static batch holds 4 requests that need 10, 10, 10 and 500 tokens. It stays together until all are done. What do three of its slots do for the last 490 steps?

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Continuous batching

Instead of fixing the batch per request, rebuild it between decode steps. A request that finishes leaves at once, and a waiting request takes its slot on the next step.

Slots stay full, short requests are not held hostage by long ones, and nobody waits for a whole batch to drain.

step 10  [A B C D]  A, B, C finish
step 11  [E F G D]  E, F, G join

Concept

Streaming

Every decode step produces one token for each request in the batch. Send it at once instead of waiting for the full answer, and the user starts reading while the model is still writing.

Total time is unchanged. What the user feels is the time to first token.

10 more exercises in the app

  • 3× type the answer
  • 1× true or false
  • 3× multiple choice
  • 1× fill the blanks
  • 1× match the pairs
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy