Instructions to use yasserrmd/qwen3-4b-agentic-reasoner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yasserrmd/qwen3-4b-agentic-reasoner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yasserrmd/qwen3-4b-agentic-reasoner") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yasserrmd/qwen3-4b-agentic-reasoner") model = AutoModelForCausalLM.from_pretrained("yasserrmd/qwen3-4b-agentic-reasoner") 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
- vLLM
How to use yasserrmd/qwen3-4b-agentic-reasoner with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yasserrmd/qwen3-4b-agentic-reasoner" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/qwen3-4b-agentic-reasoner", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yasserrmd/qwen3-4b-agentic-reasoner
- SGLang
How to use yasserrmd/qwen3-4b-agentic-reasoner 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 "yasserrmd/qwen3-4b-agentic-reasoner" \ --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": "yasserrmd/qwen3-4b-agentic-reasoner", "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 "yasserrmd/qwen3-4b-agentic-reasoner" \ --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": "yasserrmd/qwen3-4b-agentic-reasoner", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yasserrmd/qwen3-4b-agentic-reasoner with Docker Model Runner:
docker model run hf.co/yasserrmd/qwen3-4b-agentic-reasoner
Qwen3-4B-Agentic-Reasoner
yasserrmd/qwen3-4b-agentic-reasoner is a merged model that combines the agentic instruction-following strength of Menlo/Jan-nano with the reasoning and structured thought capabilities of POLARIS-Project/Polaris-4B-Preview, using the Qwen/Qwen3-4B architecture as the base.
This merge was performed using mergekit and the TIES method for fine-grained parameter blending.
🧠 Intended Use
This model is intended for use in:
- Multi-step reasoning tasks
- Agent-style instruction following (CLI assistants, web automation)
- Educational assistance, planning, and explanation
- Natural language code generation, JSON/schema design
- Legal, productivity, and roleplay simulations
🧪 Merge Details
🔀 Merge Method
This model was merged using the TIES merge method with the Qwen/Qwen3-4B as the base model.
🤝 Models Merged
| Model | Role |
|---|---|
| POLARIS-Project/Polaris-4B-Preview | Deep reasoning & CoT |
| Menlo/Jan-nano | Agentic & Instruction-following |
⚙️ Configuration
models:
- model: POLARIS-Project/Polaris-4B-Preview
parameters:
weight: 0.5
- model: Menlo/Jan-nano
parameters:
weight: 0.5
merge_method: ties
base_model: Qwen/Qwen3-4B
parameters:
normalize: true
int8_mask: true
dtype: float16
📊 Prompt Evaluation
This model was evaluated on handcrafted prompts covering:
- Chain-of-thought reasoning
- Math and logic
- Code writing and CLI instructions
- JSON/schema generation
- Role-based planning and writing tasks
- Arabic translation
- Legal drafting
✅ Performance Highlights
| Criterion | Result |
|---|---|
| CoT Reasoning | Excellent (multi-step math, planning) |
| Agentic Tasks | Strong (shell scripts, terminal agents) |
| Code Output | Clean formatting and logical structure |
| Format Awareness | Recognizes JSON, email, legal structure |
| Instruction Follow-through | Reliable and contextual |
| Language Tasks | Accurate Arabic translation, paraphrase |
Average prompt score (0–3 scale): 2.15 All outputs were logical, well-structured, and contextually accurate for the prompt types.
🚀 Inference
To use the model:
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "yasserrmd/qwen3-4b-agentic-reasoner"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto", trust_remote_code=True)
prompt = "Plan the first 3 steps for launching a nonprofit AI education platform."
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))
⚠️ License & Use
Respect the licenses of the original merged models. This model is released for research and personal experimentation purposes.
🙏 Acknowledgments
Thanks to the teams behind:
- Alibaba's Qwen3 series
- Menlo/Jan-nano project
- POLARIS RL framework
- MergeKit by @cg123
Model by @yasserrmd
- Downloads last month
- 6