Parallelization
In this article
- Test whether a set of subtasks is independent enough to run at the same time.
- Fan the work out and join the results in a fixed order, so the output does not depend on which call finishes first.
- Decide what the result says when one branch fails, and name the gap instead of hiding it.
- Explain what running in parallel saves (waiting time) and what it does not (tokens).
- Terms defined here: parallelization, fan-out.
Overview
A customer is about to be handed to a person on the support team, and that person wants a short summary of the customer's last five tickets before they say hello. Summarising each ticket takes a model call of about three seconds, so five calls in a row keep the person waiting about fifteen seconds. Most of that wait is unnecessary, because no summary needs another one to be finished first.
The setting is made up: Brightline, a home-internet provider, runs a support assistant on its website that answers customers and can hand a conversation to a person with escalate_to_person. By the end you can test whether subtasks are independent, run them at the same time, join the results in a fixed order, and say plainly what the result contains when one of them fails.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Do the five summaries depend on each other?
- Fan out, then join in ticket order
- When ticket 4 times out
- What you save and what you do not
- Voting: the same question three times
- Not the same thing: several tool calls in one reply
- Common mistakes
- Sources
- Check yourself, 13 questions