Text Generation
Transformers
Safetensors
English
mixtral
Merge
Mixture of Experts
mixture-of-experts
llama-3.2
code
math
creative-writing
conversational
text-generation-inference
Instructions to use Fu01978/Llama-3.2-3B-MoE-4Expert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Fu01978/Llama-3.2-3B-MoE-4Expert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Fu01978/Llama-3.2-3B-MoE-4Expert") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Fu01978/Llama-3.2-3B-MoE-4Expert") model = AutoModelForCausalLM.from_pretrained("Fu01978/Llama-3.2-3B-MoE-4Expert") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Fu01978/Llama-3.2-3B-MoE-4Expert with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Fu01978/Llama-3.2-3B-MoE-4Expert" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Fu01978/Llama-3.2-3B-MoE-4Expert", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Fu01978/Llama-3.2-3B-MoE-4Expert
- SGLang
How to use Fu01978/Llama-3.2-3B-MoE-4Expert with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Fu01978/Llama-3.2-3B-MoE-4Expert" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Fu01978/Llama-3.2-3B-MoE-4Expert", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Fu01978/Llama-3.2-3B-MoE-4Expert" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Fu01978/Llama-3.2-3B-MoE-4Expert", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Fu01978/Llama-3.2-3B-MoE-4Expert with Docker Model Runner:
docker model run hf.co/Fu01978/Llama-3.2-3B-MoE-4Expert
Llama-3.2-3B-MoE-4Expert
A 4-expert Mixture of Experts (MoE) model built on unsloth/Llama-3.2-3B-Instruct, specializing in chat, code, creative writing, and mathematics.
Model Description
This model combines four specialized Llama-3.2-3B variants into a single MoE architecture that intelligently routes queries to the most appropriate expert:
- General Chat & Explanations - Clear, structured responses for everyday queries
- Code & Programming - Python development, algorithms, and optimization
- Creative Writing - Stories, poetry, roleplay, and narrative content
- Mathematics - Equations, proofs, calculus, and step-by-step solutions
Architecture
- Base Model: unsloth/Llama-3.2-3B-Instruct
- Gate Mode: cheap_embed (embedding-based routing)
- Precision: bfloat16
- Merge Method: mergekit-moe
- Total Experts: 4
Expert Models
| Expert | Model | Specialization |
|---|---|---|
| 1 | unsloth/Llama-3.2-3B-Instruct | General chat, summaries, explanations |
| 2 | prithivMLmods/Codepy-Deepthink-3B | Python, algorithms, debugging |
| 3 | DavidAU/Llama-3.2-3B-Instruct-heretic-ablitered-uncensored | Creative writing, fiction, roleplay |
| 4 | prithivMLmods/Llama-3.2-3B-Math-Oct | Mathematics, proofs, calculations |
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "Fu01978/Llama-3.2-3B-MoE-4Expert"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
prompt = "Write a Python function to calculate fibonacci numbers"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Performance
The model has been tested across all four domains and shows appropriate expert routing:
- General knowledge queries route to chat expert
- Programming tasks route to code expert
- Creative prompts route to creative expert
- Mathematical problems route to math expert
Edge cases and ambiguous queries default to the general chat expert.
Limitations
- 3B parameter size means less capable than larger models
- Expert routing depends on prompt phrasing
- May occasionally route to suboptimal expert for ambiguous queries
- Inherits limitations from constituent models
Acknowledgments
Built with mergekit. Thanks to:
- Meta AI for Llama 3.2
- unsloth for the base instruct model
- prithivMLmods for code and math variants
- DavidAU for the creative writing variant
- Downloads last month
- 6
Model tree for Fu01978/Llama-3.2-3B-MoE-4Expert
Merge model
this model