Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

docs(fp8): document that FP8 Compute needs the model fully resident

Alexander Eichhorn49990d643e4d
diff --git a/docs/src/content/docs/configuration/fp8-storage.mdx b/docs/src/content/docs/configuration/fp8-storage.mdx
index 799821b079..2e0595c914 100644
--- a/docs/src/content/docs/configuration/fp8-storage.mdx
+++ b/docs/src/content/docs/configuration/fp8-storage.mdx
@@ -1,5 +1,5 @@
---
-title: FP8 Storage
+title: FP8 Storage & Compute
sidebar:
order: 3
---
@@ -29,9 +29,9 @@ InvokeAI's FP8 path stores weights in FP8 and casts them back to BF16/FP16 on ea
The toggle works as advertised: the UNet / transformer drops by roughly 50% on the GPU. Per-step latency is the same or marginally slower because every forward pass adds an FP8 → BF16 cast on entry and a BF16 → FP8 cast on exit. This is the **largest target group**: 3090 owners squeezing FLUX into 24 GB benefit the most.
-### RTX 40-series, RTX 50-series, and Hopper — VRAM win today, compute win possible later
+### RTX 40-series, RTX 50-series, and Hopper — VRAM win, plus a compute win via a separate setting
-These GPUs have native FP8 tensor cores. The toggle still buys you the same ~50% VRAM reduction today, because the forward pass still runs in BF16 — the hook casts weights back up to compute precision before each layer. If InvokeAI later wires up a true FP8 matmul path (e.g. via `torchao`), the same toggle will *also* unlock compute speedups on this hardware. Until then, treat the benefit as "VRAM only, same as Ampere".
+These GPUs have native FP8 tensor cores. FP8 *Storage* on its own still only buys the ~50% VRAM reduction, because the forward pass runs in BF16 — the hook casts weights back up to compute precision before each layer. To actually use the tensor cores you need the separate [FP8 Compute](#fp8-compute) setting, which applies to checkpoints that ship pre-quantized ("scaled fp8") rather than to full-precision ones.
### Older CUDA cards — still a VRAM win
@@ -90,10 +90,38 @@ If you see unexpected quality regressions, disable FP8 Storage on the affected m
## Combining with Low-VRAM mode
-**FP8 + partial loading**: fully supported. FP8 Storage shrinks the layers; partial loading streams them between RAM and VRAM as needed. Use both on tight VRAM budgets.
+**FP8 Storage + partial loading**: fully supported. FP8 Storage shrinks the layers; partial loading streams them between RAM and VRAM as needed. Use both on tight VRAM budgets.
+
+**FP8 Compute + partial loading** is a different story — it still works, but it costs both speed and reproducibility. See [FP8 Compute](#fp8-compute) below.
(For why FP8 Storage doesn't stack on top of GGUF / NF4 / int8 checkpoints, see the callout at the top of this page.)
+## FP8 Compute
+
+Everything above describes FP8 *Storage*: a per-model toggle that changes how weights are **stored**, while the math still runs in BF16. `fp8_compute` is a separate, global setting in `invokeai.yaml` that changes how they are **multiplied** — ComfyUI "scaled fp8" checkpoints stay quantized and their matmuls run on the FP8 tensor cores via `torch._scaled_mm`, instead of being dequantized at load time.
+
+It needs an Ada (SM 8.9) or newer NVIDIA GPU and falls back to the dequantized path automatically on anything older. It applies to checkpoints that already ship quantized; FP8 Storage is the toggle for full-precision ones.
+
+:::danger[Reproducibility requires the model to be fully in VRAM]
+With `fp8_compute` enabled, **the same seed only reproduces the same image if the model is 100% resident in VRAM.**
+
+The FP8 matmul needs both operands on the same device, so a layer whose weights are still in RAM cannot use it and silently falls back to the dequantized BF16 path. That fallback is numerically different — and *which* layers it hits depends on how much of the model happened to fit at that moment, which shifts between runs as VRAM pressure changes.
+
+Measured on a 24 GB card with a ~12 GB transformer sitting at 88–95% residency: two runs with an identical seed and identical settings differed in **98.7% of all pixels**. With the model fully resident, repeated runs were **bit-identical**.
+
+A *constant* residency fraction would in principle be reproducible too, but nothing guarantees one in practice — other resident models, per-node working-memory reservations and allocator state all move the line between runs.
+
+To get repeatable output, check the model's load line in the log for `VRAM: … (100.0%)`. If it is below that, free up VRAM (lower resolution, fewer resident models, a smaller text encoder) or set `enable_partial_loading: false`.
+:::
+
+Keeping the model fully resident is worth it for speed as well: on the same 24 GB card, streaming the last 5–12% of the transformer over PCIe cost **+47% per step** (1.03 → 1.51 s/it at 1024², 8 steps).
+
+### Layers the checkpoint marks as full-precision
+
+Some scaled-fp8 checkpoints mark individual layers with `full_precision_matrix_mult`, meaning the producer measured them as unsafe to multiply in FP8. InvokeAI honors those markers by default, which means those layers dequantize on every forward instead of using the tensor cores. On checkpoints that mark many layers this can cost a large part of the FP8 Compute speedup.
+
+`fp8_compute_full_precision_hints: false` overrides the markers and runs every quantized layer on the tensor cores. It is faster, but you are deliberately going against the checkpoint author's instruction — the marked layers were flagged as numerically sensitive, so compare output before settling on it.
+
## Troubleshooting
### "I toggled FP8 Storage but VRAM usage didn't change"
diff --git a/docs/src/generated/settings.json b/docs/src/generated/settings.json
index 2c183f5540..387efbc698 100644
--- a/docs/src/generated/settings.json
+++ b/docs/src/generated/settings.json
@@ -457,6 +457,28 @@
"type": "<class 'bool'>",
"validation": {}
},
+ {
+ "category": "CACHE",
+ "default": false,
+ "description": "Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed. Reproducibility also requires the model to be FULLY resident in VRAM: a layer whose weights are still in RAM falls back to the dequantized path, and since which layers are resident shifts from run to run, the same seed then yields visibly different images. For repeatable output, ensure the model loads at 100% (e.g. enable_partial_loading=false with enough free VRAM).",
+ "env_var": "INVOKEAI_FP8_COMPUTE",
+ "literal_values": [],
+ "name": "fp8_compute",
+ "required": false,
+ "type": "<class 'bool'>",
+ "validation": {}
+ },
+ {
+ "category": "CACHE",
+ "default": true,
+ "description": "Honor the per-layer 'full_precision_matrix_mult' flags that some scaled-fp8 checkpoints ship. Those layers then dequantize on every forward instead of using the fp8 tensor cores, which can cost a large part of the fp8_compute speedup - on checkpoints that mark many layers, most of it. Set to false to run every quantized layer on the fp8 tensor cores, ignoring the producer's instruction; faster, but the marked layers were flagged as numerically sensitive, so quality may suffer. Only has an effect when fp8_compute is enabled.",
+ "env_var": "INVOKEAI_FP8_COMPUTE_FULL_PRECISION_HINTS",
+ "literal_values": [],
+ "name": "fp8_compute_full_precision_hints",
+ "required": false,
+ "type": "<class 'bool'>",
+ "validation": {}
+ },
{
"category": "CACHE",
"default": null,
diff --git a/invokeai/app/services/config/config_default.py b/invokeai/app/services/config/config_default.py
index f4857bb173..9393697848 100644
--- a/invokeai/app/services/config/config_default.py
+++ b/invokeai/app/services/config/config_default.py
@@ -205,7 +205,7 @@ class InvokeAIAppConfig(BaseSettings):
device_working_mem_gb: float = Field(default=3, description="The amount of working memory to keep available on the compute device (in GB). Has no effect if running on CPU. If you are experiencing OOM errors, try increasing this value.")
enable_partial_loading: bool = Field(default=True, description="Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.")
keep_ram_copy_of_weights: bool = Field(default=True, description="Whether to keep a full RAM copy of a model's weights when the model is loaded in VRAM. Keeping a RAM copy increases average RAM usage, but speeds up model switching and LoRA patching (assuming there is sufficient RAM). Set this to False if RAM pressure is consistently high.")
- fp8_compute: bool = Field(default=False, description="Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed.")
+ fp8_compute: bool = Field(default=False, description="Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed. Reproducibility also requires the model to be FULLY resident in VRAM: a layer whose weights are still in RAM falls back to the dequantized path, and since which layers are resident shifts from run to run, the same seed then yields visibly different images. For repeatable output, ensure the model loads at 100% (e.g. enable_partial_loading=false with enough free VRAM).")
fp8_compute_full_precision_hints: bool = Field(default=True, description="Honor the per-layer 'full_precision_matrix_mult' flags that some scaled-fp8 checkpoints ship. Those layers then dequantize on every forward instead of using the fp8 tensor cores, which can cost a large part of the fp8_compute speedup - on checkpoints that mark many layers, most of it. Set to false to run every quantized layer on the fp8 tensor cores, ignoring the producer's instruction; faster, but the marked layers were flagged as numerically sensitive, so quality may suffer. Only has an effect when fp8_compute is enabled.")
# Deprecated CACHE configs
ram: Optional[float] = Field(default=None, gt=0, description="DEPRECATED: This setting is no longer used. It has been replaced by `max_cache_ram_gb`, but most users will not need to use this config since automatic cache size limits should work well in most cases. This config setting will be removed once the new model cache behavior is stable.")
diff --git a/invokeai/frontend/web/openapi.json b/invokeai/frontend/web/openapi.json
index 7479edb4e2..5ca59e04d2 100644
--- a/invokeai/frontend/web/openapi.json
+++ b/invokeai/frontend/web/openapi.json
@@ -48054,7 +48054,7 @@
"fp8_compute": {
"type": "boolean",
"title": "Fp8 Compute",
- "description": "Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed.",
+ "description": "Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed. Reproducibility also requires the model to be FULLY resident in VRAM: a layer whose weights are still in RAM falls back to the dequantized path, and since which layers are resident shifts from run to run, the same seed then yields visibly different images. For repeatable output, ensure the model loads at 100% (e.g. enable_partial_loading=false with enough free VRAM).",
"default": false
},
"fp8_compute_full_precision_hints": {
diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.ts
index b6ca2cbf4d..64079818b2 100644
--- a/invokeai/frontend/web/src/services/api/schema.ts
+++ b/invokeai/frontend/web/src/services/api/schema.ts
@@ -18824,7 +18824,7 @@ export type components = {
keep_ram_copy_of_weights?: boolean;
/**
* Fp8 Compute
- * @description Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed.
+ * @description Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU; falls back automatically otherwise). Roughly halves the transformer's VRAM and speeds up denoising, but quantizes activations as well, so images will differ from previous versions at the same seed. Reproducibility also requires the model to be FULLY resident in VRAM: a layer whose weights are still in RAM falls back to the dequantized path, and since which layers are resident shifts from run to run, the same seed then yields visibly different images. For repeatable output, ensure the model loads at 100% (e.g. enable_partial_loading=false with enough free VRAM).
* @default false
*/
fp8_compute?: boolean;