Step-5-Preview
Step 5 Preview is
StepFun’s Mixture-of-Experts (MoE) model with alternating sliding-window
attention (SWA) and learned region-selected attention (CSA). NeMo AutoModel
implements its language backbone as Step5ForCausalLM. The multimodal
checkpoint also contains a perception encoder; see the
vision-language coverage
for that path and its preprocessing requirements.
Model Reference
Model Architecture
The parameter count includes the learned router, the indexers, and both embedding/output matrices; it excludes vision, the projector, buffers, and multi-token prediction layers. Activated parameters count all non-routed parameters plus eight routed experts per MoE layer, including the full input embedding matrix. Excluding that matrix gives approximately 26.6B.
Recipes
Run the commands below from the linked recipe revision.
The recipes load the model and tokenizer from
stepfun-ai/Step-5-Preview-BF16
and Tulu3 from allenai/tulu-3-sft-mixture. Launch a recipe on each node with:
Use --nproc-per-node 8 on H100 nodes, and the
Slurm launcher guide for multi-node allocations.
Attention and Precision
SWA uses causal grouped-query attention with a 512-token window, including the current token. The optimized H100 path uses FlashAttention-4 (FA4) variable-length window attention where its input-layout checks permit it. Packed or padded inputs that do not meet those checks use the masked path.
CSA compresses index keys into eight-token regions. A separate indexer with 16 query heads, one key head, and four provider groups selects up to 512 completed causal regions per group. Attention also includes the causal portion of the current region. The main attention operates on the original token-level K/V within those selected regions, rather than on the compressed index keys. Selection stays within each packed document.
The FA4 backend constructs sparse block metadata and applies an exact token-level mask within admitted tiles. A tile containing any selected keys can still contain unselected keys, so block sparsity does not imply that every computed tile is fully selected. The implementation preserves head dimension 192. It does not pad attention heads to 256 or materialize a dense sequence-by-sequence attention mask on this path.
Q/K normalization, the FP32 residual stream, router precision, and per-layer rotary settings follow the model configuration. SWA rotates all 192 head dimensions with theta 10,000; CSA rotates 64 dimensions with theta 10,000,000. Each attention head has an output gate. The language-model loss has no differentiable path through discrete region selection, so the CSA indexers are frozen.
Distributed Training
CP splits a sequence into consecutive, equal-sized query shards. The native
contiguous sharder pads to an even local shard length (a global multiple of
cp_size * 2). An eight-token CSA region can cross a shard boundary;
region selection uses the global document coordinates. Padding positions are
excluded from attention and loss.
- SWA communication: exchange only the preceding window halo, up to 511 tokens of K/V per query shard. If a shard is shorter than the halo, exchange the required slices with multiple preceding ranks. Backward sends the corresponding K/V gradients back to their owners. SWA does not all-gather the global K/V sequence.
- CSA communication: gather token K/V across the CP group, then evaluate the local queries against their selected keys. Backward reduce-scatters K/V gradients to their source shards. Sparse attention compute therefore does not make this transport sparse.
- Packed documents: reset positions and document identity constrain both SWA and CSA. A CP boundary can fall inside a document; a document boundary still prevents cross-document attention and next-token supervision.
For CP comparisons, reuse one frozen packed dataset and the same logical global-batch order. Use the native recipe’s globally shifted loss rather than passing local, unshifted labels directly to the CP model. See distributed setup and pipeline parallelism.
Full-Depth H100 Benchmark
The
benchmark recipe
uses the native nemo_automodel.recipes.llm.benchmark entry point; its header
contains the launch command.
The recipe covers the full language backbone’s forward, backward, and optimizer steps with mock data. It does not exercise pretrained checkpoint loading or context parallelism.
Checkpoints and Validation Scope
The fine-tuning recipes load
stepfun-ai/Step-5-Preview-BF16
through the native AutoModel distributed loading path. The benchmark creates
weights from configuration and does not exercise checkpoint loading.
The forward pass is compared with StepFun’s standalone reference implementation on the first four checkpoint layers and one 8,192-token document, using the FA4 backend with SWA varlen and CSA full-block paths enabled. Positions from 4,104 onward have more causal history than the indexer’s top-k budget, so selection drops regions there.
Region-selection differences occur at near-tied indexer scores. This comparison covers the forward pass of four layers; it is not full-depth reference parity or a gradient comparison.
CP1 and CP2 produce identical logits, losses and gradients on single and packed documents, and SWA halo exchange matches an exact forward/backward oracle. The checkpoint’s one-million-position limit is not a claim of full-depth long-context validation.