Repository navigation
feature: H3 templates - expose attention_backend + cache everywhere, and a quality tier preset that sets the coupled knobs together #865
Description
Problem
To run the cinema path on dialogue-short the matrix had to rebuild the workflow (tools/ladder.py) because:
templates/minimax/dialogue-shorthas noattention_backendvariable (its variables: width, height, num_inference_steps, video_shift, audio_shift, weights_dtype, lora_*, seed, ...).reference-to-videohas one.sage_hubis lossless and 23-33% faster on H3; every H3 template that runs a transformer should expose it.- No H3 template exposes
cache. first_block 0.05 is -22% at 30 base steps. - A tier is 6-8 coupled settings: canvas,
weights_dtype,lora_model_name/weight_name,num_inference_steps,video_shift,audio_shift,cache,attention_backend. Getting one wrong silently degrades or re-stages (e.g. dropping the LoRA without raising steps and shift - validate warns about steps, but the agent still has to know 12/3 shift).
Proposal
- Add
attention_backendandcachevariables to every H3 template that has a transformer step (dialogue-short,shots-batch,music-video, chains,storyboard...). Default attention could stay null for portability, but the skill should say to setsage_hubon CUDA. - Add a
quality(ortier) variable whose values expand to a coherent bundle:
| tier | canvas | weights | LoRA | steps | shift v/a | cache | measured min/shot |
|---|---|---|---|---|---|---|---|
| draft | 960x544 | int4 | ref2v 4-step v0.1 | 5 | LoRA's | none | 3.5 |
| preview | 1344x768 | int8 | ref2v 4-step v0.1 | 5 | LoRA's | none | 7.2 |
| cinema-draft | 1344x768 | int8 | none | 12 | 12/3 | none | 12.9 |
| cinema | 1344x768 | int8 | none | 30 | 12/3 | first_block 0.05 | 23.1 |
Explicit variables still override. This needs a design decision: dw variables don't have preset bundles today - options are (a) a new presets block on a template, (b) separate catalog templates per tier (dialogue-short-cinema), (c) leave it to the skill. (a) keeps one template and makes the tier visible in get_workflow.
Open questions
- Should the cinema tier reduce
num_frames/refs automatically when the 1344x768 ceiling bites (124 frames max with 4 refs)? - Is int8 the right default for the cinema tier on a 64 GB host? int8 H3 holds ~63 GB RSS; mini-ai/MPS can't run SDNQ anyway.
Source: H3 quality matrix on lem (2x RTX 3090 24 GB, 125 GB host RAM), workspace h3-quality, Known Issues ep 6 shots, seed 42. Full data and per-run assessments: ~/testing/opus/known-issues/quality/matrix.json, report quality/REPORT.md; every run in h3-quality carries a note with its config, minutes and score. Related: #861 (follow-up experiments).
Activity
dkackman commentedon Oct 14, 2026
Plan v1: H3 templates expose
attention_backendandcache; no preset mechanismclaude-opus-5-5 / anthropic
Verdict: build smaller
Build part 1 of the proposal:
attention_backendandcachebecome variables on every H3 template. Cut part 2, thequality/tier preset mechanism. Once part 1 lands, every tier in the issue's table can be reached with plainarguments. The tier table then belongs in theminimax-h3skill as ready-to-pass argument sets, which #862's plan already proposes.h3-qualitymatrix had to rebuild workflows withtools/ladder.py, because today the cinema path (sage_hub, first_block 0.05) can't be reached by arguments ondialogue-short,shots-batch,music-video,storyboardor the chains. The two knobs are measured wins on Don's own work: sage_hub is 23–33% faster and lossless, and first_block 0.05 saves 22% at 30 steps. The same matrix produced H3 quality ramp: follow-up experiments (seed stability, cross-family composition lock, int4 base draft) #861–plan.estimate prices every H3 variant at the catalog figure - measured range is 3.5-44 min #866, so every H3 episode from now on hits these knobs.cachewill accept avariable:string, the same pattern the schema already uses for other fields (dw/workflow_schema.json:104,202,212,330,553,1247). It adds no new concept, no MCP/REST surface and no security change.presetsblock in the schema (top level isadditionalProperties: false,:119), expansion in_fold(dw/workflow.py:320-370), a new field on every discovery surface (dw/server/catalog.py,catalog_shape.py,routes/library.py:552-620,dw_mcp/catalog.py), the UI variable form, and tests for all of it.null, so behaviour is unchanged. Removing a variable later would break callers that pass it, so treat them as permanent.presetsblock, once tier names are depended on, could only be removed with abreaking-change.argumentsobject the agent passes as it stands. It gives up a tier you can see inget_workflow. The risk of mis-coupling the settings is covered by the existing 12-step warning (dw/argument_warnings.py:167) and by validate: warn on acceleration settings that can't pay off or won't fit (cache at low steps, TaylorSeer VRAM, compile under offload) #868's planned acceleration warnings.dialogue-short-cinema, …): 4× the H3 catalog entries against a compact budget that has about 24 tokens of headroom (tests/test_catalog_structure.py:474-477). Rejected.field-reportshowing a session mis-coupled a tier even with the skill's table, or a second family with a measured ladder that wants the same mechanism.minimax-h3reference. Once this feature lands, that reference can state each tier as arguments. That rewrite is idea: quality-ramp skill - draft -> preview -> final tiers with measured cost/quality trade-offs (H3 first) #862's work (or a follow-up fix), not this plan's. idea: quality-ramp skill - draft -> preview -> final tiers with measured cost/quality trade-offs (H3 first) #862 v1 already says "P1 only by save_workflow until feature: H3 templates - expose attention_backend + cache everywhere, and a quality tier preset that sets the coupled knobs together #865 lands".minimax-h3and RECIPES_24GB. No conflict.Problem and non-goals
Problem. On most H3 templates you can't set the attention backend or the block cache through arguments. Reaching the measured fast and cinema configurations means editing the JSON.
Non-goals:
num_framesor refs at 1344×768. The issue asks this as an open question; my answer is no, because the VRAM ceiling warning already reports it and silently changing the shot is worse;attention_backend.The design, with corrections to the proposal
The sweep checked the proposal against
develop@ 61838a9. It found these corrections:cachecan't be a variable today. The raw workflow is checked against the schema before substitution (dw/validation.py:746), and the schema requirescacheto be an object withtype(dw/workflow_schema.json:759-823). Onlythresholdtakesvariable:. So the proposal needs a syntax change:cachealso accepts a^variable:string.nullresult drops the key, which means no cache (dw/variables.py:62-132,:116-117).{"type":"bogus"}would pass validation and fail at load, the very failure the{}rule in CLAUDE.md exists to prevent.MiniMaxH3TransformerBlockis registered indw/cache_blocks.json:4, and first_block defaults to 0.05 (config_objects.py:217-285). Only the wiring and the schema change.attention_backendalready exists on four templates:video-with-audio,video-with-audio-768p,image-to-videoandreference-to-video. On each it defaults tonull, has no constraint, and is wired tocomponents.transformer.attention_backend(e.g.video-with-audio.json:45,135). The new ones copy that exact form.storyboard,generated-subject-reference,dialogue-shortandmusic-videodon't get the wiring.music.json(Music3) andmusic-video-cuts.json(tasks only) are out.compose-workflows.jsonpasses arguments through toimage-to-videoand gets nothing new.kernelsplusDIFFUSERS_TRUST_REMOTE_KERNELS=true(.env.example:96-108). Validation doesn't compare the backend to the device, so a sage_hub run on mps passes validate and fails at run time. The default staysnull, and the skill says "sage_hub on CUDA".Surfaces touched:
cacheschema widening (decided here);cache;No MCP tool, REST route or security change. Discovery already lists template variables, so the new ones show up in
get_workflowwith no surface change.Stages
Stage A:
attention_backendon every H3 transformer templateBuilds: an
attention_backendvariable (defaultnull) wired tocomponents.transformer.attention_backendat every H3 ModularPipeline step of:first-and-last-frame,last-frame-only,chained-segmentscomposable-references,chain-matched-to-audio,chain-matched-and-aligned,chain-video-continuityenhance-prompt,enhance-prompt-with-image,voice-timbre-referencegenerated-subject-reference,storyboardfor_eachsteps ofdialogue-short,shots-batchandmusic-videoIt touches no Z-Image steps.
Tests and docs:
attention_backend(it pins the rule for future templates);COMPACT_BUDGETwith a budget-log entry;docs/ACCELERATION.md:137-149(the list of four templates becomes "every H3 template");docs/WORKFLOW_GUIDE.md:1490-1499where it lists them;workflows/templates/minimax/README.md;minimax-h3skill line saying to setsage_hubon CUDA.Deploy: server (catalog files on lem and mini-ai). No engine change.
Estimate: $3–4.
Acceptance intent (over MCP):
get_workflowon each listed template showsattention_backendwith defaultnull.validate_workflowwith no new argument, and withattention_backend: "sage_hub", is clean on each.get_job_workflowhas noattention_backendkey on the transformer.dialogue-shortrun withattention_backend: "sage_hub"completes. Itsget_job_workflowshowscomponents.transformer.attention_backend: "sage_hub"on the H3 step and none on the Z-Image step.Stage B:
cacheas a variablecacheas an object (as today) or a^variable:string.nullmeans no cache.cachevariable (defaultnull) on every template from stage A plus the four older ones, wired to the H3 transformer step'scacheonly.variable:cache resolving to a valid object; resolving tonull(key dropped); and resolving to an invalid object (refused at validate, naming the field);tests/test_catalog_speed_defaults.py:37-49(test_turbo_schedules_carry_no_block_cache) changes to check the effective default instead of the presence of acachekey, since avariable:cachedefaulting tonullis still "no cache";cache;COMPACT_BUDGET;docs/WORKFLOW_GUIDE.mdcache section (a whole-object variable,null= off);docs/RECIPES_24GB.mdanddocs/ACCELERATION.md: replace "edit the JSON" with the argument;minimax-h3skill: cache only at ≥ ~20 base steps, never with the turbo LoRAs.get_workflowshowscachewith defaultnullon every H3 template.validate_workflowondialogue-short:cache: {"type":"first_block","threshold":0.05}: clean;cache: {"type":"bogus"}: refused at validate, namingcache;cache: "first_block"(a string, not an object): refused at validate.cacheargument behaves as today: no cache inget_job_workflow.dialogue-shortrun with first_block 0.05 completes, andget_job_workflowshows the cache on the H3 step only.cacheobject still validates and runs as before.Order: A, then B. B depends on A only because they edit the same files. Neither waits on another issue.
Risks
nulland the skill states the rule. A validate warning would be new code; see the follow-up below.validate_workflow, the run-time validate, andfor_eachmembers. The stage tests must cover afor_eachtemplate (dialogue-short).Proposed follow-up (Don decides)
Warn at validate when
attention_backendnames a CUDA-only kernel (sage_hub, other*_hubbackends) on a non-CUDA server. This fits #868's scope ("acceleration settings that can't pay off"), so I suggest adding it there rather than in a new issue.Questions
presetsschema block, expansion in_foldwith explicit arguments overriding, a field on the catalog/get_workflow//variablesroutes and the UI form, about $8–12. That makes it a new engine concept, and you'd be approving the tier names as permanent surface.cachevariable. Default: a whole object ({"type":…,"threshold":…}ornull). This allows turning the cache off and choosing other cache types. The alternative is acache_thresholdnumber inside a fixed first_block object. That needs no schema change and so drops stage B's syntax work (~$2 cheaper), but it can't turn the cache off unless the engine treats 0 as off, and it pins first_block forever.attention_backendandcachenull). This also answers the issue's int8 question: int8 is a tier choice the skill states, not a template default, because of host RAM (bug: two int8 H3 jobs on two cards OOM-kill the host - dispatch is VRAM-aware only, and the earlier job was the one killed #869) and mps. If you'd rather defaultattention_backendtosage_hub, every mps run of an H3 template would fail until the per-device follow-up exists.Reply in comments and hand back with
owner:lead. Approve by addingstatus:plan-approvedyourself. No agent may set it.dkackman commentedon Oct 14, 2026
Review of plan v1: approve as written. The code facts were checked against current develop and hold:
attention_backend.music.jsonandmusic-video-cuts.jsonhave no H3 step, and no template setscache.cachecan't be a variable today. The raw definition is checked against the schema before substitution (dw/validation.py:746), and the schema requirescacheto be an object.nullsubstitution drops the key (dw/variables.py:116).MiniMaxH3TransformerBlockis already registered indw/cache_blocks.json.test_turbo_schedules_carry_no_block_cacheneeds the planned change. It checks whether acachekey is present, so it has to check the effective default instead.Questions
cachevariable. feature: per-phase timing and cache skip stats in get_job / job events #867's P2 adds a reason:first_blockat 12 steps skipped nothing yet changed the output (PSNR 25.6 dB, where a plain rerun scores 44 dB). Just having the hook installed changes the numbers, so "threshold 0 means off" wouldn't really be off. Onlynulldropping the key truly turns the cache off.Implementation notes
dw/validation.py:291onward). That list feeds MCPvalidate_workflow, run-time validation andfor_eachmembers alike, which covers the plan's main risk without new plumbing.21a6f602) added text that stage B must update. The H3first_blockrow indocs/RECIPES_24GB.mdsays "no template sets it today, so add it to the workflow", andplugins/dw/skills/minimax-h3/references/quality-and-speed.mddescribes the same JSON-edit route. Both should name the argument once stage B lands. The plan'sdocs/ACCELERATION.mdline numbers are from before docs: minimax-h3 skill + RECIPES_24GB/ACCELERATION - base-model (no LoRA, int8) quality path and measured speed levers #863 and have shifted slightly.claude-opus-5-5 / anthropic, for Don
9 remaining items
Merge feat/865-A-h3-attention-backend: #883 stage A of #865
dkackman commentedon Oct 14, 2026
Moved to lem's loop (Don's call): this feature's spec and verification run MiniMax H3, which can't load on mini-ai (64 GB unified memory, no SDNQ on mps). Claim swapped
target:mini-ai→target:lemandbackend:cudaadded so the Mac loop doesn't claim it back. Stages read the parent's claim and backend. The existing spec cases stand.docs(proposals): #865 - design record for H3 template attention_backe…
dkackman commentedon Oct 14, 2026
Close-out: design record filed, handing to the tester for the final check
claude-opus-5-5 / anthropic
Closed: #883 stage A (
attention_backendon all 19 H3 templates, 0 bounces) and #884 stage B (cacheas a whole-object variable, with validate-timecache_errors; 2 bounces: the architecture map row, and a stringthresholdthat passed validate). Both were verified on lem.Design record:
docs/proposals/complete/h3-template-acceleration-complete.md, with atodo.mdentry under Shipped since the ranking. Docs-only commit, merged todevelop@b4916c7c. Nothing deployed. The stages already updated the user-facing docs and skill.Owed by this verify (from the spec comment): C-F417 (pending #882) expects
attention_backendandcacheto be refused ondialogue-short. Once #865 lands that no longer holds, so file asuiterequest to amend it.verify: run every case whose
source:names one of this feature's stages, and close the parent if they all pass.dkackman commentedon Oct 14, 2026
Verified on lem (develop @ b4916c7): claude-opus-5-5 via anthropic, feature-parent verify.
I ran every case whose
source:names #883 or #884 (C-F420 to C-F429) over MCP this session. All pass on intent.shape=shotminimax entries declareattention_backendandcache.components.transformer_ref.attention_backendandconfiguration.cacheon theshotfor_each step only. The Z-Image steps and the episode task carry neither.components.transformer.attention_backend_xon dialogue-short is refused atarguments.attention_backend_x(unknown variable). sage_hub with cache null validates on video-with-audio....configuration.cache(.type|.threshold):{"type":"bogus"}, the bare string"first_block",{},{"threshold":0.05}, and threshold"0.05".cache_short_schedulewarning on 9 steps.attention_backend: nullandcache: null.attention_backend: sage_hub. All 5 shots and the episode succeeded on cuda:1. Realizedattention_backend: "sage_hub".cache: {"type":"first_block","threshold":0.05}, 30 steps, lora null. Succeeded. Every shot's manifest timing reportscache: first_block 0.05, 29 forwards, 10–11 skipped (hit_rate 0.345–0.379).cacheand the variable removed. Succeeded with thecache_short_schedulewarning; manifestcache: first_block 0.05. A literal{"type":"bogus"}is refused atsteps[0].pipeline.configuration.cache.type.Two caveats:
get_job_workflowfolds arguments intovariablesbut leaves step references as"variable:attention_backend"/"variable:cache". So the literal "no key" / "value on the step" checks in C-F422/C-F423/C-F427/C-F428 are judged from realizedvariablesand the manifest'stiming.cache. That evidence is stronger than the step dict. I'm taking the wording to a suite amendment rather than counting it as a failure.cacheand with the default LoRA, so it is the canvas, not feature: H3 templates - expose attention_backend + cache everywhere, and a quality tier preset that sets the coupled knobs together #865.validate_workflowon the same args said valid with no VRAM warning. I'm filing that separately. C-F428 was judged on the default canvas (960x544), above.All outputs were deleted (f24f76d9dcdb, 0b6252688241, c528260fa756, fe28835ace0a).