segKI: registered per-module refresh callbacks for derived-weight caches (follow-up to #8602)
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- backend, machine-learning
Línea de trabajo
Start by reading segki_refresh and the per-path injectors for GDN, attention, GLU, and lm_head, then inspect the backend op’s existing clear_glu_cat_cache handling. Register each injector’s callback on its module and make refresh dispatch registered callbacks plus the backend refresh_weights() hook. Done means the listed paths are registered, the sentinel callback test reaches dispatch, and the existing arena tests pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Motivation
Follow-up to #8602. During review (@tohtana, #issuecomment) we found a bug class: segki_refresh() keeps a centralized, hardcoded list of derived-cache attribute names, while injections are installed distributedly by per-path installers. When a new injection path lands, its refresh entry can be forgotten:
- The GLU-only path (
_ki_dual_opon MLP modules) was missed by the_ki_gdn_op-only backend lookup —clear_glu_cat_cache()was never called for dense models, leaving the process-wide gate|up concat stale after an in-place weight sync (#8602 fixed the symptom ined86967aa; the class remains).
Proposal
Each injector registers its own refresh callback at injection time, on the module it injects into. segki_refresh() becomes a pure dispatcher:
# at injection time — the installer holds exactly this module
def _register_refresh(module, fn):
regs = getattr(module, "_ki_refresh_fns", None)
if regs is None:
regs = module._ki_refresh_fns = []
regs.append(fn)
# segki_refresh: walk the tree, call whatever is registered
def segki_refresh(model):
for m in model.modules():
for fn in getattr(m, "_ki_refresh_fns", ()):
fn(m)
# backend-side caches follow the same contract: op.refresh_weights()
# (clear_glu_cat_cache becomes its alias / implementation)
New injection paths then cannot forget their refresh logic — registration is co-located with cache creation.
Why module-level (not a model-level registry)
- Registration is natural: installers receive the leaf module (
seg.parent); attaching the callback there is one line. A model-level registry would require threading the root reference through every installer. - Lifecycle is automatic: when a module is deleted/replaced (RL rollout rebuilds), its callbacks go with it — no stale entries.
- Zero added cost:
segki_refreshalready traversesmodel.modules(); the traversal stays, only the action changes from attribute deletion to callback dispatch. - Consistent with existing idioms: the
_ki_*attributes already live on modules;clear_glu_cat_cachealready hangs off the backend op (hasattrdiscovery) — this generalizes that pattern to the Python side.
Composing with the end-state handshake
Per the #8602 discussion with @runguo-li, the eventual design is for weight syncs to write derived tensors directly as affine targets (#8575/#8706 fused target maps) — nothing derived, nothing to refresh. The registered-callback framework composes with that: an affine-written target simply registers a no-op. The registry is the robust interim contract, not the end state.
Scope
-
_register_refreshhelper + registration at every existing injector (GDN, attention, GLU, lm_head) -
segki_refreshrewritten as dispatcher (behavior identical; existing arena tests must pass unchanged) - Backend op grows a uniform
refresh_weights()(aliasclear_glu_cat_cache) - Test: an injector registering a sentinel callback proves dispatch reaches it (guards the forgotten-registration class structurally)
- Update the PROVISIONAL docstring on
segki_refresh/HybridEngineRollout.refresh_weights
Found while reviewing #8602.
- Lenguaje dominante
- Python
- Estrellas
- 43.3k
- Forks
- 5.1k
- Merge medio
- 5 d 10 h
- PR fusionados (30 d)
- 85
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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 deepspeedai/DeepSpeed
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()Posiblemente ocupada @its-amann la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
deepspeedai/DeepSpeed#9190 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exceptionPosiblemente ocupada @bantianyue la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepspeedai/DeepSpeed#9183 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
deepspeedai/DeepSpeed#9019 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped foreverPosiblemente ocupada @damienen la tomó hace 26 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
deepspeedai/DeepSpeed#8982 ·
Los mantenedores suelen responder en 2 días
-
[BUG] OneCycle applies the minimum momentum to the first Adam updatePosiblemente ocupada @ai-yang la tomó hace 30 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepspeedai/DeepSpeed#8951 ·
Los mantenedores suelen responder en 2 días
Todos los issues de deepspeedai/DeepSpeed
Issues similares
-
area/auth comp/agent P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
NousResearch/hermes-agent#161417 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Dao-AILab/flash-attention#3251 ·
Los mantenedores suelen responder en 2 días
-
[New Check]: sqlserver_public_network_access_disabledPosiblemente ocupada @pouria-l la tomó hoy. Abiertofeature-request status/needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
prowler-cloud/prowler#13607 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
external langchain
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
langchain-ai/docs#8184 ·
Los mantenedores suelen responder en 1 día