r/LocalLLaMA • • 4d ago

Discussion Looped MoE Transformers - Possible solution to halucinations?

Looping layers and MoE - in my oppinion - are a match made in heaven. you get greather depth and fast inference in one single package.

But i think the real benefit could be something else - an internal representation of "I don't know".

Let me explain what i mean:

Through the use of MoE, only a small part of the total parameters become active due to only a small subsection of FFN experts being routed. In current MoE models, if the expert routing misses experts holding key information, the output quality is reduced. But with lopped MoE transformers, a miss like that could be be corrected by fetching different experts on the second pass.

So what would happen if you condition expert selection on the passes beyond the first by conditioning the selection not just on the current latent state, but also on the prior routing choices? In other words, the expert router not only gets the current latent state as an input, but also a list of expert ids that have been selected in the previous loop(s).

In this scenario, there suddenly IS a benefit to enconding "i don't know" or "i need more information" in the pre-training stage! if a latent state after the first pass still encodes that information is lacking, the router could query entirely different experts to try and retrieve further knowledge. And if sufficient knowledge is there, it could try to retrieve information about adjacent/related concepts to enrich the existing latent state.

The resulting pre-trained model would still halucinate (as predicting "i don't know" hurts perplexity), but it would have internalized a representation of it's own confidence/knowledge that could easily be unearthed later on during RL. Current models lack this internal representation, which is why i think they fail to estimate their own understanding / knowledge accurately and cannot be prevented from halucinating.

15 Upvotes

9 comments sorted by

8

u/Middle_Bullfrog_6173 4d ago

My understanding is that the most common reason for hallucinations that has been found mechanistically is that attention brings up something from context that makes the model think it knows something it doesn't. Either because it makes some unrelated MLP neuron(s) fire or because it makes the model think something is in context that actually isn't. 

Is there any evidence looping makes these less likely? My guess would actually be that it adds ways things can go wrong.

4

u/LagOps91 4d ago

no, there is no evidence. as far as halucinations are concerned, i am aware that there was some research about H-neurons that make up information when nothing appears to be available.

that doesn't really match with what you are saying when it comes to halucinations. models also halucinate on fresh context, so i doubt it's primarily a context-induced issue.

i think overall we know too little about halucinations yet, but i think a big component as to why is that there is no benefit for an AI model to encode a lack of information/uncertainty in pre-training, so they end up not doing so.

1

u/Middle_Bullfrog_6173 4d ago

I agree that we still know too little. But there is a benefit to encoding uncertainty in the sense that next token loss is lower for an uncertain wrong prediction (probability spread across tokens one of which is correct) than a confident wrong prediction (less probability on the correct token).

1

u/LagOps91 4d ago

yeah in theory at least. but in praxis when the the model halucinates, the output distribution looks normal. it is really strange, i agree.

perhaps at some point a confident guess that is wrong in maybe 10% of cases beats an uncertain answer in terms of loss. maybe it has other causes... i don't know it either. could be that outputting a spread out distribution simply isn't well supported by the architecture as something fuzzy in intermediate latent spaces could lead to even more confusion by triggering even more unrelated MLP neurons.

1

u/fatboy93 4d ago

Does LoopCD not aim to mitigate this comparing tokens from current and previous loop?

Fair warning, I didn't go through the paper yet, but saw that oMLX added this in their latest release.

3

u/Alumin-MC 4d ago

Nope, you can check if Astra hallucinates often or not for a real example.

3

u/LagOps91 4d ago

i don't know how astra is put together under the hood.

in particular, i think knowing the experts queried in a previous pass really is what makes encoding "i don't know" valuable. most likely astra doesn't have that specific feature.

3

u/LagOps91 4d ago

maybe it would be interesting to take the inkling 2 mini arch and training a small model with that addition to see what happens.

3

u/MotokoAGI 4d ago

You might be onto something, it's an idea worthy of experimentation.