Skip to content

feat: add BRACE calibrator for DBCache - #1368

Merged
DefTruth merged 3 commits into
mainfrom
dev
Nov 19, 2026
Merged

DefTruth merged 3 commits into
mainfrom
dev

Conversation

@DefTruth

Copy link
Copy Markdown
Member

Summary

Add BRACE (Barycentric Rational Forecasting with Chebyshev Enhancement, arXiv:2608.07572) as an experimental DBCache calibrator.

Related to #1363.

What changed

  • Add BRACECalibrator with a bounded FIFO of real full-compute anchors, canonical domain mapping over logical steps, the second barycentric form, and adapted Chebyshev weights.
  • Support non-uniform anchor spacing and independent named streams. Predictions never enter the FIFO.
  • Use fp32 numerator accumulation for fp16/bf16 inputs and return to the input dtype.
  • Add an observable latest-anchor fallback for non-finite or near-zero denominators. Restrict gamma to [0.5, infinity) because smaller values admit extrapolation poles.
  • Expose Python, YAML, and CLI configuration, including --calibrator brace --calibrator-params capacity=3,gamma=0.7.
  • Add unit tests, reset/config regressions, an example YAML, user documentation, and the versioned cache-algorithm research archive.

DBCache scheduling, Fn/Bn granularity, warmup, and cache guards are unchanged.

Tests

  • 244 passed across BRACE and the related TaylorSeer, HiCache, FoCa, DMD, SVD, config, and reset regression matrix.
  • All pre-commit hooks pass.
  • Tests include hand-computed C=2/C=3 references, non-uniform anchors, partial windows, exact denominator cancellation, normal-path zero-fallback checks, FIFO bounds, idempotent queries, multi-stream state, real cache-hit wiring, C=1 bit-exact reuse, and zero-cache bit-exact behavior.

FLUX.1-dev E2E

Environment: RTX PRO 5000, physical GPU 2, torch 2.15.0+cu132, 1024x1024, 28 steps, seed 0. All calibrator arms explicitly enable the encoder stream. Every cache arm reports 12/28 Cache Steps; neither BRACE arm emits a fallback warning.

Config Latency Speedup vs base Peak memory Cache Steps PSNR / SSIM vs base PSNR / SSIM vs compile
Base eager 16.90s 1.00x 33.82GiB 0 — —
Compile 14.80s 1.14x 33.82GiB 0 28.08 / 0.9706 —
Compile + DBCache reuse 8.65s 1.95x 33.87GiB 12 29.81 / 0.9669 29.03 / 0.9614
Compile + TaylorSeer O1 8.66s 1.95x 33.95GiB 12 27.95 / 0.9675 31.52 / 0.9740
Compile + BRACE C3, gamma=0.7 8.66s 1.95x 33.92GiB 12 29.01 / 0.9695 30.75 / 0.9743
Compile + BRACE C2, gamma=0.7 8.65s 1.95x 33.90GiB 12 31.21 / 0.9744 29.57 / 0.9720

This is a single-prompt compile wiring probe, not a universal predictor ranking. High-acceleration, multi-prompt, multi-backbone, and noise-floor validation remain future work.

Visual comparison

All outputs preserve the cat, sign, and Hello world text; no black images or structural corruption were observed.

FLUX BRACE comparison

@DefTruth
DefTruth merged commit 56c045c into main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant