Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
05b1e5e
Add contrib MiMo-V2.5 as a rename of MiMo-V2-Flash
whn09 Apr 27, 2026
b830a78
preprocess: rebuild weight_map from actual shard files for V2.5
whn09 Apr 27, 2026
d381601
preprocess: split MiMo-V2.5 fused qkv_proj back into q/k/v for NxDI
whn09 Apr 27, 2026
eb6b2aa
preprocess: fix V2.5 fused qkv split to use 4 interleaved groups
whn09 Apr 28, 2026
94d001d
README/smoke/bench: V2.5-specific content + move scratch off /tmp
whn09 Apr 28, 2026
1516d7a
README: add 'Testing the vLLM server' subsection + fix NC count
whn09 Apr 28, 2026
2149480
0_setup: resolve CONTRIB_SRC before cd-ing into vllm-neuron
whn09 Apr 28, 2026
60c17a9
README: fix maintainer name (Henan Wang, not Wan)
whn09 Apr 28, 2026
89e04cd
bench scripts: source vllm venv, not the nxd-training one
whn09 Apr 28, 2026
4e788f2
vllm: reuse MiMoV2Flash arch name to satisfy vLLM's builtin validator
whn09 Apr 28, 2026
d724a94
Consolidate env var docs + point scratch dirs at persistent storage
whn09 Apr 28, 2026
1469d15
bench: drop the BS=128 config, keep only BS=32
whn09 Apr 28, 2026
9b44f57
sanity_check + run_bench_single: default to Neuron-FP8 checkpoint
whn09 Apr 28, 2026
2e5348b
perf_test: split out start_vllm_server.sh; make bench_mimo_v2_5 a thi…
whn09 Apr 28, 2026
1ef5ef4
README: record actual bench_mimo_v2_5 results (FP8 BS=32, c=1/16/32)
whn09 Apr 28, 2026
d06ab78
Merge branch 'aws-neuron:main' into contrib/MiMo-V2.5
whn09 Jul 21, 2026
d47d9e8
[contrib] MiMo-V2.5: fix decode sliding-window mask to use per-batch-…
whn09 Jul 21, 2026
b2488f6
Add H100 GPU baseline for MiMo-V2.5 (SGLang single-node)
whn09 Jul 21, 2026
8a64b5f
Fix batched-decode garble: per-row causal upper bound on prior KV
whn09 Jul 21, 2026
4e69aee
h100/MiMo-V2.5: use cookbook DP=2 as SGLang default (no DeepEP needed)
whn09 Jul 21, 2026
6ea3156
h100/MiMo-V2.5: vLLM works with PR #42270 (verified) + add vLLM bench…
whn09 Jul 21, 2026
d87a41a
h100/MiMo-V2.5: enable chunked prefill for vLLM (default) + add its b…
whn09 Jul 21, 2026
8ebc732
h100/MiMo-V2.5: add 32K long-context concurrency exploration (SGLang)
whn09 Jul 22, 2026
163a7c6
Add data-parallel + context-parallel attention for long context (512-…
whn09 Jul 22, 2026
94ce6b2
h100/MiMo-V2.5: add 15K-input / 1K-output bench (Trn2 16K-context point)
whn09 Jul 22, 2026
b078f51
docs: document long-context (16K) support and benchmarks
whn09 Jul 22, 2026
0063b00
h100/MiMo-V2.5: add prefill benchmark (16K in / 10 out) + root-cause …
whn09 Jul 22, 2026
a07e2cb
h100/MiMo-V2.5: add H100-vs-Trn2 cross-platform table to 15K/1K results
whn09 Jul 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
511 changes: 511 additions & 0 deletions contrib/models/MiMo-V2.5/README.md

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions contrib/models/MiMo-V2.5/perf_test/0_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash
# Setup for MiMo-V2.5 vLLM benchmarking on Trn2.
#
# Clones upstream vllm-project/vllm-neuron at release-0.5.0 and applies
# vllm-neuron-patch.patch, which adds a runtime registration hook so the
# contrib NeuronMiMoV2ForCausalLM is plugged into both NxDI's MODEL_TYPES
# (under the key "mimov2") and vLLM's ModelRegistry (as
# MiMoV2ForCausalLM) at vllm-neuron plugin init time.
#
# Then downloads XiaomiMiMo/MiMo-V2.5 from HuggingFace (FP8 blockwise, ~320 GB).
set -e

echo "=========================================="
echo "Setup: vllm-neuron + MiMo-V2.5 weights"
echo "=========================================="

source /opt/aws_neuronx_venv_pytorch_inference_vllm_0_16/bin/activate

# Resolve repo-relative paths up front — we cd into $HOME/vllm-neuron below,
# after which $0's relative form would no longer resolve.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PATCH_FILE="$SCRIPT_DIR/vllm-neuron-patch.patch"
CONTRIB_SRC="$(cd "$SCRIPT_DIR/.." && pwd)/src"

echo ""
echo "[1/2] Installing vllm-neuron (release-0.5.0) with the contrib registration patch..."

if [ ! -d $HOME/vllm-neuron ]; then
git clone --branch release-0.5.0 https://github.com/vllm-project/vllm-neuron.git $HOME/vllm-neuron
fi

cd $HOME/vllm-neuron

# Apply patch (idempotent via `git apply --check` first).
if git apply --check "$PATCH_FILE" 2>/dev/null; then
git apply "$PATCH_FILE"
echo " Applied $PATCH_FILE"
else
echo " Patch already applied or conflicts; continuing."
fi

pip install --extra-index-url=https://pip.repos.neuron.amazonaws.com -e .

python3 -c "import vllm_neuron; print('vllm-neuron installed:', vllm_neuron.__file__)"

echo ""
echo "[2/2] Downloading MiMo-V2.5 FP8 weights from HuggingFace..."

MIMO_PATH="${MIMO_V2_5_PATH:-/opt/dlami/nvme/models/MiMo-V2.5}"
if [ -d "$MIMO_PATH" ] && [ "$(ls "$MIMO_PATH"/*.safetensors 2>/dev/null | wc -l)" -gt 0 ]; then
echo " MiMo-V2.5 weights already exist at $MIMO_PATH, skipping download"
else
mkdir -p "$MIMO_PATH"
huggingface-cli download XiaomiMiMo/MiMo-V2.5 --local-dir "$MIMO_PATH" --max-workers 16
echo " Download complete: $(du -sh $MIMO_PATH | cut -f1)"
fi

NEURON_FP8_PATH="${MIMO_PATH}-Neuron-FP8"
COMPILED_PATH="/opt/dlami/nvme/compiled/mimo_v2_5_bs32_moetp1_ep64_fp8_vllm"

echo ""
echo "========================================================================"
echo "Next steps"
echo "========================================================================"
echo ""
echo "1. Preprocess the FP8 checkpoint for Neuron (~16 min, ~15 GB peak RAM):"
echo ""
echo " python $CONTRIB_SRC/conversion_script/preprocess_mimo_v2_5_fp8.py \\"
echo " --hf_model_path $MIMO_PATH \\"
echo " --save_path $NEURON_FP8_PATH \\"
echo " --tp_degree 64"
echo ""
echo "2. Export the environment variables used by the smoke / bench scripts:"
echo ""
echo " # --- Required ---"
echo " # Contrib package src (registers NeuronMiMoV2ForCausalLM with vllm-neuron)."
echo " export NXDI_CONTRIB_MIMO_V2_5_SRC=$CONTRIB_SRC"
echo " # vLLM's builtin arch validator only knows MiMoV2FlashForCausalLM, so the"
echo " # preprocess rewrites the checkpoint's config.json architectures to that"
echo " # name. Alias V2.5 src to the Flash env var so vllm-neuron's contrib hook"
echo " # registers mimov2flash -> our V2.5 NeuronMiMoV2ForCausalLM class."
echo " export NXDI_CONTRIB_MIMO_V2_FLASH_SRC=\"\$NXDI_CONTRIB_MIMO_V2_5_SRC\""
echo " # Preprocessed Neuron-FP8 checkpoint."
echo " export MIMO_V2_5_PATH=$NEURON_FP8_PATH"
echo ""
echo " # --- Optional (recommended) ---"
echo " # vLLM compiles into <checkpoint>/neuron-compiled-artifacts/<hash>/ by"
echo " # default. Pin it to a persistent shared location so multiple configs"
echo " # don't collide and you can reuse the NEFF / sharded weights across runs."
echo " export NEURON_COMPILED_ARTIFACTS=$COMPILED_PATH"
echo " # NxDI's HLO/NEFF staging workdir (.hlo_module.pb etc). Default is"
echo " # /tmp/nxd_model/<compile-name>/; on Trn2 /tmp is wiped by the nightly"
echo " # reboot, and parallel compiles sharing the same basename silently"
echo " # overwrite each other's staged HLOs. Pin to a unique per-config"
echo " # directory under persistent storage."
echo " export BASE_COMPILE_WORK_DIR=/opt/dlami/nvme/tmp/nxd_model/\$(basename $COMPILED_PATH)"
echo " # First-time compile of V2.5's 256-expert MoE takes ~30 min (NEFF HLO +"
echo " # shard_checkpoint for 64 ranks). Extend vLLM's ready timeout."
echo " export VLLM_ENGINE_READY_TIMEOUT_S=7200"
echo ""
echo "3a. Run the one-shot benchmark (launches + benches + tears down):"
echo ""
echo " bash $SCRIPT_DIR/bench_mimo_v2_5.sh"
echo ""
echo "3b. ...OR keep a server up and probe it manually:"
echo ""
echo " # shell 1: server in foreground (Ctrl-C to stop)"
echo " bash $SCRIPT_DIR/start_vllm_server.sh"
echo ""
echo " # shell 2: once 'Application startup complete.' prints,"
echo " bash $SCRIPT_DIR/sanity_check.sh"
echo " CONCURRENCY=16 NUM_PROMPTS=128 bash $SCRIPT_DIR/run_bench_single.sh"
echo ""
87 changes: 87 additions & 0 deletions contrib/models/MiMo-V2.5/perf_test/bench_mimo_v2_5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash
set -e

# MiMo-V2.5 FP8 vLLM benchmark on Trn2. One-shot wrapper:
# launch server -> sanity check -> bench at c=1,16,32 -> stop server.
#
# This script composes three building blocks in perf_test/:
# start_vllm_server.sh - server launch + env-var setup (backgrounded here)
# sanity_check.sh - one-shot curl against the running server
# run_bench_single.sh - one concurrency level of `vllm bench serve`
#
# Use those directly if you want to keep a long-running server and iterate
# on bench parameters from another shell.
#
# Server recipe: TP=64, moe_tp=1/moe_ep=64, BS=32, continuous batching.
# BS=32 is the smallest working batch size on the FP8 path (NxDI's TKG
# path refuses Expert Parallelism with BS < num_experts/top_k = 256/8 = 32).
# BS=1 single-stream latency demos are not currently supported on V2.5 FP8.

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PORT="${PORT:-8000}"
RESULTS_DIR="${RESULTS_DIR:-/opt/dlami/nvme/logs/bench_results/mimo_v2_5}"
CONFIG_NAME="bs32_tp64_moetp1_ep64"

mkdir -p "$RESULTS_DIR"

# Wait for vLLM server to be ready. First-time compile of the 256-expert
# MoE model takes ~30 min and can stretch past 2 h under contention, so
# poll for up to 2 h.
wait_for_server() {
echo " Waiting for vLLM server on port $PORT (up to 2 h for first compile)..."
local interval=10
local max_attempts=720
local start=$SECONDS
for i in $(seq 1 $max_attempts); do
if curl -s "http://localhost:$PORT/health" > /dev/null 2>&1; then
echo " Server ready after $((SECONDS - start))s."
return 0
fi
if [ $((i % 6)) -eq 0 ]; then
echo " ...still waiting ($((SECONDS - start))s elapsed)"
fi
sleep $interval
done
echo " ERROR: Server did not start within $((max_attempts * interval))s"
return 1
}

stop_server() {
echo " Stopping vLLM server..."
pkill -f "vllm.entrypoints.openai.api_server" 2>/dev/null || true
sleep 5
}

echo "=========================================="
echo "MiMo-V2.5 FP8 Performance Benchmark"
echo "=========================================="
echo "Port: $PORT"
echo "Results: $RESULTS_DIR"
echo ""

# Start the server in the background. start_vllm_server.sh handles all the
# env vars (MODEL_PATH, NEURON_COMPILED_ARTIFACTS, BASE_COMPILE_WORK_DIR,
# contrib src registration, etc.) and execs `python3 -m vllm...`.
bash "$SCRIPT_DIR/start_vllm_server.sh" &
SERVER_PID=$!
trap stop_server EXIT

wait_for_server

# One-shot sanity check (curl the chat endpoint).
PORT="$PORT" bash "$SCRIPT_DIR/sanity_check.sh" || true

# Three concurrency levels. run_bench_single.sh reads knobs from the
# environment; see its header for all the options.
PORT="$PORT" RESULTS_DIR="$RESULTS_DIR" CONFIG_NAME="$CONFIG_NAME" \
CONCURRENCY=1 NUM_PROMPTS=16 bash "$SCRIPT_DIR/run_bench_single.sh"
PORT="$PORT" RESULTS_DIR="$RESULTS_DIR" CONFIG_NAME="$CONFIG_NAME" \
CONCURRENCY=16 NUM_PROMPTS=128 bash "$SCRIPT_DIR/run_bench_single.sh"
PORT="$PORT" RESULTS_DIR="$RESULTS_DIR" CONFIG_NAME="$CONFIG_NAME" \
CONCURRENCY=32 NUM_PROMPTS=128 bash "$SCRIPT_DIR/run_bench_single.sh"

echo "=========================================="
echo "MiMo-V2.5 FP8 benchmark complete!"
echo "Results saved to: $RESULTS_DIR"
echo "=========================================="
ls -la "$RESULTS_DIR"
Loading