Parallelism Decision Viz
Pick a model size, a GPU count, and a GPU type. Hit Evaluate (or Space). The right-hand panel walks the three canonical questions a systems engineer asks before opening a distributed-training run — does it fit on one GPU? Can ZeRO shard it? Do the weights alone fit? — and lands on one of five strategies, with a memory summary, a communication-overhead bar, and a strategy-tuned topology diagram.
Configuration
Model size (parameters)
GPU count
GPU type
Space to evaluate / R to reset
Training memory (total)104 GiB
GPU memory80 GiB
Usable (70%)56 GiB
Decision flow
Select inputs and press Evaluate
Decision tree ready. Select a model size, GPU count, and GPU type, then press Evaluate.
Customize
Defaults
7B
8
A100-80GB
600ms
Installation
npx shadcn@latest add https://craftbits.dev/r/parallelism-decision-viz.jsonUsage
import { ParallelismDecisionViz } from "@craft-bits/viz/parallelism-decision-viz";
<ParallelismDecisionViz />Drive every input from outside (controlled mode):
const [modelSize, setModelSize] = useState<ParallelismDecisionVizModelSize | null>("70B");
<ParallelismDecisionViz
modelSize={modelSize}
onModelSizeChange={setModelSize}
/>;Subscribe to phase transitions for an external scoreboard:
<ParallelismDecisionViz
onPhaseChange={(phase) => {
if (phase === "result") trackDecisionLanded();
}}
/>Understanding the component
- Three chip strips. Model size, GPU count, GPU type — each rendered as a
role="radiogroup". Every selection resets the stepper to its idle state. - Memory summary. As soon as all three chips are picked, a token-styled card lands with the training memory total, the GPU's raw memory, and the 70%-usable budget.
- Decision tree. Three pre-computed
params × ?checks. The stepper walks them one at a time on a600mscadence, highlighting the active card and resolving each into aYES/NOpill once visited. - Result card. Lands at the end of the walk with the recommended strategy, a prose description, a three-stat row (memory per GPU, overhead, total training mem), an overhead bar, and a topology diagram.
- Topology diagram. Per-strategy SVG that repaints with the strategy's accent — a single rectangle for Single GPU, a row of shards for DP / ZeRO + DP, grouped TP+PP+DP nodes with pipeline arrows for the multi-D strategies.
- Reduced motion. Under
prefers-reduced-motion: reduce, every entrance collapses to instant, the active-step pulse disappears, and the stepper cadence falls to100ms.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelSize | ParallelismDecisionVizModelSize | null | — | Controlled model size. Pair with onModelSizeChange. |
defaultModelSize | ParallelismDecisionVizModelSize | null | null | Uncontrolled initial model size. |
onModelSizeChange | (size) => void | — | Fires when the model-size chip changes. |
gpuCount | ParallelismDecisionVizGpuCount | null | — | Controlled GPU count. |
defaultGpuCount | ParallelismDecisionVizGpuCount | null | null | Uncontrolled initial GPU count. |
onGpuCountChange | (count) => void | — | Fires when the GPU-count chip changes. |
gpuType | ParallelismDecisionVizGpuType | null | — | Controlled GPU type. |
defaultGpuType | ParallelismDecisionVizGpuType | null | null | Uncontrolled initial GPU type. |
onGpuTypeChange | (type) => void | — | Fires when the GPU-type chip changes. |
onPhaseChange | (phase) => void | — | Fires on every idle → deciding → result transition. |
modelSizes | readonly ParallelismDecisionVizModelSize[] | five tiers | Override the model-size chip strip. |
gpuCounts | readonly ParallelismDecisionVizGpuCount[] | six tiers | Override the GPU-count chip strip. |
gpuTypes | readonly ParallelismDecisionVizGpuType[] | three SKUs | Override the GPU-type chip strip. |
stepDurationMs | number | 600 | Milliseconds between auto-advanced steps. |
transition | Transition | SPRINGS.smooth | Override the entrance spring. |
className | string | — | Merged onto the root via cn(). |
Accessibility
- The root is
role="figure"with anaria-labeldescribing the viz; the live region announces the active question while stepping and the final recommendation when it lands. - Each chip strip is a
role="radiogroup"; chips are<button role="radio">witharia-checkedanddata-statestyling hooks. - The Evaluate button reports its disabled reason via
aria-label. - Keyboard:
Space/Enterevaluates,Rresets. The root istabIndex={0}so screen-reader users can scope into it. - Colour is never the only signal — every card carries its
YES/NOtext pill, the result headline carries the strategy name, and the overhead bar carries the percentage as text. - Motion respects
prefers-reduced-motion: reduce— every entrance collapses to instant and the auto-advance shortens to100ms.
Credits
- Extracted from:
craftingattention(app/src/lessons/primitives/systems/ParallelismDecisionViz.tsx). The source painted directly against the lesson palette (--color-accent-400/--color-ink-*), usedSPRINGS.snappy/SPRINGS.gentle/STAGGER.tightaliases, and rendered narration through the lesson-onlyca-narrationclass. The craft-bits extract rewires every colour through the semantic--cb-*palette, re-keys every transition toSPRINGS.smooth/SPRINGS.snap/SPRINGS.bouncy, replacesSTAGGER.tightwith the library-wideSTAGGERconstant, lifts the chip strips and decision cards ascb-*token-styled elements, exposes a Radix-style controlled / uncontrolled API on each strip, surfacescomputeParallelismDecisionas a named export, and wraps the component inforwardRefacceptingclassNameviacn()and spreading...propson the root.