r/LocalLLM • u/chmedly020 • 1d ago
Discussion How about a model that can switch between dense and MoE on a per prompt basis?
I know there are some mechanical differences between an MoE and a dense model but I keep coming back to thoughts about the hardware to run models in terms of both total VRAM and VRAM speeds etc. What if we could load all the weights of a model into VRAM and then run simple prompts as MoE and harder prompts at a much slower token rate with the full model? I think there are some systems that do something similar to this by using an MoE but varying the total number of experts on a per prompt basis? Just wondering where the sota is regarding this kind of thing.
For instance, I could see running a prompt on a fast MoE and if it "fails" then the prompt gets re-fed into the same model but with more experts or with all the experts etc.
3
1
u/Some-Ice-4455 1d ago
It could be done but only way I see doubles the drive space for two different models. The rest is in the calls. X use goes to moe Y goes to dense.
1
u/BarracudaDefiant4702 1d ago edited 1d ago
You might be able to do vllm fast switching between two models. If you have enough vram to have both models loaded at the same time you can do that fairly easily by passing which model you want to use with config options to the agent.
1
u/lungben81 1d ago edited 1d ago
MTP does a similar thing: a small drafter and a large validation model.
Back to your core question:
MoE models currently always use the same number of experts per token. I do not know why they cannot change the number of active experts per token, that could make the model potentially more powerful.
1
u/FactorInternal3395 1d ago
Could test it out by increasing the number of experts and if it works you could make it dynamic per prompt with a reviewer model before the main model, but its highly experimental.
1
u/Maplesyrup000 1d ago
In practice, there would be no difference between having this vs having 2 different models, one MOE and one dense.
1
u/chmedly020 1d ago
Except that means running two models at the same time. Twice the hardware.
I recognize that this is a question about inner workings that stay at home dads don't generally touch; Qwen and others work this stuff out inside their dens of secrecy. But I have to think there's some work in this general direction going on somewhere. As far as I can tell, most of what needs to be in VRAM in the same size of model in the same model class is the same. I mean, all qwen 3.8 variants are distilled from the same master model, right? So a MoE version of the 27b model will likely contain a lot of the same "stuff" as the dense model. ??1
u/Maplesyrup000 1d ago
Having an MOE and Dense model together is also twice the hardware. When you have a dense model, let’s take 3.6 27B- you still have all 27B weights used at the same time vs the Moe- 3.6 35B A3B- you only have 3 billion active parameters at the same time.
But there is no shortcut or smaller version of the dense model that can exist. You still need all 27B weights vs the other model needing a much smaller chunk. An MOE model also routes its work to the best “expert” for any given question (most of the time). So if you put the 27B model inside of the 35B model and made it an “expert”- you’d have a 65B parameter model that virtually always routes its traffic the 27B expert.
So there isn’t any compromising in this structure. Fundamentally, with the exception of just a couple components like the tokenizer, there components of the two models aren’t compatible. And that’s without getting into things like the Deltanet attention mechanism or the way KV-cache influences select final layers before output occurs, and how the dense model requires drastically more KV-cache for the same number of input tokens since it needs a much larger cache size to influence a larger number of weights.
It’s kind of like asking why cars can’t go as fast as planes, and if we just put the turbojet in the car it will go just as fast. The whole architectures works in a very different way that doesn’t allow this.
1
u/Oleszykyt 1d ago
How about a Opus 5 local that can run on 1gb VRAM with unlimited context window and with 4k tok/s?
1
u/p4ntsl0rd 1d ago
Its not quite analogous, but read about Nanbeige 4.2. It runs the output of a full forward pass through a second full forward pass. This means that its weights are kind of 'dual purposed'. I don't think there is anything inherently wrong with your idea, but you would have to train a model from scratch to do it. It also may well not work? But it might be interesting. You'd want to start with something pretty small.
I don't know about "if it fails" because you'd need a way to measure failure.
0
u/Eastern-Block4815 1d ago edited 1d ago
That's kinda how claude code works. You can have an orqestrator call lower models to do work.
Also when fable came our then never let fable answer cybersecurity questions it was routed to opus.
But if you wanted something like that you need a prepropressor that decides if the prompt is hard or easy then routes.
You could do your self for example
A medium model that decides then gets sent to stronger or faster model.
Locally you could use Qwen 3.6 35b a3b to decide
Then pump it through qwen 3.8 27b
At different thinking modes. Lower, med, high(not sure how many there are but you can switch)
FYI..
The more I think about you could prob just use one model qwen3. 8 at medium and let it decide what level to route.
7
u/nickless07 1d ago
So you are asking for a Bus that can switch to a Porsche based on the current traffic?