vllm.model_executor.layers.mhc ¶
HCHeadOp ¶
Bases: CustomOp
HC head reduction for DeepSeek V4.
Computes gates from the RMS-normalized flattened HC residual and returns out = sum_i gate_i * residual_i, collapsing hc_mult streams to one.
Source code in vllm/model_executor/layers/mhc.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
MHCFusedPostPreOp ¶
Bases: CustomOp
Fused MHC post block followed by the next MHC pre block.
Equivalent to applying MHCPostOp and then MHCPreOp to the updated residual streams, returning residual_cur, post_mix_cur, comb_mix_cur, and layer_input_cur.
Source code in vllm/model_executor/layers/mhc.py
MHCPostOp ¶
Bases: CustomOp
MHC post block.
Combines the layer output with the HC residual streams: out_j = post_layer_mix_j * x + sum_i comb_res_mix_ij * residual_i.
Source code in vllm/model_executor/layers/mhc.py
MHCPreOp ¶
Bases: CustomOp
MHC pre block.
Computes mix logits from RMS-normalized HC residual streams, then returns post_mix, comb_mix, and layer_input = sum_i pre_mix_i * residual_i.