Choose a batch
The worker chooses which ready rows to run. The model describes which rows are compatible incan_batch, sets input_seq_len in prepare_inputs, and implements forward_batched. Include any distinction that changes the forward, such as an image grid, a guidance branch, or a different tensor layout. Stack or pack the selected rows in preprocess.
For decode, a batch usually contains one token per row. Packed prefill rows have different token lengths. A combined walk can execute prefill and decode rows in the same step. Keep the segment order, attention layout, positions, and returned rows consistent. Under chunked prefill, a submodule whose sampled token only matters on the final chunk should keep only the final chunk’s sample. Decoder scaffold · Scheduler tests
Declare capture shapes
Capture inputs must exercise the same operations as a real replay. If two rows with the same count can follow different forwards, include that distinction in the capture key. For BAGEL, guided and unguided decode need separate captures. The submodule’s
cg_key_info and the step’s matching capture metadata must describe the same bucket. The worker leases a slot before declaring the step. A batch that misses the capture runs eagerly. The capture tests cover bucket matching; the config types specify the actual fields.
Keep raw graph capture and resource allocation in the engine. A buffer rewritten on a planning stream can race with a previous forward that is still reading it. Engine resources that copy host data into fixed buffers may need double buffering. Padding rows must address the resource’s sink and cannot advance a real request. Runner · Resource base
Place nodes on ranks
Anode_groups entry names graph nodes, ranks, and optionally the walks on which that placement applies. A single-rank configuration can place several nodes together. Giving different nodes different ranks allows requests to overlap or different stages to stream. A rank list alone does not teach a model how to shard its weights.
Before benchmarking, check the actual single-GPU BAGEL config against the CFG-parallel one. A request without guidance should take the unguided path in either. Lockstep ranks must also agree on a failure, admission decision, and teardown. A per-rank early return before a collective can hang its peers. Lockstep worker
Tune a deployment
Override capacities by declared name underresources: in YAML. This is where a deployment chooses KV pages and host offload, the attention backend, or sampler capacity. The model declares the geometry needed for correctness. See the state reference for how names map to the resources.
The model can set preprocessing thread defaults for host work. Measure with the model’s actual media inputs before changing a limit. For kernel selection, use existing tuned tables keyed by architecture and geometry instead of a branch on device name in a model. Capture variants and larger buckets cost startup time and memory. Compare throughput, latency, and startup at the target concurrency, with a second workload to catch regressions. Kernel tables · Evaluation