Expert Selector
Honest Deterministic Routing (It's a Hash, Not a Brain)
- expert_0
- expert_1
- expert_2
- expert_3
- selected_model
- expert_index
- routing_rationale
The Expert Selector (class MoERouterNode) promises to pick the right AI model for your task - "expert_0: General, expert_1: Code, expert_2: Domain, expert_3: Math," like a real mixture-of-experts router. Here's what it actually does: it hashes your prompt and maps that hash to one of up to four models you've wired in. Same prompt, same expert, always. It's deterministic, reproducible, and completely without intelligence. Know that going in and it's a legitimately useful little tool.
How the routing works
Feed it a prompt string and at least one model (expert_0 is required; expert_1, expert_2, expert_3 are optional). On run it:
- Hashes the prompt with SHA-256.
- Generates a pseudo-random "affinity score" for each wired expert by hashing
prompt_hash + expert_index. - Picks the highest score, breaking ties deterministically (lowest index wins).
That's the whole mechanism. It's the CSQMF-R1 deterministic routing pattern the README name-drops, minus any actual model reasoning. The scores aren't measuring whether a prompt is about code or math - they're stable hash noise. A math prompt is no more likely to land on expert_3 than on expert_0; you just get the same answer every time for a given prompt.
What the inputs and outputs actually mean
prompt- the string being routed. Its exact text is the entire decision basis.expert_0(required) throughexpert_3(optional) - up to four MODEL wires.- Outputs:
selected_model(MODEL - the winner, wire this into your sampler's model input),expert_index(INT - which one won, useful for a save/rename node or a workflow switch), androuting_rationale(STRING - JSON with the per-expert scores and the prompt hash, so you can see why).
Three gotchas, learned the hard way
A prompt change can flip everything. SHA-256 avalanches - change one character and the hash is completely different, so the selected expert can jump from 0 to 3 on a typo. If you expect "small edits keep the same expert," you'll be confused constantly. It's stable per exact string, not per meaning.
One expert = no routing. Wire only expert_0 (the required one) and it always returns expert_0. The node doesn't complain; it just never routes anywhere. Useful as a pass-through, useless as a demo.
It's not a real MoE. Mixture-of-experts in the ML sense means a model that internally routes tokens to specialized subnetworks - this node is a prompt-hash picker in front of whole separate models. If you came looking for the former, this isn't it.
Install
Part of the comfyui-deterministic-nodes pack, one install for all five nodes. No models, no dependencies beyond torch>=2.0. Via ComfyUI Manager (search comfyui-deterministic-nodes) or:
cd ComfyUI/custom_nodes
git clone https://github.com/joe002/comfyui-deterministic-nodes
Restart ComfyUI; nodes appear under JI/Reproducible.
Where it's actually useful
Reproducible model comparison. Wire four checkpoints in, same prompt, and you get a stable, defensible mapping of "this prompt → that model" that you can compare run over run and share with other people without arguing about which model you "should" have used. It's a deterministic coin flip you can audit - which, honestly, is more than some routers offer. Just don't expect it to understand your prompt.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| expert_0 | MODEL | — | |
| expert_1opt | MODEL | — | |
| expert_2opt | MODEL | — | |
| expert_3opt | MODEL | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| selected_model | MODEL | — |
| expert_index | INT | — |
| routing_rationale | STRING | — |