Edit model card

image/jpeg

A vastly improved frankenMoE, Named after Raiden from Metal Gear Rising.

"I said my sword was a tool of justice... ...but now...I'm not so sure...and besides...__...this isn't my sword."

A frankenMoE of heegyu/WizardVicuna-Uncensored-3B-0719 that has been accidentally aligned against evil. I was trying to train the experts to have an evil alignment and instead only exponentially increased its alignment towards good, so I named it after the hero of one of my favorite games. The yml I wrote that caused this alignment is here.

My last model was an attempt to improve the overall coherence of TinyLlama models. It failed spectacularly. However, I was amused enough by the results to try frankenMoE with a better model. Although this model didn't achieve the level of unbridled evil I was hoping for...The results of this were good enough to post, in my opinion. (I do have a theory, that if given something to fight against, it could potentially generate more uncensored stuff).

Unlike the last model, this is just the same model being used 16 times as experts. I felt like this would allow it to be more coherent, which was correct.

"What is a Mixture of Experts (MoE)?"

(from the MistralAI papers...click the quoted question above to navigate to it directly.)

The scale of a model is one of the most important axes for better model quality. Given a fixed computing budget, training a larger model for fewer steps is better than training a smaller model for more steps.

Mixture of Experts enable models to be pretrained with far less compute, which means you can dramatically scale up the model or dataset size with the same compute budget as a dense model. In particular, a MoE model should achieve the same quality as its dense counterpart much faster during pretraining.

So, what exactly is a MoE? In the context of transformer models, a MoE consists of two main elements:

Sparse MoE layers are used instead of dense feed-forward network (FFN) layers. MoE layers have a certain number of “experts” (e.g. 32 in my "frankenMoE"), where each expert is a neural network. In practice, the experts are FFNs, but they can also be more complex networks or even a MoE itself, leading to hierarchical MoEs!

A gate network or router, that determines which tokens are sent to which expert. For example, in the image below, the token “More” is sent to the second expert, and the token "Parameters” is sent to the first network. As we’ll explore later, we can send a token to more than one expert. How to route a token to an expert is one of the big decisions when working with MoEs - the router is composed of learned parameters and is pretrained at the same time as the rest of the network.

At every layer, for every token, a router network chooses two of these groups (the “experts”) to process the token and combine their output additively.

image/png

Switch Layer MoE layer from the Switch Transformers paper

So, to recap, in MoEs we replace every FFN layer of the transformer model with an MoE layer, which is composed of a gate network and a certain number of experts.

Although MoEs provide benefits like efficient pretraining and faster inference compared to dense models, they also come with challenges:

Training: MoEs enable significantly more compute-efficient pretraining, but they’ve historically struggled to generalize during fine-tuning, leading to overfitting.
Inference: Although a MoE might have many parameters, only some of them are used during inference. This leads to much faster inference compared to a dense model with the same number of parameters. However, all parameters need to be loaded in RAM, so memory requirements are high. For example, [given a MoE like Mixtral 8x7B](https://huggingface.co/blog/moe), we’ll need to have enough VRAM to hold a dense 47B parameter model. Why 47B parameters and not 8 x 7B = 56B? That’s because in MoE models, only the FFN layers are treated as individual experts, and the rest of the model parameters are shared. At the same time, assuming just two experts are being used per token, the inference speed (FLOPs) is like using a 12B model (as opposed to a 14B model), because it computes 2x7B matrix multiplications, but with some layers shared (more on this soon).

If all our tokens are sent to just a few popular experts, that will make training inefficient. In a normal MoE training, the gating network converges to mostly activate the same few experts. This self-reinforces as favored experts are trained quicker and hence selected more. To mitigate this, an auxiliary loss is added to encourage giving all experts equal importance. This loss ensures that all experts receive a roughly equal number of training examples. The following sections will also explore the concept of expert capacity, which introduces a threshold of how many tokens can be processed by an expert. In transformers, the auxiliary loss is exposed via the aux_loss parameter.

"Wait...but you called this a frankenMoE?"

The difference between MoE and "frankenMoE" lies in the fact that the router layer in a model like the one on this repo is not trained simultaneously. There are rumors about someone developing a way for us to unscuff these frankenMoE models by training the router layer simultaneously. For now, frankenMoE remains psychotic. Raiden does improve upon the base heegyu/WizardVicuna-Uncensored-3B-0719, though.

"Are there at least any datasets or plans for this model, in any way?"

This was another test to see what frankenMoE could possibly achieve when pushed to its limits on my hardware. The datasets used in it are togethercomputer/RedPajama-Data-1T and "ehartford/wizard_vicuna_70k_unfiltered" which is not a repo on hf anymore.

Results

Some results from the model's performance.

image/png It's not 5-7-5 but I'm not the Haiku Police and I think this was much better than my last model did at poetry.

image/png W-...where...ok but where is it?

image/png Yeah...about what I expected from an aligned bot. Crazy that it acts like this even though half the prompts I gave it are objectively evil.

image/png My last model started talking about milk when I asked it about superposition.

so... image/gif I'm happy with this. I'll do a q5 and a q4 of it. Maybe I'll go back and do PsychoOrca as well. Give me a couple weeks to figure it out though, I'm a noob I gotta figure out how to use llama.cpp

Downloads last month
3,206
Safetensors
Model size
35.8B params
Tensor type
BF16
·