Skip to content

#865 stage A: attention_backend variable on every H3 transformer template #883

Closed

Description

@dkackman

Stage A of #865. Builds the plan's Stage A section; the plan comment stays authoritative: #865 (comment) (plan v1, approved).

claude-opus-5-5 / anthropic

Builds

An attention_backend variable (default null, no constraint) wired to components.transformer.attention_backend at every H3 ModularPipeline step, copying the exact form the four templates that already have it use (e.g. video-with-audio.json). Templates:

  • first-and-last-frame, last-frame-only, chained-segments
  • composable-references, chain-matched-to-audio, chain-matched-and-aligned, chain-video-continuity
  • enhance-prompt, enhance-prompt-with-image, voice-timbre-reference
  • generated-subject-reference, storyboard
  • the for_each steps of dialogue-short, shots-batch and music-video

Not touched: Z-Image steps inside storyboard, generated-subject-reference, dialogue-short, music-video; music.json, music-video-cuts.json, compose-workflows.json. The four templates that already have it (video-with-audio, video-with-audio-768p, image-to-video, reference-to-video) stay unchanged. No engine change, no template default changes.

Owes

  • a catalog test that every H3 transformer step wires attention_backend (pins the rule for future templates);
  • raise COMPACT_BUDGET (tests/test_catalog_structure.py) with a budget-log entry;
  • docs/ACCELERATION.md (the list of four templates becomes "every H3 template"; line numbers shifted after docs: minimax-h3 skill + RECIPES_24GB/ACCELERATION - base-model (no LoRA, int8) quality path and measured speed levers #863);
  • docs/WORKFLOW_GUIDE.md where it lists them;
  • workflows/templates/minimax/README.md;
  • the minimax-h3 skill: set sage_hub on CUDA (needs kernels + DIFFUSERS_TRUST_REMOTE_KERNELS=true), leave null elsewhere.

Deploy

Server: catalog files on lem and mini-ai. No engine change.

Passes when

Its repro works (on lem, dialogue-short with attention_backend: "sage_hub" completes and get_job_workflow shows components.transformer.attention_backend: "sage_hub" on the H3 step and none on the Z-Image step) and every pending: #<this issue> case the tester writes passes.

Blocked by: nothing.

Activity

  1. added
    featureWork bigger than a fix: designed with Don, built in stages (harnest R11)
    owner:leadFeature lead's turn (harnest R11)
    stageA child issue: one stage of a feature
    on Oct 14, 2026
  2. added
    target:mini-aiFound against a non-lem server (DW_TARGET=mini-ai); Don triages
    on Oct 14, 2026
  3. added 3 commits that reference this issue on Oct 14, 2026
  4. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Stage A built: merged to develop @ 54f0e9e

    claude-opus-5-5 / anthropic

    Shipped: branch feat/865-A-h3-attention-backend, merged into develop as 54f0e9e. This is a catalog and docs change only, with no engine code. The driver deploys develop to mini-ai after this session. Nothing was deployed from here.

    Plan items covered:

    • attention_backend variable (default null, no constraint) on all 15 listed templates. It is wired as "attention_backend": "variable:attention_backend" at the H3 step's transformer component, in the same form as video-with-audio.json. The 15: first-and-last-frame, last-frame-only, chained-segments, composable-references, chain-matched-to-audio, chain-matched-and-aligned, chain-video-continuity, enhance-prompt, enhance-prompt-with-image, voice-timbre-reference, generated-subject-reference, storyboard, and the shot for_each step of dialogue-short, shots-batch and music-video.
    • Steps left alone:
      • the Z-Image steps, the Music3 write_song step in music-video, music.json, music-video-cuts.json and compose-workflows.json;
      • the four templates that already had the variable. They show no diff.
    • Catalog tests in tests/test_catalog_structure.py:
      • test_every_h3_transformer_step_wires_attention_backend, parametrized over every template with a MiniMaxAI/MiniMax-H3 step (19 of them);
      • test_only_h3_steps_wire_attention_backend;
      • two tests that run the real replace_variables on dialogue-short. With sage_hub, only the H3 shot step gets the backend. With the default, the key is dropped.
    • COMPACT_BUDGET went from 10_700 to 10_800, with a budget-log entry. Measured at 10_758, so the 15 templates added about 79 tokens.
    • Docs:
      • docs/ACCELERATION.md: the list of four templates now reads "every MiniMax-H3 template".
      • docs/WORKFLOW_GUIDE.md: the component-level attention_backend bullet says so too. The guide had no list of templates; lines 1490-1499 cover the pipeline-level key.
      • workflows/templates/minimax/README.md.
    • minimax-h3 skill:
      • SKILL.md gets the rule "CUDA: attention_backend=sage_hub (null elsewhere; mps fails at run)".
      • references/quality-and-speed.md gets the detail: kernels and DIFFUSERS_TRUST_REMOTE_KERNELS=true.
      • SKILL.md was 6 bytes under its 12 KiB cap. To make room I cut one non-rule sentence from the chain bullet ("The guide prefix is trimmed off again…").

    Deviation: tell the tester. The plan and the "passes when" line say components.transformer.attention_backend. That holds for the t2va and fl2va templates. On ref2va templates the H3 transformer component is transformer_ref, and the backend is wired there, exactly as the existing reference-to-video.json does. That covers dialogue-short, music-video, storyboard, composable-references, the three chain-* templates, generated-subject-reference and voice-timbre-reference. So on dialogue-short, get_job_workflow shows components.transformer_ref.attention_backend: "sage_hub" on the shot step.

    Hardware:

    Tests: the full pytest has the same 17 failures as develop before this branch (Kandinsky 6 and others). There are no new ones, and ruff check is clean.

  5. added and removed
    owner:leadFeature lead's turn (harnest R11)
    on Oct 14, 2026
  6. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Architecture review queued by the loop driver: this hand-off changed dw/ or dw_mcp/ on develop (f8fda594ea..dfc7c49c4a: dw/references.py dw/security.py). The reviewer checks it against docs/ARCHITECTURE.md before the tester verifies.

  7. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Architecture review: pass

    claude-opus-5-5 / anthropic

    What I read: git diff f8fda594..dfc7c49c -- dw/ dw_mcp/ (dw/references.py, dw/security.py) and git log f8fda594..dfc7c49c -- dw/ dw_mcp/.

    Result: none of this issue's commits (4515906, 0ec85cb, 5e7b0cc, merge 54f0e9e) touch dw/ or dw_mcp/. The only engine commit in the range is c467a54, which is #873's (one owner of the variable-name characters), so this review doesn't cover it. #883 has no engine code to check against docs/ARCHITECTURE.md or stage-c item 3, so there are no findings and nothing waived.

    The tester verifies next, including the transformer_ref deviation on the ref2va templates that the build comment flagged.

  8. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Verify pass on mps on mini-ai.lan (develop @ dfc7c49). Tester: claude-opus-5-5 via anthropic.

    The stage's pending: #883 cases, run as written:

    • C-F420: pass. list_workflows lists attention_backend on all 19 H3 templates. get_workflow shows each one declares it with default null, and wires "attention_backend": "variable:attention_backend" into exactly the H3 step's transformer. The ref2va templates wire it at components.transformer_ref, the t2va/fl2va ones at components.transformer, as the hand-off says. No Z-Image, write_song, generate_speech or prompt_enhancer step references it.
    • C-F421: pass. validate_workflow returned valid: true on all 19 templates, both with <base> alone and with <base> + {"attention_backend": "sage_hub"}. <base> used the priya qa-cast portrait/voice assets for each template's required media inputs. No error mentioned attention_backend; mps gave no CUDA warning, and the case doesn't require one. Step 3, dialogue-short + {"attention_backend_x": "sage_hub"}: refused at arguments.attention_backend_x, "Unknown variable 'attention_backend_x'; declared variables: attention_backend, ...".
    • C-F422: not runnable here. run_workflow(templates/minimax/first-and-last-frame, {first/last image = asset:qa-cast/priya-portrait.jpg, width 512, height 288, num_frames 124, seed 42}) started as job a1264f45fe71. It sat in phase loading / pipeline: MiniMaxAI/MiniMax-H3 for over 18 minutes, emitting only phase_stall notices. validate_workflow reports downloads_required for this server: MiniMaxAI/MiniMax-H3 464.2 GB and lightx2v/Minimax-h3-Turbo 54.7 GB. That model doesn't fit mini-ai's 64 GB of unified memory. I called cancel_job. It hadn't taken effect by the end of the session, because loading isn't a cancel boundary. The job and any partial run dir 20261014-031505-9a0fa304 may still be on the server.
    • C-F423: CUDA only by its own text.

    The issue's own repro (dialogue-short with sage_hub on CUDA) and C-F422/C-F423 need lem. Handing to lem's loop. owner:tester and status:fixed-pending-verify are unchanged, and the pending: #883 lines stay until C-F422/C-F423 pass there.

    Note for lem's tester: the C-F420/C-F422/C-F423 text says components.transformer. On the ref2va templates the wiring is at components.transformer_ref (dialogue-short is one of them), so read C-F423's "H3 step" check against transformer_ref. I'm not editing the cases from here.

  9. added and removed
    target:mini-aiFound against a non-lem server (DW_TARGET=mini-ai); Don triages
    on Oct 14, 2026
  10. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Verified on lem (CUDA): pass

    Tester: claude-opus-5-5 via anthropic. lem on develop @ 7e1bfdf, get_server_info device cuda.

    This completes the mini-ai pass above, which covered C-F420 and C-F421. It runs the CUDA half, workspace regression-complete.

    C-F422, the default run. run_workflow(templates/minimax/first-and-last-frame, {image, last_image = asset:qa-cast/priya-portrait.jpg, width 512, height 288, num_frames 124, seed 42}) gave job 6211d8075e4e, which succeeded on cuda:0 in about 3 minutes. get_job_workflow returns variables.attention_backend: null. The H3 step's components.transformer holds "attention_backend": "variable:attention_backend", which is the template's reference and not a substituted value. get_job_workflow realizes a run by folding the arguments into variables and leaves step references unsubstituted, so the case's literal check ("no attention_backend key at all") can't be observed from this tool. What I could observe: the null default doesn't break the run.

    C-F423, the issue's own repro. run_workflow(templates/minimax/dialogue-short, {character_a_voice/character_b_voice = asset:qa-cast/priya-voice.wav, attention_backend: "sage_hub", seed 42}) gave job 4637d362563a, which succeeded on cuda:1. It took 1687 s (about 28 min), against the 38.6 min the observed estimate gave. That is consistent with a faster attention path, but it doesn't prove it. In get_job_workflow:

    • variables.attention_backend is "sage_hub".
    • The shot for_each step (MiniMax-H3, ref2va) wires it at components.transformer_ref.attention_backend: "variable:attention_backend". That is transformer_ref, as the build comment's deviation note says.
    • draw_character_a and draw_character_b (Z-Image) carry no attention_backend.
    • The episode task doesn't either.

    Neither job's log/warning events name the attention backend, so there is no direct runtime confirmation that sage_hub was applied, only that the run accepted it and completed. I'm filing that observability gap separately; it doesn't block this stage.

    Both runs were removed with delete_output(job_id=…).

    Result: the stage's repro and all four pending: #883 cases pass on intent. I removed their pending: lines. The case text for C-F420, C-F422 and C-F423 says components.transformer and expects a substituted key in get_job_workflow. I'm sending that wording through a suite amendment on the harness repo rather than editing the cases. Closing as verified.

  11. added
    status:verifiedTester confirmed the fix via a real MCP call
    and removed on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureWork bigger than a fix: designed with Don, built in stages (harnest R11)owner:testerTester's turn to actstageA child issue: one stage of a featurestatus:verifiedTester confirmed the fix via a real MCP calltarget:lem

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions