vllm.model_executor.models.transformers.fusers.mla
¶
MLA fuser: adapt a Transformers MLA attention module for vLLM's MLA layer.
Classes:
-
MLAFuser–Fuser for the MLA attention pattern.
MLAFuser
dataclass
¶
Bases: StackedFuser
Fuser for the MLA attention pattern.
Methods:
-
update_forward–Merge
q_a_projandkv_a_projinto one fused down proj then split.
Attributes:
-
shards(list[tuple[str, ShardId]]) –q_a_projandkv_a_proj_with_mqastack into one down-projection.
Source code in vllm/model_executor/models/transformers/fusers/mla.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
shards
property
¶
q_a_proj and kv_a_proj_with_mqa stack into one down-projection.
update_forward(module)
¶
Merge q_a_proj and kv_a_proj into one fused down proj then split.
Bypass the KV expansion method so the compressed latent reaches the vllm_mla
attention interface unexpanded.
Source code in vllm/model_executor/models/transformers/fusers/mla.py
_consumes_placeholder(node)
¶
Whether node is a linear applied directly to a forward input.
Source code in vllm/model_executor/models/transformers/fusers/mla.py
_is_rms_norm(module)
¶
Whether module computes an RMSNorm, verified by RMSNormFuser's matcher.
Source code in vllm/model_executor/models/transformers/fusers/mla.py
_single_expand_call(funcdef, module, kv_b_proj_name)
¶
The KV expansion call self.<method>(kv_c_normed, k_pe): the unique
two-argument call to a method of module with the expansion's signature.
The expansion is kv_c_normed, k_pe -> key, value: two inputs, every
return a pair, and it applies kv_b_proj -- the projection MLAAttention
owns after the bypass, absorbed into the attention computation.
Source code in vllm/model_executor/models/transformers/fusers/mla.py
_top_level_index(funcdef, node)
¶
Index in funcdef.body of the top-level statement containing node.