vllm.model_executor.models.iquest_loopcoder ¶
Inference-only LoopCoder model compatible with HuggingFace weights.
LoopGateProjection ¶
Bases: Module
Gate projection for mixed attention in Loop 2+.
Computes: g = sigmoid(linear(Q)) for each head independently. This gate determines how much to use Loop1's KV (global) vs current loop's KV (local).
Supports tensor parallelism: each GPU handles a subset of heads. The weight matrix has shape [num_heads, head_dim] and is split along the head dimension.
Source code in vllm/model_executor/models/iquest_loopcoder.py
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 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
forward ¶
Compute gate values from query tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | Tensor | [num_heads, num_tokens, head_dim] (vLLM flattened format) where num_heads is the number of heads on this TP rank and num_tokens = batch * seq_len | required |
Returns:
| Name | Type | Description |
|---|---|---|
gate | Tensor | [num_tokens, num_heads * head_dim] (flattened format matching q shape) |