Skip to content

refactor(zoo): drop privacy-filter's unused CPU-routed MoE path - #71

Merged
chmjkb merged 4 commits into
mainfrom
@chmjkb/remove-legacy-moe-path
Oct 27, 2026
Merged

chmjkb merged 4 commits into
mainfrom
@chmjkb/remove-legacy-moe-path

Conversation

@chmjkb

@chmjkb chmjkb commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

privacy-filter had two MoE paths. The old one read the router logits back to the CPU, picked the top 4 experts per token in JS, grouped tokens by expert and ran one matmul per expert. Nothing has called it since the GPU path (moeUp/moeDown) landed. This PR deletes it and makes the GPU path the only one.

  • Delete routing.ts (routeTop4, groupByExpert, parseTopk) and the old forward, expertMatmul and gateColumnShape in moeMlp.ts.
  • Rename EagerMoeMlp.forwardGather to forward. model.ts calls it.

The code that runs at inference is unchanged, so there is no performance change and no benchmark. Weights are unchanged: no parameter was added, removed or renamed, and stateDictHooks.ts is untouched. The hosted f32, f16 and int8 files load as before.

Prepares the privacy-filter migration in #70: one MoE path to move to the new weight format instead of two.

Introduces a breaking change?

  • Yes
  • No

EagerMoeMlp and routing.ts are privacy-filter internals, not exported from runntime/zoo.

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Performance (kernel tuning, graph building, anything related to performance)
  • Other (chores, tests, code style improvements etc.)

Testing instructions

  1. pnpm typecheck && pnpm lint && pnpm --filter runntime test:unit
  2. pnpm --filter runntime test:gpu: same results as main (1439 passed, 16 failures that also fail on main).

Not checked: the full hosted model end to end in the Redact demo.

Related issues

#70

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

@chmjkb chmjkb added the zoo Task runners and model loaders in src/zoo label Oct 27, 2026
@chmjkb chmjkb self-assigned this Oct 27, 2026
@chmjkb
chmjkb merged commit 6921dd9 into main Oct 27, 2026
2 checks passed
@chmjkb
chmjkb deleted the @chmjkb/remove-legacy-moe-path branch October 27, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zoo Task runners and model loaders in src/zoo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants