Skip to content

helios,heliopause,ignition: add FP8_E4M3_GLOBAL (=4) engram table encoding - #733

Closed
nero- wants to merge 1 commit into
NVIDIA:mainfrom
nero-:pr/fp8-e4m3-global-engram
Closed

nero- wants to merge 1 commit into
NVIDIA:mainfrom
nero-:pr/fp8-e4m3-global-engram

Conversation

@nero-

@nero- nero- commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Why is this change being proposed?

Models that ship per-tensor FP8 E4M3 auxiliary embedding tables (such as Qwen4-35B-A3B's 19.1 GiB Per-Layer Embedding table) currently have no lossless wire encoding in EngramTable.Encoding: NVFP4_E4M3_GLOBAL = 1 requires 4-bit weights plus a separate block-scale plane, while FP16 = 2 and BF16 = 3 double storage and forbid global_scale. Without a single-plane FP8 E4M3 encoding, exporting such a table either fails schema validation or forces lossy requantization into NVFP4.

Because this PR adds a new enum tag to the signed core-format Protobuf contract (EngramTable.Encoding), it requires explicit owner approval from Luke Alonso (<lalonso@gmail.com>) per docs/design-review.md Principle 1.

Paired companion PR & merge order:

  1. Merge first (this PR): NVIDIA/hyperflare-inference — adds the model-agnostic FP8_E4M3_GLOBAL = 4 engram table encoding across Protobuf, Helios, Heliopause, and Ignition.
  2. Merge second (companion recipe PR): qwen4-35b: support FP8 PLE, calibrated KV scales, opt-in NVFP4 MTP, fixed DFlash2, and 32 GiB Blackwell export local-inference-lab/hyperflare-recipes#167 — consumes FP8_E4M3_GLOBAL for Qwen4-35B-A3B FP8 PLE checkpoints.

What exactly did this PR change?

  • Signed core-format Protobuf & Python bindings (helios/proto/core.proto, helios/proto/runtime_core.proto, ignition/preparation/runtime_core_pb2.py):
    • Before: EngramTable.Encoding defined NVFP4_E4M3_GLOBAL = 1, FP16 = 2, and BF16 = 3.
    • After: Appends FP8_E4M3_GLOBAL = 4 (preserving existing tags 1–3 with no wire break) and regenerates runtime_core_pb2.py using protoc 35.1.
  • Helios schema & runtime delivery (helios/src/core/schema.rs, helios/src/runtime_core/engram.rs):
    • Before: schema.rs rejected unknown encodings and treated single-plane tables as forbidding global_scale; engram.rs only handled two-plane NVFP4_E4M3_GLOBAL and unscaled FP16/BF16.
    • After: Accepts FP8_E4M3_GLOBAL as a single-plane 1-byte-per-element weight table (scale_block == 0, no scale buffer/plane, row_width == embedding_width) requiring a finite positive global_scale, while keeping FP16 and BF16 strictly unscaled (global_scale == 0). Runtime staging delivers the single FP8 weight plane across both contiguous and partitioned shard layouts.
  • Heliopause exporter (heliopause/src/export/core.rs):
    • Before: parse_engram_encoding only recognized NVFP4_E4M3_GLOBAL, FP16, and BF16.
    • After: Parses "FP8_E4M3_GLOBAL", requires scale_block == 0, forbids scale buffers/shards, validates finite positive global_scale and positive embedding_width, and publishes single-plane weights/engram-*-weights.safetensors.
  • Ignition staged lookup (ignition/components/ngram_delivery.py):
    • Before: Only supported nvfp4_group16 staged lookup with weights + block scales.
    • After: Validates caps.quant_mode in ("nvfp4_group16", "fp8_e4m3_per_tensor") and registers a dedicated custom op flare::staged_ple_fp8 (mutating ("out", "timings", "barrier_output"), leaving "frame" immutable) that gathers FP8 E4M3 weights, casts to BF16, and scales by the per-tensor global_scale.
  • Documentation & tests (helios/manifest.md, docs/core-format-design.md, docs/cli-design.md, helios/src/core/schema.rs, helios/src/runtime_core/engram.rs, heliopause/src/export/core.rs, tests/preparation/test_embedding_table_handoff.py):
    • Documents FP8_E4M3_GLOBAL = 4 across core format, manifest, and CLI docs.
    • Adds Rust unit tests for contiguous and partitioned FP8_E4M3_GLOBAL tables plus negative tests (scale_block != 0, scale plane present, NaN/INFINITY/non-positive global_scale, embedding_width == 0), and Python tests verifying runtime_core_pb2.EngramTable.FP8_E4M3_GLOBAL == 4, flare::staged_ple_fp8 schema mutations, and unsupported quant_mode rejection.

What is the claimed benefit or result?

  • Enables lossless single-plane FP8 E4M3 auxiliary embedding tables at 1 byte/element (19.1 GiB for Qwen4-35B-A3B vs 38.2 GiB in BF16) with zero scale-plane memory or I/O overhead and zero lossy requantization.
  • Preserves full backward compatibility with all existing cores (NVFP4_E4M3_GLOBAL = 1, FP16 = 2, BF16 = 3).

What evidence supports those claims?

CPU & Unit Tests

  • cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib engram — 55 passed, 0 failed.
  • cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib schema — 21 passed, 0 failed.
  • cargo test --locked --manifest-path heliopause/Cargo.toml --lib engram — 7 passed, 0 failed.
  • pytest -q tests/preparation/test_embedding_table_handoff.py tests/preparation/test_frontend_spec.py tests/cli/test_config.py — 138 passed, 0 failed.
  • Release builds verified on both x86_64 (SM120 host) and aarch64 (SM121 DGX Spark): cargo build --locked --release --manifest-path flare-cli/Cargo.toml and heliopause/Cargo.toml.

Backward-Compatibility Serving Replay (No Re-Export)

  • Hardware: RTX 5090 (GB202 / SM120, 32 GiB VRAM, Linux x86_64).
  • Loaded a pre-existing signed core (Inkling-2-Mini-FLARE/model.safetensors, untouched / not re-exported) with the newly built flare binary (--gpus 0 --host 127.0.0.1 --port 8099):
    • Ready in 12s (21.02 GiB loaded, 9.77 GiB cache budget, 925,696 KV tokens, 64 snapshot slots).
    • /v1/chat/completions (What is 17 * 23? Answer with just the number., temperature=0) returned "391" and shut down cleanly on SIGTERM in 0.4s.
  • Negative wire-contract check: verified the new binary rejects a pre-rebase encoding = 3 table carrying global_scale with Error: single-plane engram table cannot carry scale metadata, confirming BF16 = 3 unscaled invariants remain enforced.

End-to-End GPU Export & Serving (Combined with Companion Recipe PR)

  • Hardware: RTX 5090 (GB202 / SM120, 32 GiB VRAM, TP1), paired with the companion hyperflare-recipes PR and flashinfer adb09a827.
  • Exported Qwen4-35B-A3B-NVFP4-Hybrid (--max-concurrency 8 --prefill-chunk-size 4096 --speculative-method mtp --mtp-draft-tokens 7 --mtp-only --mtp-expert-quantization nvfp4 --force-moe-decode-a16 --autotune-effort default --gpus 0):
    • Published single-plane weights/engram-0-weights.safetensors (20,480,458,752 bytes, no scale plane) with FP8_E4M3_GLOBAL = 4; 28,327.12 MiB used / 3,783.81 MiB free at export (83 graphs, 5,666 kernels).
  • Served the exported core with flare run --embedding-table-storage ram --prefix-cache-memory 32G --lossless-kv-compression cpu:
    • Ready in 10s (2.4s RAM table load, 24.54 GiB loaded, 6.17 GiB cache budget, 503,808 KV tokens, 82 snapshot slots).
    • /v1/chat/completions (What is 600 * 531? Answer with just the number., temperature=0) returned "318600" and shut down cleanly on SIGTERM in 1.4s.

Material Limitations / Unrun Checks

  • Windows I/O ring / flare-winui build, SM103, and multi-rank TP (world_size > 1) GPU export were not run on this machine (multi-span / partitioned table handling is covered by Rust unit tests in engram.rs and heliopause/src/export/core.rs).
  • Helios lifecycle simulator (verification/helios-lifecycle/check.py) was not run because no scheduler, admission, fence, cache-compaction, or rank-coordination paths were modified.

Discord: nero

…oding

Add single-plane FP8_E4M3_GLOBAL (= 4) encoding to EngramTable alongside
existing NVFP4_E4M3_GLOBAL (= 1), FP16 (= 2), and BF16 (= 3) encodings so
models with per-tensor FP8 auxiliary embedding tables can be exported and
served losslessly without requantizing into NVFP4.

- Proto & generated bindings: add FP8_E4M3_GLOBAL = 4 in helios/proto/core.proto,
  helios/proto/runtime_core.proto, and regenerate ignition/preparation/runtime_core_pb2.py
  with protoc 35.1.
- Helios & Heliopause: accept single-plane FP8 weights (scale_block == 0,
  no scale plane, finite positive global_scale, 1 byte per element) in
  helios/src/core/schema.rs, helios/src/runtime_core/engram.rs, and
  heliopause/src/export/core.rs.
- Ignition: support fp8_e4m3_per_tensor in ngram_delivery.py via custom op
  flare::staged_ple_fp8 (with strict quant_mode validation) and update docs
  and Rust/Python tests.

Design-Signed-Off-By: Gemini; design-review=2e5b
Signed-off-by: Jonathan Gutierrez <john.gtz@icloud.com>
@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 733.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot

Copy link
Copy Markdown
Collaborator

Review Stopped

Auto-Review halted due to finding: Another open pull request already covers this change, or more of it.
Value Proposition Report

@flare-autobot flare-autobot added area:engram Engram row gathering, disk I/O, and embedding-row caching. duplicate This issue or pull request already exists enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:design-review Needs a maintainer scope, architecture, or contract decision before implementation or integration. labels Dec 4, 2026
@nero-

nero- commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #732, which was opened shortly before this PR with the identical single-plane EngramTable.Encoding.FP8_E4M3_GLOBAL = 4 wire contract (scale_block == 0, no scale plane, finite positive global_scale). Confirming we independently verified the same = 4 contract end-to-end on RTX 5090 (SM120) and aarch64 DGX Spark (SM121); companion PR local-inference-lab/hyperflare-recipes#167 will target #732 directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:engram Engram row gathering, disk I/O, and embedding-row caching. duplicate This issue or pull request already exists enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:design-review Needs a maintainer scope, architecture, or contract decision before implementation or integration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants