segKI: registered per-module refresh callbacks for derived-weight caches (follow-up to #8602)
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend, machine-learning
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 43.3k
- Fork
- 5.1k
- Merge medio
- 5g 10h
- PR unite (30g)
- 85
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di deepspeedai/DeepSpeed
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()Forse già presa @its-amann l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
deepspeedai/DeepSpeed#9190 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exceptionForse già presa @bantianyue l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
deepspeedai/DeepSpeed#9183 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
deepspeedai/DeepSpeed#9019 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped foreverForse già presa @damienen l’ha presa 26 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
deepspeedai/DeepSpeed#8982 ·
I maintainer di solito rispondono entro 2 giorni
-
[BUG] OneCycle applies the minimum momentum to the first Adam updateForse già presa @ai-yang l’ha presa 30 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
deepspeedai/DeepSpeed#8951 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di deepspeedai/DeepSpeed
Issue simili
-
area/auth comp/agent P3 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
NousResearch/hermes-agent#161417 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Dao-AILab/flash-attention#3251 ·
I maintainer di solito rispondono entro 2 giorni
-
[New Check]: sqlserver_public_network_access_disabledForse già presa @pouria-l l’ha presa oggi. Apertafeature-request status/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
prowler-cloud/prowler#13607 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
external langchain
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
langchain-ai/docs#8184 ·
I maintainer di solito rispondono entro 1 giorno