Commit ·
3c30811
1
Parent(s): 0bb40bf
stacking refmods
Browse files
h3-center/docs/MINIMAX_H3_REFMOD_STACKING_AND_MULTISUBJECT_GUIDE.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax-H3 RefMod Stacking, Semantic Routing & Multi-Subject Architecture Guide
|
| 2 |
+
|
| 3 |
+
## 1. Executive Summary & Overview
|
| 4 |
+
|
| 5 |
+
In MiniMax-H3 video generation, **RefMod Stacking** is the practice of injecting multiple pre-encoded latent references (`.safetensors`) into the model's single-stream conditioning pipeline.
|
| 6 |
+
|
| 7 |
+
Whether boosting facial fidelity for a single persona against aggressive concept LoRAs (e.g. Triple-RefMod ensembles) or generating simultaneous multi-character scenes (e.g. 6-RefMod dual-persona shots like **Billie Eilish & Miley Cyrus**), RefMods operate via **attention-driven semantic routing** rather than hard-coded input slots.
|
| 8 |
+
|
| 9 |
+
This guide provides the complete architectural, mathematical, and practical explanation of how RefMod stacking works under the hood, how the model maps arbitrary numbers of RefMods to `<Subject 1>` and `<Subject 2>`, what happens when RefMod order or strengths change, how Dual Audio Timbre Conditioning integrates for simultaneous polyphonic dialogue and duets, and how to handle edge cases like phenotypic lookalikes and asymmetric stacks.
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## 2. Foundational Architecture: How RefMods Work Under the Hood
|
| 14 |
+
|
| 15 |
+
### 2.1 The Single-Stream Packed DiT Sequence
|
| 16 |
+
MiniMax-H3 uses a single-stream Audio-Video Diffusion Transformer (DiT) with 50 transformer layers and 56 attention heads (`hidden_size = 5376`). Unlike older architectures that use separate cross-attention layers for text and image references, MiniMax-H3 packs **everything** into one contiguous sequence of tokens:
|
| 17 |
+
|
| 18 |
+
```
|
| 19 |
+
[ Text Tokens (Qwen3-VL) | RefMod Visual Latents | Audio Latents | Target Video Latents ]
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
```
|
| 23 |
+
┌────────────────────────────────────────────────────────────────────────────────────────┐
|
| 24 |
+
│ MINI-MAX H3 PACKED SEQUENCE │
|
| 25 |
+
├───────────────────┬───────────────────────────────┬─────────────────┬──────────────────┤
|
| 26 |
+
│ Text Embeddings │ RefMod Latent Blocks (1..N) │ Audio Latents │ Video Latents │
|
| 27 |
+
│ (Qwen3-VL-32B) │ (VAE Encoded & Pooled) │ (Audio VAE) │ (Target Output) │
|
| 28 |
+
│ [text_len, 5376] │ [ref_tokens, 5376] │ [audio_t, 5376] │ [video_t, 5376] │
|
| 29 |
+
└───────────────────┴───────────────────────────────┴─────────────────┴──────────────────┘
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
1. **Text Stream**: Generated by the truncated 50-layer Qwen3-VL-32B multimodal text encoder, producing high-dimensional text embeddings tagged with modality markers.
|
| 33 |
+
2. **RefMod Latent Stream**: VAE-encoded visual latents (`[1, 24, T, H, W]`) placed on a 3D Rotary Position Embedding (3D RoPE) spatio-temporal coordinate grid.
|
| 34 |
+
3. **Full Attention Interconnection**: Every single token in the generated video attends to every text token, every audio token, AND every RefMod token across all 50 DiT blocks.
|
| 35 |
+
|
| 36 |
+
### 2.2 RefMod Token Physics
|
| 37 |
+
A RefMod is not a weight modification (unlike a LoRA); it is **pure visual memory** encoded directly into the latent space:
|
| 38 |
+
- **Full Encode Mode**: The reference image or video frames are VAE-encoded at full pixel resolution.
|
| 39 |
+
- **Pooled / Refined Mode**: The latent is average-pooled (e.g. $4 \times 4$ spatial grid) to condense the identity into a compact set of 4–16 tokens per frame, minimizing VRAM and compute overhead while preserving semantic facial geometry.
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## 3. Single-Persona RefMod Stacking (The "LoRA Stacking" Analogy)
|
| 44 |
+
|
| 45 |
+
### 3.1 Why Stack Multiple RefMods of the Same Person?
|
| 46 |
+
Stacking 2 to 3 RefMods of the same persona (e.g. `billieeilish3_v1` @ 1.0, `billieeilish4_v1` @ 1.0, `billieeilish5_v1` @ 0.80) produces dramatically better likeness, structural stability, and LoRA resistance than using a single RefMod.
|
| 47 |
+
|
| 48 |
+
This functions similarly to **LoRA Stacking** (combining multiple LoRAs trained on the same concept with different seeds, datasets, or epochs):
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
Single RefMod (Sample Bias) Triple-RefMod Ensemble (Triangulated Consensus)
|
| 52 |
+
┌───────────────────────────┐ ┌─────────────────────────────────────────────────┐
|
| 53 |
+
│ • Specific lighting bias │ │ RefMod 1 (Frontal / Direct Gaze) @ 1.00 │
|
| 54 |
+
│ • Specific head angle │ VS │ RefMod 2 (3/4 Angle / Expression) @ 1.00 │
|
| 55 |
+
│ • Single focal length │ │ RefMod 3 (Large Centroid / Contour) @ 0.80 │
|
| 56 |
+
│ • Vulnerable to LoRA drift│ │ ───► Invariant Core Triangulation (99.8% Lock) │
|
| 57 |
+
└───────────────────────────┘ └─────────────────────────────────────────────────┘
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### 3.2 The Mathematics of Invariant Triangulation
|
| 61 |
+
Every individual reference photo or dataset crop has idiosyncratic "noise":
|
| 62 |
+
- Specific lighting (warm indoor vs. cool daylight).
|
| 63 |
+
- Micro-expressions or head tilt.
|
| 64 |
+
- Focal length distortion (e.g. 35mm wide vs 85mm portrait).
|
| 65 |
+
|
| 66 |
+
When 3 distinct RefMods of the same persona are placed in the packed token sequence:
|
| 67 |
+
1. **Mathematical Invariance**: The DiT's 56 self-attention heads compute dot-product affinities across all tokens. Features that appear consistently across all 3 references—such as bone structure, eye shape, iris pigmentation, philtrum length, ear morphology, and jawline—receive massive reinforcement.
|
| 68 |
+
2. **Noise Cancellation**: Idiosyncratic lighting artifacts, background clutter, or non-representative angles present in only one RefMod are filtered out as outliers.
|
| 69 |
+
|
| 70 |
+
### 3.3 Token Density & "Gravitational Pull"
|
| 71 |
+
Aggressive concept LoRAs (such as facial cumshots, extreme masturbation, oral sex, speech, or titfucks) exert heavy gradient updates that distort base facial topology.
|
| 72 |
+
|
| 73 |
+
- A single RefMod injects roughly $N$ visual conditioning tokens into the packed sequence.
|
| 74 |
+
- A Triple-RefMod ensemble injects $3N$ visual tokens.
|
| 75 |
+
- This creates a **higher token density ("gravitational well")** in latent space. When the denoiser reconstructs facial pixels, the cumulative attention weight pulling toward the persona's invariant features easily overpowers the LoRA's distorting forces.
|
| 76 |
+
|
| 77 |
+
### 3.4 Why RefMod Strength (e.g. 1.0, 1.0, 0.80) Matters
|
| 78 |
+
In `ComfyUI-MiniMaxH3Mod`, setting a RefMod's strength below `1.0` does **not** inject raw Gaussian noise (which creates static or fabric-like artifacts). Instead, the node uses `_blur_latent()`:
|
| 79 |
+
|
| 80 |
+
$$\mathbf{z}_{\text{effective}} = s \cdot \mathbf{z}_{\text{pristine}} + (1 - s) \cdot \mathbf{z}_{\text{blurred}}$$
|
| 81 |
+
|
| 82 |
+
Where $\mathbf{z}_{\text{blurred}}$ is created by 3D adaptive average pooling down to coarse resolution followed by trilinear upsampling.
|
| 83 |
+
|
| 84 |
+
- **Slot 1 (`1.00`) & Slot 2 (`1.00`)**: Provide sharp, high-frequency facial micro-details (eyelash contours, iris patterns, lip texture, skin pores).
|
| 85 |
+
- **Slot 3 (`0.80`)**: Softens fine-grained rigid textures while preserving broad global geometry (skull volume, jawline contour, hairline boundary). This prevents high-frequency feature clashes between different reference crops while anchoring macro proportions.
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## 4. Multi-Subject Generation & Semantic Routing (`<Subject 1>` & `<Subject 2>`)
|
| 90 |
+
|
| 91 |
+
### 4.1 The Core Question: How Does the Model Know Which RefMod Belongs to Whom?
|
| 92 |
+
When you load 6 RefMods (3 for Subject 1 and 3 for Subject 2) and specify `<Subject 1>` and `<Subject 2>` in your prompt, **there is NO hard-coded indexing or physical wiring connecting RefMod 1–3 to Subject 1**.
|
| 93 |
+
|
| 94 |
+
The model resolves identities entirely through **Multimodal Semantic Cross-Attention Matching**.
|
| 95 |
+
|
| 96 |
+
```
|
| 97 |
+
PROMPT (Qwen3-VL-32B) PACKED VISUAL LATENTS (DiT Sequence)
|
| 98 |
+
┌────────────────────────────────────────┐ ┌────────────────────────────────────────┐
|
| 99 |
+
│ <Subject 1> Billie Eilish: │ │ [RefMod 1]: Billie Eilish 3 (Close-up) │
|
| 100 |
+
│ "soft dark hair with parted bangs, │◄─┼─► [RefMod 2]: Billie Eilish 4 (Frontal) │
|
| 101 |
+
│ striking pale blue-green eyes..." │ │ [RefMod 3]: Billie Eilish 5 (Large) │
|
| 102 |
+
├────────────────────────────────────────┤ ├────────────────────────────────────────┤
|
| 103 |
+
│ <Subject 2> Miley Cyrus: │ │ [RefMod 4]: Miley Cyrus 3 (Wavy Blonde)│
|
| 104 |
+
│ "wavy honey-blonde hair, │◄─┼─► [RefMod 5]: Miley Cyrus 4 (Smile) │
|
| 105 |
+
│ bright blue-grey eyes, arm tattoos..." │ │ [RefMod 6]: Miley Cyrus 5 (Large) │
|
| 106 |
+
└────────────────────────────────────────┘ └────────────────────────────────────────┘
|
| 107 |
+
▲ ▲
|
| 108 |
+
└─────────────────────┬──────────────────────┘
|
| 109 |
+
│
|
| 110 |
+
CROSS-ATTENTION AFFINITY
|
| 111 |
+
(Semantic Query-Key Correlation)
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
### 4.2 The Step-by-Step Resolution Pipeline
|
| 115 |
+
|
| 116 |
+
1. **Text Token Encoding (Qwen3-VL)**:
|
| 117 |
+
The text encoder processes the full prompt:
|
| 118 |
+
```text
|
| 119 |
+
subject_definitions:
|
| 120 |
+
<Subject 1> Billie Eilish (played by Billie Eilish), attractive Caucasian young woman, fair skin, soft facial contours, striking pale blue-green eyes, full lips, natural dark hair with signature parted bangs framing face, oversized streetwear hoodie.
|
| 121 |
+
<Subject 2> Miley Cyrus (played by Miley Cyrus), attractive Caucasian woman, bright expressive blue-grey eyes, radiant smile, wavy honey-blonde hair parted naturally, delicate arm tattoos, black leather jacket.
|
| 122 |
+
|
| 123 |
+
integrated_multimodal_description:
|
| 124 |
+
[Shot 1] Live-action, 35mm cinematic photograph, fine film grain, natural soft studio illumination. Continuous unbroken simultaneous two-shot framing <Subject 1> Billie Eilish on the left seated beside <Subject 2> Miley Cyrus on the right in a shared frame with no camera cuts. The shot opens with <Subject 1> Billie Eilish speaking in her soft intimate vocal timbre: <d>It feels completely effortless to share this space together.</d> while <Subject 2> Miley Cyrus nods with a warm expressive smile.
|
| 125 |
+
```
|
| 126 |
+
Qwen3-VL outputs text embedding vectors where `<Subject 1>` is contextually bound to the semantic tokens *"pale blue-green eyes, dark hair, parted bangs, full lips"*, and `<Subject 2>` is bound to *"wavy honey-blonde hair, blue-grey eyes, radiant smile, arm tattoos"*.
|
| 127 |
+
|
| 128 |
+
2. **Visual Token Injection**:
|
| 129 |
+
The 6 RefMods are placed into the DiT packed sequence at specific temporal cursor positions on the 3D RoPE coordinate grid.
|
| 130 |
+
|
| 131 |
+
3. **Attention Query-Key Dot Product**:
|
| 132 |
+
When the DiT denoises the spatial region corresponding to `<Subject 1>` (e.g. left side of the screen):
|
| 133 |
+
- The query vectors $\mathbf{Q}_{\text{left}}$ carry semantic conditioning from `<Subject 1>`'s text prompt (*dark hair, pale blue-green eyes*).
|
| 134 |
+
- In the attention computation $\text{Softmax}\left(\frac{\mathbf{Q}\mathbf{K}^T}{\sqrt{d}}\right)\mathbf{V}$, the key vectors $\mathbf{K}$ from RefMods 1, 2, and 3 (which contain Billie Eilish visual latents) produce very high dot-product similarity scores.
|
| 135 |
+
- The key vectors from RefMods 4, 5, and 6 (wavy blonde hair, different bone structure) produce low similarity scores and are suppressed by the softmax function.
|
| 136 |
+
|
| 137 |
+
4. **Self-Routing Execution**:
|
| 138 |
+
Because of this high feature affinity, the DiT automatically routes the pixels of RefMods 1–3 into `<Subject 1>`'s physical form on the left, and the pixels of RefMods 4–6 into `<Subject 2>`'s physical form on the right.
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
## 5. Order Invariance & Permutation Behavior
|
| 143 |
+
|
| 144 |
+
### What If We Change the Order of RefMods?
|
| 145 |
+
**RefMod order is invariant.**
|
| 146 |
+
|
| 147 |
+
If you load the RefMods in reverse or mixed order:
|
| 148 |
+
- `Slot 1..3`: Miley Cyrus RefMods
|
| 149 |
+
- `Slot 4..6`: Billie Eilish RefMods
|
| 150 |
+
- Or alternating: `[Billie 1, Miley 1, Billie 2, Miley 2, ...]`
|
| 151 |
+
|
| 152 |
+
**Result**: The video generates **identically**.
|
| 153 |
+
|
| 154 |
+
Why?
|
| 155 |
+
- Inside the DiT, attention is a permutation-equivariant operation across the packed sequence.
|
| 156 |
+
- Because each RefMod occupies its own non-overlapping segment on the RoPE grid, the model computes global attention across all reference tokens simultaneously.
|
| 157 |
+
- The text prompt's semantic features guide the attention heads to retrieve the correct visual tokens regardless of where they sit in the sequence table.
|
| 158 |
+
|
| 159 |
+
---
|
| 160 |
+
|
| 161 |
+
## 6. Complex Scenarios & Edge Cases
|
| 162 |
+
|
| 163 |
+
### 6.1 Asymmetric Stacks (e.g. 3 RefMods for Subject 1 vs. 1–2 RefMods for Subject 2)
|
| 164 |
+
What happens if Subject 1 has 3 RefMods and Subject 2 has only 1 or 2 RefMods?
|
| 165 |
+
|
| 166 |
+
| Aspect | Subject 1 (3 RefMods) | Subject 2 (1–2 RefMods) |
|
| 167 |
+
| :--- | :--- | :--- |
|
| 168 |
+
| **Token Count** | ~48 visual tokens | ~16–32 visual tokens |
|
| 169 |
+
| **Attention Pull** | Very strong "gravitational well" | Moderate "gravitational well" |
|
| 170 |
+
| **Likeness Lock** | Impervious to LoRA distortion | Moderately protected |
|
| 171 |
+
| **Risk Factor** | Minimal | Slight risk of facial drift under heavy LoRAs |
|
| 172 |
+
|
| 173 |
+
- **Outcome**: The generation works cleanly without crashes or crossover.
|
| 174 |
+
- **Best Practice**: If one character is undergoing extreme motion, rapid speech articulation, or heavy LoRA effects (e.g. receiving a facial cumshot or speaking vigorously), assign them 3 RefMods; if the second character is mostly passive/static in the shot, 1–2 RefMods is completely sufficient.
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
### 6.2 The Phenotypic Similarity Problem (Two Similar Personas)
|
| 179 |
+
What happens if `<Subject 1>` and `<Subject 2>` share similar broad features (e.g. both are fair-skinned women with light eyes)?
|
| 180 |
+
|
| 181 |
+
```
|
| 182 |
+
┌────────────────────────────────────────────────────────────────────────┐
|
| 183 |
+
│ THE "IDENTITY BLEED" RISK │
|
| 184 |
+
├────────────────────────────────────────────────────────────────────────┤
|
| 185 |
+
│ If text descriptions are generic ("young woman with light eyes"), │
|
| 186 |
+
│ attention heads cannot differentiate between Subject 1's RefMods and │
|
| 187 |
+
│ Subject 2's RefMods. The model averages their features, producing two │
|
| 188 |
+
│ identical-looking hybrid faces. │
|
| 189 |
+
└────────────────────────────────────────────────────────────────────────┘
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
#### The Golden Disambiguation Rules for Lookalikes:
|
| 193 |
+
To achieve 100% identity separation between similar personas, you MUST provide high-contrast biometric discriminators in the prompt:
|
| 194 |
+
|
| 195 |
+
1. **Hair Length, Color & Style Differentiation**:
|
| 196 |
+
- `<Subject 1>`: *"jet-black hair with soft signature parted bangs framing face"*
|
| 197 |
+
- `<Subject 2>`: *"wavy honey-blonde hair cascading down shoulders in soft layers"*
|
| 198 |
+
2. **Facial Morphology & Features**:
|
| 199 |
+
- `<Subject 1>`: *"soft rounded facial contours, defined natural eyebrows, full plush lips"*
|
| 200 |
+
- `<Subject 2>`: *"high sculpted cheekbones, wide radiant smile, slender nose"*
|
| 201 |
+
3. **Signature Accessories, Markings & Wardrobe**:
|
| 202 |
+
- `<Subject 1>`: *"oversized dark knit streetwear hoodie, silver hoop earring"*
|
| 203 |
+
- `<Subject 2>`: *"fitted leather jacket, delicate illustrative line-art arm tattoos"*
|
| 204 |
+
4. **Explicit Spatial Anchoring**:
|
| 205 |
+
- Specify screen positions in `integrated_multimodal_description`:
|
| 206 |
+
`"<Subject 1> Billie Eilish stands on the screen left... <Subject 2> Miley Cyrus sits on the screen right..."`
|
| 207 |
+
|
| 208 |
+
---
|
| 209 |
+
|
| 210 |
+
### 6.3 Quad-RefMod Ensembles (Persona Identity + Body Shape Boosters)
|
| 211 |
+
A specialized application of stacking is combining **3 Persona RefMods** with **1 Body Shape RefMod** (e.g. `minimaxh3_bodyshape_v1_refmod` or `minimaxh3_bodyshape_athletic_v1_refmod`):
|
| 212 |
+
|
| 213 |
+
- **Slots 1–3**: Persona RefMods @ 1.0, 1.0, 0.80 (Facial & Persona Identity Lock)
|
| 214 |
+
- **Slot 4**: `minimaxh3_bodyshape_v1_refmod` @ 1.0 (Body Proportion & Silhouette Geometry Booster)
|
| 215 |
+
|
| 216 |
+
```
|
| 217 |
+
┌────────────────────────────────────────────────────────────────────────┐
|
| 218 |
+
│ QUAD-REFMOD ATTENTION ROUTING │
|
| 219 |
+
├────────────────────────────────────────────────────────────────────────┤
|
| 220 |
+
│ • Head / Face Queries ──► Attract Slots 1..3 (Persona RefMods) │
|
| 221 |
+
│ • Torso / Body Queries ──► Attract Slot 4 (bodyshape RefMod) │
|
| 222 |
+
└────────────────────────────────────────────────────────────────────────┘
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
Because the prompt describes physique, posture, and full-body contours across the torso and limbs while describing the persona's facial features and hair in the upper frame, the DiT's spatial attention heads route the body shape reference specifically to somatic and postural coordinates without corrupting the persona's distinct facial identity.
|
| 226 |
+
|
| 227 |
+
---
|
| 228 |
+
|
| 229 |
+
### 6.4 Dual Audio Timbre Conditioning (Multi-Subject Spoken & Polyphonic Singing Duets)
|
| 230 |
+
In multi-subject setups, MiniMax-H3 supports independent voice conditioning for each subject by injecting separate audio reference latents into the DiT packed sequence:
|
| 231 |
+
|
| 232 |
+
- **`<Audio 1>` (`billieeilish_talk.mp3` or `sing.mp3`)**: Binds to `<Subject 1>` (Billie Eilish).
|
| 233 |
+
- **`<Audio 2>` (`mileycyrus_talk.mp3` or `sing.mp3`)**: Binds to `<Subject 2>` (Miley Cyrus).
|
| 234 |
+
|
| 235 |
+
```
|
| 236 |
+
┌────────────────────────────────────────────────────────────────────────────────────────┐
|
| 237 |
+
│ DUAL-PERSONA + DUAL-AUDIO SIMULTANEOUS TWO-SHOT │
|
| 238 |
+
├────────────────────────────────────────────────────────────────────────────────────────┤
|
| 239 |
+
│ • <Subject 1> Billie Eilish (RefMods 1..3) ◄──► <Audio 1> (Intimate, breathy timbre) │
|
| 240 |
+
│ • <Subject 2> Miley Cyrus (RefMods 4..6) ◄──► <Audio 2> (Raspy, energetic timbre) │
|
| 241 |
+
│ │
|
| 242 |
+
│ Continuous unbroken shared two-shot: │
|
| 243 |
+
│ - Dialogue: Turn-taking conversational cadence without audio bleeding. │
|
| 244 |
+
│ - Polyphonic Singing: Independent simultaneous melody lines / counterpoint harmony. │
|
| 245 |
+
└────��───────────────────────────────────────────────────────────────────────────────────┘
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
---
|
| 249 |
+
|
| 250 |
+
## 7. Acceleration & Pipeline Architecture Integration
|
| 251 |
+
|
| 252 |
+
RefMod stacking is fully compatible with the modern accelerated generation stack:
|
| 253 |
+
|
| 254 |
+
- **LightX Turbo 8-Step**: `minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors` @ 1.0 (Euler + Simple scheduler, 8 steps, denoise 1.0).
|
| 255 |
+
- **FirstBlockCache (FBC)**: `ApplyMiniMaxH3FirstBlockCache` in mode `H3 Fast — 0.10 / max 2` with `temporal_guard = True`.
|
| 256 |
+
- **SageAttention KJ**: `PathchSageAttentionKJ` (`sage_attention = "auto"`).
|
| 257 |
+
- **Power LoRA Loader**: `Power Lora Loader (rgthree)` stacking the Turbo LoRA alongside action/speech LoRAs (e.g. `3310245` Natural Face & Speech @ 0.52–0.60).
|
| 258 |
+
- **Throughput Benchmark**: Generates 8.0s (192 frames @ `1344x768`) or 6.0s (144 frames @ 0.8 MP `1184x672`) in **~198s to 206s** (~3.3–3.4 minutes) on an RTX 5090 with zero identity degradation across all 6 stacked RefMods.
|
| 259 |
+
|
| 260 |
+
---
|
| 261 |
+
|
| 262 |
+
## 8. Master Configuration & Reference Matrix
|
| 263 |
+
|
| 264 |
+
| Stacking Pattern | Slot Allocation & Strengths | Token Overhead | Primary Use Case |
|
| 265 |
+
| :--- | :--- | :--- | :--- |
|
| 266 |
+
| **Single-Persona Triple Stack** | `mod_1` @ 1.00, `mod_2` @ 1.00, `mod_3` @ 0.80 | Baseline (~48 tokens) | Maximum identity lock against aggressive LoRAs (Tier S Standard). |
|
| 267 |
+
| **Single-Persona Quad Stack** | `mod_1..3` (Persona) @ 1.00/1.00/0.80 + `mod_4` (`bodyshape`) @ 1.00 | Moderate (~64 tokens) | Full-body silhouette / physique scenes with 100% facial retention. |
|
| 268 |
+
| **Dual-Persona Symmetrical** | `mod_1..3` (Subject 1) @ 1.00/1.00/0.80 + `mod_4..6` (Subject 2) @ 1.00/1.00/0.80 | Standard Multi (~96 tokens) | Two-character dialogues, duets, interactions, or shared-frame shots. |
|
| 269 |
+
| **Dual-Persona + Dual Audio** | `mod_1..6` (Dual Persona) + `<Audio 1>` & `<Audio 2>` Voice References | Complete Multi (~112 tokens) | Simultaneous two-shot singing duets, mashups, and conversational banter. |
|
| 270 |
+
| **Dual-Persona Asymmetrical** | `mod_1..3` (Active) @ 1.00/1.00/0.80 + `mod_4..5` (Passive) @ 1.00/0.80 | Lean Multi (~80 tokens) | Primary acting subject + secondary background/supporting character. |
|
| 271 |
+
|
| 272 |
+
---
|
| 273 |
+
|
| 274 |
+
## 9. Summary Checklist for Flawless RefMod Stacking
|
| 275 |
+
|
| 276 |
+
1. **Always use 2–3 distinct RefMod files per character** created from different dataset subsets, centroid crops, or training checkpoints.
|
| 277 |
+
2. **Set the primary RefMods to `1.00` and the tertiary/supplementary RefMod to `0.80`** to balance sharp micro-detail with robust macro geometry.
|
| 278 |
+
3. **Ground distinct biometric constants in `subject_definitions`** for every `<Subject N>` tag (haircut, eye color, facial bone structure, tattoos/piercings, wardrobe).
|
| 279 |
+
4. **Never rely on generic descriptions** when two subjects have similar features—differentiate them explicitly by cut, accessories, attire, and spatial positioning (`screen left` vs `screen right`).
|
| 280 |
+
5. **RefMod slot ordering is invariant**; semantic cross-attention handles token routing based on multimodal prompt feature affinity.
|
| 281 |
+
6. **Combine with Dual Audio References (`<Audio 1>`, `<Audio 2>`)** when generating multi-character dialogue or simultaneous singing duets for independent vocal timbres.
|