nvidia/apply-inference-optimizations
> Apply FlashDreams-style inference speedups to model integrations after a `torch.compile`, CUDA graph capture, attention backend checks, decoder layout or replacement, transfer/materialization changes, and ordered presentation tuning. Use when porting known optimizations into a runner, demo, serving adapter, or downstream integration while preserving quality and reset behavior.
npx skills add https://github.com/NVIDIA/flashdreams --skill apply-inference-optimizations
Use this skill after profile-model-performance has identified the dominant
stage. Keep every optimization opt-in until benchmark and quality evidence show
that it is safe for the target workflow.
or config variants first.
explicit validation target.
validate-performance-qualitybefore promoting it as a default or documenting a speedup claim.
flashdreams-integrations before moving code across core, infra,recipes, or integrations. Avoid model-specific branches in shared layers; add
config slots or override hooks instead.
Use these when the measured hot stage is the transformer, scheduler loop, or
model-side cache interaction.
chunk sizes, preallocated buffers, and stable cache storage.
torch.compile to the smallest fixed-shape callable that containsreal compute. Keep cache mutation, dynamic setup, reset, and I/O outside the
compiled region unless a probe proves the broader scope is worth it.
remain eager while the saturated steady-state call is compiled.
Record first-visible chunk cost, hidden prewarm cost, and steady-state gain.
pointers, deterministic stream ordering, and explicit warmup. Start with the
smallest useful graph before attempting whole-step capture.
already dispatches to the desired backend, backend forcing is unlikely to
help and may change numerics.
Use these when timing shows append/slice churn, K/V refresh, history-window
growth, or cache synchronization cost.
the attention semantics allow it. Include sink tokens or pinned context
regions only if the original model relied on them.
is not enough if the bug only appears once the window evicts old frames.
path; off-by-one cache windows create plausible but divergent rollouts.
correct. Report both submit time and next-step wait time.
pending async cache work and rebuild state deliberately.
Use these when VAE or decoder time dominates the chunk budget.
chooses a preview-quality mode.
and candidate paths. Do not use separate autoregressive rollouts as strict
decoder-quality evidence.
profiling shows copy/layout overhead.
streaming decoder compilation can silently corrupt cache state or alter
numerics; reject it unless every output frame matches the reference within
the accepted tolerance.
saves a few milliseconds, record that and avoid live-path complexity.
visual artifacts show they are close enough to the quality decoder for the
intended use.
Use these when generated frames are ready faster than users see them, or when
CPU work dominates after decode.
CUDA frame objects, pinned host prefetch, or batched copies when the local
code already has those patterns.
queue backlog, but it changes motion continuity and should not be the
recommended quality path.
generation can feel slower if old frames accumulate in the presenter.
workflow is interactive.
Promote an optimization to the Recommended validation status only when all
apply:
acceptable;
and its validate-performance-quality status: Recommended,
Useful opt-in, Rejected, or Deferred.
Record failed attempts with the same care as successful ones: exact command,
observed speed, quality result, failure mode, and what would have to change to
revisit the idea. This prevents future integrations from repeating unsafe
compiler, decoder, cache, or presentation shortcuts.
Take nvidia/apply-inference-optimizations from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.