Instructions to use beyoru/Evol-Aes-Hybrid-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use beyoru/Evol-Aes-Hybrid-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="beyoru/Evol-Aes-Hybrid-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("beyoru/Evol-Aes-Hybrid-4B") model = AutoModelForCausalLM.from_pretrained("beyoru/Evol-Aes-Hybrid-4B") 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 beyoru/Evol-Aes-Hybrid-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "beyoru/Evol-Aes-Hybrid-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beyoru/Evol-Aes-Hybrid-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/beyoru/Evol-Aes-Hybrid-4B
- SGLang
How to use beyoru/Evol-Aes-Hybrid-4B 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 "beyoru/Evol-Aes-Hybrid-4B" \ --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": "beyoru/Evol-Aes-Hybrid-4B", "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 "beyoru/Evol-Aes-Hybrid-4B" \ --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": "beyoru/Evol-Aes-Hybrid-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use beyoru/Evol-Aes-Hybrid-4B with Docker Model Runner:
docker model run hf.co/beyoru/Evol-Aes-Hybrid-4B
🧬 Evol-Aes-Hybrid-4B: Evolutionary Optimized Merge
📖 Overview
Evol-Aes-Hybrid-4B is a high-performance 4B parameter model created using an advanced Evolutionary Layer-Wise Merge strategy. By combining the generalist capabilities of Instruct with the logical prowess of Thinking models, this hybrid achieves a superior balance between conversational fluency and reasoning depth.
This model is designed to be a robust starting point for SFT (Supervised Fine-Tuning) or GRPO training, offering a stabilized foundation that outperforms standard merges.
🧩 Base Models
This model is a genetic evolution of the following parents:
- Base (Generalist): Qwen/Qwen3-4B-Instruct-2507
- Source (Specialist): Qwen/Qwen3-4B-Thinking-2507
💡 Design Philosophy: Pure thinking models often over-reason on simple tasks, while instruct models may lack depth. This hybrid applies a "genetic selection" to retain the best layers from both worlds.
⚙️ Evolutionary Methodology
Unlike traditional linear merges (SLERP/TIES), this model was optimized using a Genetic Algorithm (GA) to find the perfect weight ratio for each individual layer.
🔬 Experiment Settings
- Optimization Target: Minimized metrics on the
openai/gsm8kdataset. - Evaluation Subset: 100 challenging samples.
- Population Size: 10 candidates per generation.
- Generations: 30 evolution cycles.
- Algorithm: Layer-wise weighted averaging with mutation and crossover (Elitism strategy).
🧬 Layer Composition Analysis
The evolutionary process discovered a non-linear structure:
- Early Layers (0-5): Heavily favors the Instruct Base (~65%) to maintain robust language understanding and grammar.
- Middle Layers: Incorporates Thinking modules for logic processing.
- Specific Heads: Selectively rejected unstable layers from the Thinking model (e.g., layers with high Alpha metrics) to ensure stability.
📊 Evaluation & Performance
| Rank | Model | Overall Score |
|---|---|---|
| 1 | Evol-Aes-Hybrid-4B | 0.699 |
| 2 | EvoLLM | 0.663 |
| 3 | Qwen3-2507 (Base) | 0.639 |
| 4 | Darwin-Qwen3-4B | 0.610 |
💻 Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "beyoru/Evol-Aes-Hybrid-4B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Solve 2x+1=3 !!!"},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
input_ids,
max_new_tokens=512,
)
print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
🤗 Support me at:
📜 Citation
If you use this model or the evolutionary merge method in your work, please cite:
@misc{nafy_qwen_merge_2025,
title = {EvolLLM: Evolutionary Optimized Qwen3 Hybrid},
author = {Beyoru},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{[https://huggingface.co/beyoru/Evol-Aes-Hybrid-4B](https://huggingface.co/beyoru/Evol-Aes-Hybrid-4B)}},
note = {Merged model combining instruction-tuned and reasoning Qwen3 variants via Genetic Algorithm.},
base_models = {Qwen/Qwen3-4B-Instruct-2507, Qwen/Qwen3-4B-Thinking-2507}
}
- Downloads last month
- 2