Skip to content

Beam ​

Beam (model_type=beam, BeamForCausalLM) is a mixture-of-experts model with 52 decoder layers: 9 full-attention layers and 43 sliding-window layers with a 512-token window. Use this recipe to serve Beam on supported NVIDIA hardware or AMD gfx950.

Serve Beam on NVIDIA ​

Beam's BF16, FP8, and NVFP4 checkpoints run with the same NVIDIA command. The checkpoint's own quantization configuration selects the path, with no flag.

Prepare the NVIDIA checkpoints and nodes ​

The NVIDIA recipe runs one TP8 replica over two 4-GPU nodes, as in the recipe's GB200 measurements. Serving requires --dtype bfloat16.

Use these supported Hub revisions for the target checkpoint:

CheckpointRevision
BF16f40a3a29
FP821052137
NVFP481a5ab6b

Speculative decoding uses Beam's DFlash2 drafter checkpoint, which serves all three target checkpoints. Use the reflection/Beam-1.0-501B-A23B-DFlash2 drafter at revision 8d26c952. The drafter declares 1,048,576 positions, so leave TOKENSPEED_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN unset. With the drafter, the default batch limit is 80 requests, not 160.

Pass the local checkpoint directory as the model, and use the same path on every node. Stage the drafter checkpoint locally as well.

Beam's flag-free defaults, the trtllm attention backend and the flashinfer_trtllm MoE backend, apply on NVIDIA SM100 to SM103 and were validated on SM100 (GB200) only. Beam serves without TF32 on every platform. Beam's own Triton kernels (routing, SSMax, the residual norm, and the soft cap) and the BF16x3 router GEMM run on NVIDIA SM90 to SM103.

On NVIDIA SM90, the BF16 checkpoint's experts run on the Triton BF16 MoE and the FP8 checkpoint's experts on the Triton FP8 per-channel MoE. The FP8 checkpoint's dense linears are dequantized to BF16 at load. NVFP4 experts need SM100 to SM103.

Start and verify the NVIDIA replica ​

The first start on a fresh machine tunes kernels for 30 to 45 minutes. Add --engine-startup-timeout 5400 to the launch command for that start. Later starts reuse the caches.

  1. On both nodes, start the replica. Change only --node-rank between the two commands, and point --dist-init-addr at node 0, the only rank that serves the HTTP API. Replace <beam-checkpoint-dir> and <drafter-checkpoint-dir> with the local checkpoint paths, and replace <node0-host> with node 0's hostname or IP address:

    bash
    # node 0 (serves the HTTP API); node 1 runs it with --node-rank 1
    ts serve --model <beam-checkpoint-dir> \
      --nnodes 2 --node-rank 0 --nprocs-per-node 4 --world-size 8 \
      --dist-init-addr <node0-host>:29000 \
      --tensor-parallel-size 8 \
      --dtype bfloat16 \
      --max-model-len 1048576 \
      --grammar-backend xgrammar \
      --enable-mixed-batch --prefill-graph-max-tokens 8192 \
      --speculative-algorithm DFLASH \
      --speculative-draft-model-path <drafter-checkpoint-dir> \
      --drafter-attention-backend trtllm \
      --served-model-name reflection/Beam-1.0-501B-A23B-NVFP4 \
      --host 0.0.0.0 --port 8000

    Without --served-model-name, the API model ID is the full checkpoint path.

  2. After startup completes on both nodes, query the readiness endpoint on node 0. Use the same <node0-host> value as in the launch command:

    bash
    curl --fail http://<node0-host>:8000/readiness

    A ready server returns HTTP 200 OK.

NVIDIA execution behavior ​

Each sandwich all-reduce boundary (the all-reduce, the sandwich norm, and the next pre-norm) runs as one MNNVL launch per 2048-row slice where the workspace serves it, so prefill chunks above 2048 tokens fuse too.

For FP8 decode, eligible MNNVL sandwich all-reduce boundaries also write per-token E4M3 activations and FP32 scales for the following Q/K/V/gate or dense gate/up projection. The fused path reuses the BF16-rounded norm output and its existing quantizer contract. The consumer accepts at most 64 rows; other shapes and checkpoint formats retain their existing path. No extra flag is required. If the fused collective declines, the second norm fills the same buffers before the projection consumes them.

Configure NVIDIA batching and API requests ​

Keep --grammar-backend xgrammar. The backend lets forced tool choice and JSON response_format work. With this backend, the bundled gateway constrains every Beam turn to Beam's output format, including tool calls under tool_choice: auto, forced tool choice (required or a named function), and JSON response_format with json_schema.

--enable-mixed-batch --prefill-graph-max-tokens 8192 runs a prompt chunk in the same step as the running decodes. Pass the same grammar and mixed-batch values on every node.

Don't set --reasoning-parser or --tool-call-parser. The bundled tokenspeed-smg version pinned in python/pyproject.toml reads the output through the checkpoint's response_template.

Set reasoning effort to low, medium (the default), high, xhigh, or max.

Increase the NVIDIA batch limit ​

For batches above 160, or above 80 with the drafter, set all three scheduling and graph flags. For 512 requests, use these values:

bash
--max-num-seqs 512 \
--max-cudagraph-capture-size 512 \
--cudagraph-capture-sizes 1 8 32 64 128 160 256 384 512

Setting only the first one or two leaves larger decode batches outside the captured graph list.

Serve Beam on AMD gfx950 ​

Beam supports BF16 and compressed-tensors dynamic W8A8 FP8 checkpoints on gfx950. This recipe doesn't cover other quantization formats.

Prepare the AMD checkpoints and host ​

Use an eight-GPU gfx950 host. The example configuration runs an FP8 target with a BF16 DFlash2 drafter, mixed prefill/decode batching, and graph replay. Stage both checkpoints locally.

Use the gateway dependencies pinned by this checkout and the original checkpoint chat template.

Start and verify the AMD server ​

  1. On the eight-GPU host, start the server. Replace <beam-fp8-checkpoint-dir> with the FP8 target checkpoint path and <beam-dflash2-checkpoint-dir> with the BF16 DFlash2 drafter checkpoint path:

    bash
    ts serve --model <beam-fp8-checkpoint-dir> \
      --tensor-parallel-size 8 --ep-size 1 \
      --dtype bfloat16 --kv-cache-dtype bfloat16 \
      --attention-backend mha --moe-backend gluon --all2all-backend none \
      --sampling-backend triton_full --grammar-backend xgrammar \
      --disable-tf32 --layer-boundary-norm unfused \
      --max-model-len 262144 --max-num-seqs 16 --chunked-prefill-size 8192 \
      --prefill-graph-max-tokens 8192 \
      --max-cudagraph-capture-size 16 --cudagraph-capture-sizes 1 2 4 8 16 \
      --gpu-memory-utilization 0.85 --disable-kvstore --disable-prefix-caching \
      --enable-mixed-batch --speculative-algorithm DFLASH \
      --speculative-draft-model-path <beam-dflash2-checkpoint-dir> \
      --speculative-draft-model-quantization unquant \
      --drafter-attention-backend mha \
      --speculative-num-steps 15 --speculative-num-draft-tokens 16 \
      --host 127.0.0.1 --port 8000
  2. After startup completes, query the readiness endpoint on the same host:

    bash
    curl --fail http://127.0.0.1:8000/readiness

    A ready server returns HTTP 200 OK.

  3. Before deployment, independently check raw generation, parsed chat and tool APIs, numerical parity, and performance against your expected results.

Adjust the AMD target and memory budgets ​

For a BF16 target, use its checkpoint and --moe-backend triton with the same attention, dtype, and unfused-boundary settings. Omit the speculative arguments for target-only decoding.

The context and memory fraction in the example are starting budgets, not a capacity guarantee. Check the startup allocation for the chosen checkpoint and request lengths.

TokenSpeed documentation