Text Generation
Transformers
Safetensors
PyTorch
English
mola_lm
mixture-of-experts
lora
adapter
causal-lm
conversational
custom_code
Instructions to use MoLA-LLM/MoLA-v0.7-8x4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MoLA-LLM/MoLA-v0.7-8x4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MoLA-LLM/MoLA-v0.7-8x4b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MoLA-LLM/MoLA-v0.7-8x4b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use MoLA-LLM/MoLA-v0.7-8x4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MoLA-LLM/MoLA-v0.7-8x4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MoLA-LLM/MoLA-v0.7-8x4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MoLA-LLM/MoLA-v0.7-8x4b
- SGLang
How to use MoLA-LLM/MoLA-v0.7-8x4b 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 "MoLA-LLM/MoLA-v0.7-8x4b" \ --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": "MoLA-LLM/MoLA-v0.7-8x4b", "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 "MoLA-LLM/MoLA-v0.7-8x4b" \ --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": "MoLA-LLM/MoLA-v0.7-8x4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MoLA-LLM/MoLA-v0.7-8x4b with Docker Model Runner:
docker model run hf.co/MoLA-LLM/MoLA-v0.7-8x4b
MoLA-LM: Mixture of LoRA Adapters LLM
MoLA-LM combines multiple LoRA adapters with an intelligent router to automatically select the best adapter for each input prompt. This approach enables specialized performance across different tasks while maintaining efficiency.
Model Details
- Model Type: Mixture of LoRA Adapters Language Model
- Base Model: Qwen/Qwen3-4B-Instruct-2507
- Total Adapters: 8
- Architecture: Custom MoLAForCausalLM with automatic adapter routing
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model (trust_remote_code=True is required for custom architecture)
model = AutoModelForCausalLM.from_pretrained(
"MoLA-LLM/MoLA-v0.7-8x4b",
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("MoLA-LLM/MoLA-v0.7-8x4b", trust_remote_code=True)
# Use like any other language model - adapter selection is automatic
prompt = "Write a Python function to calculate fibonacci numbers"
messages = [{"role": "user", "content": prompt}]
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=8192, temperature=.6, do_sample=True)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(f"Selected LoRA: {model.get_current_lora()}")
print(response)
You can also use load_in_4bit and load_in_8bit directly when loading!
Architecture
The MoLA-LM architecture consists of:
- Base Model: Qwen/Qwen3-4B-Instruct-2507
- Router Network: Frozen encoder as Sentence transformer + decoder as MLP for adapter selection
- LoRA Adapters: 8 task-specific fine-tuned adapters
- Dynamic Switching: Automatic adapter application based on input
Paper coming soon™
- Downloads last month
- 89
