perf(moe): prefetch the next layer's experts from a router lookahead during offloaded decode
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 18/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- ai, performance
Línea de trabajo
Start from the offloaded decode path behind --moe-strategy offload and the expert slot-map ensure logic, then read the linked fork commits and PR #74 to see the proposed router lookahead and prefetch install. Any change must keep every slot-map write on the compute stream, so review the race tests before anything else. Done means the FREETOKEN_MOE_PREFETCH=on path gives token-identical greedy output on cold prompts with the slot-map audit enabled.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
In offloaded decode (--moe-strategy offload, decode on the GPU), each layer's expert misses are copied over PCIe only after that layer's router has run, so the copy sits on the critical path. On an RTX 5080 (16 GB, PCIe) serving Qwen3.8-Flash-Next-NVFP4, the expert H2D copies are about half of each decode step.
Proposal: predict layer L's experts one layer early and copy them while layer L-1 computes.
- Lookahead: run layer L's router on layer L-1's router input (the residual stream changes little between adjacent layers). Run it on a side stream forked at the start of L-1's MoE block.
- Install: right after L-1's own ensure, install up to N predicted, non-resident experts as low-priority slots: held, usage 0, first to be evicted. Copy them on a dedicated high-priority stream behind L-1's demand copy. L's demand copy then waits on that stream.
- Correctness constraint: every slot-map writer (demand ensure and prefetch install) must stay on the compute stream. Only reads and byte copies may cross streams. A first version that installed from the predictor stream behind an event join corrupted 1–6 of 60 cold greedy prompts. Two writers racing on the slot map was enough, even though an nsys trace showed no ordering violation.
Measured (Qwen3.8-Flash-Next-NVFP4, scored eviction with the shared-expert overlap as the baseline, N = 4):
| baseline | with prefetch | |
|---|---|---|
| decode, 32K context | 43.4 tok/s | 53.0 tok/s (+22%) |
| decode, 255K context | 43.0 tok/s | 50.8 tok/s |
| demand misses per token | 206 | 111 |
| VRAM | +148 MiB |
The output is lossless: greedy outputs were token-identical on 420 cold nonce prompts, with a slot-map audit enabled.
Implementation (on my fork, against an older main):
- 8c171b6: router lookahead (layer L's router on layer L-1's input).
- 47d4811: prefetch into low-priority slots behind
FREETOKEN_MOE_PREFETCH=on. - 3a0ff77: install prefetches on the compute stream, so the slot map has a single writer.
- The full series, including the race tests and the slot-audit/verify debug modes: https://github.com/gdevenyi/FreeToken/pull/74
- Lenguaje dominante
- Python
- Estrellas
- 14.2k
- Forks
- 1.4k
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 107
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de FlashML-org/FreeToken
-
Desktop feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
FlashML-org/FreeToken#800 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
/v1/completions: `prompt: []` returns 200 with no choices, and both completions paths drop the error code (context_length_exceeded)Posiblemente ocupada @techsaurabh-394 la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
FlashML-org/FreeToken#767 ·
Los mantenedores suelen responder en 1 día
-
test_gemv_path_matches_the_transcription fails on sm_120 (bf16 rounding tie exceeds the tolerance)Posiblemente ocupada @void-mckenzie la tomó hace 22 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
FlashML-org/FreeToken#649 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FlashML-org/FreeToken#648 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
FlashML-org/FreeToken#646 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de FlashML-org/FreeToken
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
area:docs documentation effort:M ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
mczielinski/ob-analytics#423 ·
Los mantenedores suelen responder en 1 día
-
infra
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
vllm-project/vllm-ascend#21033 ·
Los mantenedores suelen responder en 1 día