Drop LatentMoE in as a replacement for a standard Mixture of Experts layer in a PyTorch model.
Train a small transformer language model that uses LatentMoE layers on Wikipedia text.
Compare cost and accuracy tradeoffs between the efficiency-focused and accuracy-focused LatentMoE modes.
Inspect the computational cost breakdown of a configured LatentMoE layer.
| kyegomez/latent-moe | 2arons/llm-cli | abe238/claude-video-plus | |
|---|---|---|---|
| Stars | 11 | 11 | 11 |
| Language | Python | Python | Python |
| Setup difficulty | moderate | easy | easy |
| Complexity | 4/5 | 2/5 | 3/5 |
| Audience | researcher | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires PyTorch and, for training, extra dependencies plus a GPU for reasonable speed.
Latent-MoE is a PyTorch implementation of a research paper from NVIDIA about a more efficient way to build Mixture of Experts layers, a technique used inside large AI models where only a subset of specialized sub-networks, called experts, are activated for each piece of input rather than running the whole model every time. This project packages the idea from that paper into a single file that can be dropped in as a replacement for a standard Mixture of Experts layer. The core idea is that a normal Mixture of Experts layer routes tokens and runs its experts using the model's full internal size. LatentMoE instead first shrinks each token down into a smaller working space using a shared projection step, runs all the expert calculations in that smaller space, and then expands the result back up to full size afterward. Because the expensive parts, communication between experts and loading expert weights, now happen in the smaller space, both cost less. Those savings can then be spent on adding more experts, which the paper argues improves the tradeoff between accuracy and computational cost. The project offers two modes: one that keeps the same number of active experts per token to lower cost at equal accuracy, and one that increases active experts per token to raise accuracy at equal cost, which the README recommends as the better tradeoff. You install it with a Python package manager, then import it into existing PyTorch code as a drop-in layer, supplying settings like model dimension, number of experts, and the compression factor. The project also includes a full example of a small transformer language model built around this layer, plus a ready to run training script that trains on a subset of Wikipedia text, complete with command line flags for adjusting model size and training settings and support for resuming from a saved checkpoint. The README asks that anyone using this implementation in research cite both the original paper and this repository. The project is written in Python and released under the Apache License Version 2.0.
A PyTorch implementation of a research technique that makes Mixture of Experts AI model layers cheaper to run.
Mainly Python. The stack also includes Python, PyTorch, CUDA.
You can use, modify, and share this freely, including commercially, as long as you keep required notices and follow the patent terms.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly researcher.
This repo across BitVibe Labs
Verify against the repo before relying on details.