b70-optimization-lab

DeepSeek V4 Flash on 4x B70: Orchestrator Handoff

Last updated: 2026-07-18

Closeout override (2026-07-21): the lane is paused at the verified 80.820052 tok/s record. This document remains the detailed build and evidence reference, but its immediate-work sections are historical. Resume only under the conditions in notes/2026-07-21-deepseek-v4-flash-frontier-closeout.md. The promoted entry points are the result packet and standalone repro.

This is the manager-facing resume document for handing orchestration to another AI. It describes the objective, immutable rules, live state, source trees, record identity, build and run workflow, quality gates, LocalMaxxing policy, completed experiments, known dead ends, and the next decision tree. Detailed chronology remains in results/experiment-ledger.md and notes/.

1. Objective

The product objective is throughput for one active generation, never aggregate serving throughput:

The current qualified target-verified record is 80.820052 tok/s. The three independent strict-suite medians were 80.820052 / 76.900178 / 78.287226 tok/s. All 36 requests were unique and cache-zero, and 24/24 ordered exact canaries passed around the suites. LocalMaxxing approved cmrquta9905w3lg013m5vxoqx.

At the current run-of-three center, 100 tok/s still needs roughly 21.7% less time per emitted token or a useful increase in accepted tokens per target cycle. A 200 tok/s result is not credible from micro-fusion alone; it requires both a substantially leaner target cycle and deeper useful speculation.

2. Non-negotiable validity rules

  1. Report one-active-generation throughput only.
  2. Keep target model/revision/quantization fixed for matching comparisons.
  3. Use the complete run identity. A speed number without source commits, graph flags, topology, sampler flags, and runtime identity is not evidence.
  4. Promotion uses fresh unique prompts, cached_tokens=0, no prefix cache, no response reuse, no n-gram/history acceleration, and no warmed repeated continuation.
  5. The primary strict metric is median generated-token throughput for tokens 1-100 after TTFT, using streamed token-ID timestamps.
  6. Exact target verification is required. Draft acceptance alone is not a quality proof.
  7. Freeze speculative policy before held-out evaluation. Do not route by prompt ID/hash, suite label, target output, future logits, or manually selected per-prompt policy.
  8. Preserve failed patches and results. Do not erase negative experiments or silently relabel a failed gate.
  9. A component microbenchmark does not establish endpoint speed. Require a same-binary service control for any promotion claim.
  10. Submit to LocalMaxxing only after a real matching record, complete identity, exactness, and realistic-suite pass.

The detailed anti-cheating specification is quality/spec-eval-contract-v1.json. It requires two frozen held-out packs, short and 2K/4K nonrepetitive contexts, request-scoped acceptance and timing, target-only/current-control/candidate comparisons, and no benchmark-specific routing.

3. Hardware, model, and storage

K160 is the runnable performance target, not the final quality-certified teacher construction. Its hash layers were pruned and its calibration is not fully reproducible. Do not claim it is official REAP. The user nevertheless explicitly chose to continue this K160/DSpark path and does not authorize another model substitution.

4. Source trees and current state

main repo    /home/steve/llm-optimizations
vLLM        /home/steve/src/deepseek-v4-vllm-xpu-dspark
             80f1ad820706103d11f095c8a97e42c624c8bad3
XPU kernels /home/steve/src/deepseek-v4-xpu-kernels-mwidth-mhc
             2cc25d0ca08d3a76de27ee50c6dda258350e93e8
oneCCL      /home/steve/src/oneccl-2021.17.2-b70-sizegate
             48fda4f0e074db005596d6899d5227d3f0316c12
runtime     /mnt/fast-ai/runtime/oneccl-2021.17.2-b70-wideepoch-48fda4f/lib
venv        /home/steve/.venvs/deepseek-v4-xpu

The vLLM and XPU worktrees are clean. The oneCCL tree intentionally contains untracked local build output (_build-b70/ and generated include/oneapi/ccl/config.h); do not stage, delete, or mistake it for a source patch.

No DeepSeek service is currently running. The final candidate was stopped cleanly and all four GPUs are free. Verify rather than assume:

pgrep -af 'vllm|api_server|EngineCore|ray::' || true
ss -ltnp | rg ':18080|:8000' || true

The current source trees include later default-off experiments. The exact public-record source identity remains:

vLLM        264c7f2f7df21ddeeab32ecca0353133344f1ac9
XPU kernels 31315673737d95da0f79179c8f755260ef02c1d6
oneCCL      48fda4f0e074db005596d6899d5227d3f0316c12

For an exact record reproduction, use detached worktrees at those commits. Do not call the newer experimental HEAD the same run identity merely because all newer flags are off. The newer trees are the active development lane and are useful for same-binary control/candidate testing.

5. Record recipe and launcher

The base launcher is:

scripts/serve-k160-dspark-candidate.sh
  -> scripts/serve-k160-tp4-smoke.sh

The first script chooses eager/PIECEWISE graph modes, pins experiment flags, the draft pack, cache paths, and speculative width. The second validates clean source commits and model structure, loads oneAPI/oneCCL, records the full identity, runs a four-rank preflight, and launches vllm serve.

The record used target PIECEWISE, private breakable draft PIECEWISE at exact M=7, target verifier M=8, TP4+EP/DP1/PP1/concurrency1, FP8 KV, block 256, seven DSpark proposals, persistent Markov, W1-only replication, exact M8 compressors, M8 W8A16, MXFP4 N128, native M8 router, sharded greedy target argmax, and native rejection/commit. oneCCL preloads the wide-epoch runtime and routes only all-reduces larger than 131,072 bytes through the safe path.

Working-control launch from a compatible clean development tree:

cd /home/steve/llm-optimizations
RUN_DIR=/mnt/fast-ai/bench-results/deepseek-v4-flash-xpu/control-$(date -u +%Y%m%dT%H%M%SZ) \
VLLM_COMMIT="$(git -C /home/steve/src/deepseek-v4-vllm-xpu-dspark rev-parse HEAD)" \
KERNEL_COMMIT="$(git -C /home/steve/src/deepseek-v4-xpu-kernels-mwidth-mhc rev-parse HEAD)" \
DSPARK_GRAPH_MODE=piecewise \
DSPARK_DRAFT_GRAPH_MODE=piecewise \
DSPARK_SPEC_TOKENS=7 \
VLLM_XPU_DSPARK_EXACT_QUERY_CAPTURE=1 \
VLLM_XPU_GREEDY_FUSED_REJECTION=1 \
VLLM_XPU_GREEDY_SHARDED_TARGET_ARGMAX=1 \
VLLM_XPU_DSPARK_FIXED_M7_TARGET_INPUTS=1 \
VLLM_XPU_DSPARK_PERSISTENT_MARKOV=1 \
VLLM_XPU_DSPARK_REPLICATED_MARKOV_W1=1 \
VLLM_XPU_V4_COMPRESSOR_BATCHED_EXACT_MAX_M=8 \
VLLM_XPU_V4_BLOCK_FP8_W8A16_MAX_M=8 \
VLLM_XPU_MXFP4_SMALL_M_N=128 \
VLLM_XPU_V4_ROUTER_NORM_MAX_M=8 \
experiments/deepseek-v4-flash-reap-xpu-b70/scripts/serve-k160-dspark-candidate.sh

Keep rejected flags at zero, especially event/host/sharded Markov transports, M8 DPAS MHC, M8 pair-tile MHC, copy-elision, context-WKV fusion, and the fixed M8 target builder.

Canonical identity dump:

/mnt/fast-ai/bench-results/deepseek-v4-flash-xpu/
  dspark7-sharded-target-argmax-candidate-20260718T2100Z/identity.txt

Diff every field against it before interpreting speed.

6. Build workflow

vLLM Python changes

Most changes need no package rebuild when the active trees lead PYTHONPATH:

export PYTHONPATH=/home/steve/src/deepseek-v4-vllm-xpu-dspark:\
/home/steve/src/deepseek-v4-xpu-kernels-mwidth-mhc:${PYTHONPATH:-}
/home/steve/.venvs/deepseek-v4-xpu/bin/python -m py_compile changed_file.py

Run relevant unit tests before model load. IPC broker example:

cd /home/steve/src/deepseek-v4-vllm-xpu-dspark
/home/steve/.venvs/deepseek-v4-xpu/bin/python -m pytest -q \
  tests/distributed/test_xpu_ipc_broker.py

XPU native changes

cd /home/steve/src/deepseek-v4-xpu-kernels-mwidth-mhc
source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1
ninja -C build/temp \
  csrc/xpu/mhc/xe_2/CMakeFiles/mhc_kernels_xe_2.dir/mhc_pre.cpp.o \
  CMakeFiles/_xpu_C.dir/csrc/xpu/torch_bindings.cpp.o \
  _xpu_C.abi3.so
install -m 755 build/temp/_xpu_C.abi3.so \
  vllm_xpu_kernels/_xpu_C.abi3.so
sha256sum build/temp/_xpu_C.abi3.so vllm_xpu_kernels/_xpu_C.abi3.so

Sampler-only edits usually need topk_topp_sampler.cpp.o, torch_bindings.cpp.o, and the final link. SYCL device linking is expensive and may touch generated attention objects. If the Ninja dependency database is corrupt or causes spurious rebuilds:

ninja -C build/temp -t recompact

Do not copy a binary without recording source commit and binary SHA. The package .so is ignored by Git; source commits are the durable identity.

oneCCL

Do not replace the runtime casually. The wide collective epoch fixed deterministic failures around positions 28 and 58. Generic communication flag sweeps, recursive doubling, tiny-pair collectives, and resident polling are already rejected.

7. Test and promotion workflow

Use the cheapest valid gate first:

  1. source/static checks;
  2. one-card changed-input arithmetic and timing;
  3. all four cards independently if one card passes;
  4. changed-input fixed-address graph replay;
  5. real captured tensors/cycle corpus;
  6. guarded service load;
  7. ordered exact canaries before and after performance;
  8. same-binary control/candidate crossover;
  9. strict realistic suite, preferably three independent suites;
  10. LocalMaxxing only for a genuine matching record.

Do not load 96 GiB for a candidate that already fails exactness or its conservative component gate.

Exact canary capture and score:

python experiments/deepseek-v4-flash-reap-xpu-b70/scripts/capture-openai-logprob-corpus.py \
  --base-url http://127.0.0.1:18080 --model deepseek-v4-flash-k160 \
  --suite experiments/deepseek-v4-flash-reap-xpu-b70/quality/exact-canaries-v1.json \
  --out "$RUN_DIR/exact-canaries-pre.json" \
  --max-tokens 32 --top-logprobs 0 --label pre
python experiments/deepseek-v4-flash-reap-xpu-b70/scripts/score-exact-canaries.py \
  "$RUN_DIR/exact-canaries-pre.json" \
  --suite experiments/deepseek-v4-flash-reap-xpu-b70/quality/exact-canaries-v1.json \
  --out "$RUN_DIR/exact-canaries-pre-score.json"

The six ordered cases include 1073 -> 437 -> 1073, exact copy, factual, and strict JSON checks. Every row must be cache-zero.

Strict suite:

python scripts/bench-openai-realistic-suite.py \
  --base-url http://127.0.0.1:18080 --model deepseek-v4-flash-k160 \
  --suite repro/rapid-model-snapshots-b70/realistic-suite-v1.json \
  --max-tokens 128 --metric-tokens 100 --return-token-ids \
  --out "$RUN_DIR/strict-screen.json"

The 12-prompt public suite is a continuity screen. Deeper speculation promotion requires the larger frozen held-out packs in quality/spec-eval-contract-v1.json; public prompts alone do not prove against overfitting.

8. LocalMaxxing

Instructions: /home/steve/llm-optimizations/docs/localmaxxing.md.

Credential: /home/steve/.config/localmaxxing/api_key. Never print, paste, or commit it. Submission helper:

scripts/submit_localmaxxing_results.py \
  --payloads path/to/queue.json --label label-to-submit

Submit only when the result improves the matching GPU-count record, states one active generation, includes model/revision/quantization/topology/commits/full flags/hashes/evidence, passes exactness and realistic_final_gate, and uses primaryMetricName=median_tok_s_1_100_after_ttft. Never submit warmed, history-assisted, synthetic-only, or diagnostic results. The current approved DeepSeek record is cmrquta9905w3lg013m5vxoqx.

9. Performance ladder and durable wins

Reusable technical wins:

10. Major rejected paths: do not repeat

Read the named note before reopening a class.

Submission-only fusions

Markov winner transport

Do not retry transport that adds an eager/host synchronization boundary.

MHC and communication

Latest closure: notes/2026-07-18-m8-mhc-rms-fusion-closure.md.

Target LM head

Do not prioritize fused M8 target LM-head+argmax. The local BF16 head reads 252.5 MiB/rank and already takes about 0.452-0.454 ms near bandwidth roof. Its local max is only ~0.009 ms and output traffic is ~517 KiB. Expected fused saving is ~0.01-0.03 ms, with exact BF16-round-before-compare risk. The earlier native argmax packer was itself slower (28.935 vs 25.530 us).

Isolated wins that lost at endpoint

Never sum isolated savings into an endpoint claim. Use frozen same-binary B-A-B.

Speculation

11. Current profile

The post-record eager target profile attributes roughly 27.0-27.6 ms/cycle of noncollective work: routed MXFP4 ~7.19 ms, dense GEMM ~6.51, sparse QK/LSE ~3.54, MHC ~2.80, PV ~1.78, and pre-fusion router selection/sort ~1.06. The eager Markov sampler was ~10.5 ms/cycle under instrumentation, but graph wrapping did not remove its kernels or collective breaks.

The conclusion is architectural: we are not missing a flag. The remaining large opportunity is a fixed-geometry, fixed-address target/speculative decoder transaction—the Intel/SYCL/Level Zero analogue of HIPfire—where vLLM remains loader/API/oracle but no longer owns every hot-loop boundary.

12. Immediate next work

A. M7/M8 MoE activation portfolio (first)

This is the next untried captured-path boundary with a plausible >=0.50 ms floor:

  1. Extend existing shared-expert clamped-SwiGLU + FP8 activation quantization from record maximum M=2 to explicit allowed widths {1,2,7,8}.
  2. Extend the exact routed clamp/SwiGLU selector from M=2 to explicit M=7/M=8.
  3. Do not use a broad <=8 guard; gate draft M7 and target M8 independently.
  4. On every B70 require 40 changing eager and 32 changed fixed-address graph cases, exact FP8 values/scales, exact routed BF16 activations, and exact final target tokens. Preserve clamp-at-10 and BF16 rounding boundaries.
  5. Existing M2 evidence gives a conservative non-overlapping floor of about 0.514-0.546 ms/cycle; require >=0.50 ms on the slowest B70 before model load.
  6. If it passes, run frozen same-binary B-A-B suites, unchanged acceptance and token IDs, cache-zero requests, and rollover canaries.

Source locations to inspect first:

B. Exact DPAS W2 portfolio component (second)

Integrate exact BF16 DPAS W2 into the incumbent captured collective Markov path, not the rejected event path:

This may compound with A but is not a standalone path to 100 tok/s.

C. Specialized decoder transaction

Continue Option 4 in ../../plans/2026-07-16-deepseek-v4-flash-b70-100-200-tps-roadmap.md:

Reusable no-model assets:

D. Deeper speculation only after target economics

For 200 tok/s, compare emitted tokens per complete wall cycle under the frozen anti-cheating evaluator. Candidate families may include DSpark extension, DFlash/DEAGLE, or external draft, but do not invest until target verifier and draft cycle costs are measured on the same frozen workload.

13. Agent orchestration rules

Parallelize bounded independent tasks: source audit, arithmetic/tie/NaN/alias review, profile/result classification, harness construction, and doc/patch review. The primary agent owns final edits, build, GPU/process safety, service launch, exactness, classification, commits, and LocalMaxxing.

Do not let agents edit the same files concurrently. Inspect git status before every edit/build; unexplained changes belong to another agent or user and must be preserved. Report to the user only on a genuine record, major architectural result, real blocker, or requested status; otherwise continue through the ordered gate.

14. Documentation map

Read in order:

  1. /home/steve/AGENTS.md
  2. /home/steve/llm-optimizations/AGENTS.md
  3. /home/steve/llm-optimizations/CURRENT.md
  4. this file
  5. HANDOFF.md
  6. results/experiment-ledger.md
  7. ../../plans/2026-07-16-deepseek-v4-flash-b70-100-200-tps-roadmap.md
  8. quality/spec-eval-contract-v1.json
  9. note/data pair for any reopened boundary
  10. docs/localmaxxing.md and docs/local-ops.md before submission or privileged/runtime work.

Key current notes:

Mistake audits live under /home/steve/identified-mistakes/. Secrets live outside Git. Never print the Hugging Face token, LocalMaxxing key, or sudo password.

15. Final current status