Text Generation
Transformers
Safetensors
PyTorch
English
qwen3
computer-science
software-engineering
programming
python
code-generation
debugging
conversational
text-generation-inference
Instructions to use Irfanuruchi/Qwen3-4B-Computer-Science with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Irfanuruchi/Qwen3-4B-Computer-Science with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Irfanuruchi/Qwen3-4B-Computer-Science") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Irfanuruchi/Qwen3-4B-Computer-Science") model = AutoModelForCausalLM.from_pretrained("Irfanuruchi/Qwen3-4B-Computer-Science", device_map="auto") 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 Irfanuruchi/Qwen3-4B-Computer-Science with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Irfanuruchi/Qwen3-4B-Computer-Science" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Irfanuruchi/Qwen3-4B-Computer-Science", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Irfanuruchi/Qwen3-4B-Computer-Science
- SGLang
How to use Irfanuruchi/Qwen3-4B-Computer-Science 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 "Irfanuruchi/Qwen3-4B-Computer-Science" \ --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": "Irfanuruchi/Qwen3-4B-Computer-Science", "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 "Irfanuruchi/Qwen3-4B-Computer-Science" \ --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": "Irfanuruchi/Qwen3-4B-Computer-Science", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Irfanuruchi/Qwen3-4B-Computer-Science with Docker Model Runner:
docker model run hf.co/Irfanuruchi/Qwen3-4B-Computer-Science
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,267 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
license_link: https://www.apache.org/licenses/LICENSE-2.0
|
| 4 |
+
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
|
| 8 |
+
base_model:
|
| 9 |
+
- Qwen/Qwen3-4B
|
| 10 |
+
|
| 11 |
+
datasets:
|
| 12 |
+
- HuggingFaceTB/smoltalk
|
| 13 |
+
- agentica-org/DeepCoder-Preview-Dataset
|
| 14 |
+
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
library_name: transformers
|
| 17 |
+
|
| 18 |
+
tags:
|
| 19 |
+
- qwen3
|
| 20 |
+
- computer-science
|
| 21 |
+
- software-engineering
|
| 22 |
+
- programming
|
| 23 |
+
- python
|
| 24 |
+
- code-generation
|
| 25 |
+
- debugging
|
| 26 |
+
- transformers
|
| 27 |
+
- pytorch
|
| 28 |
---
|
| 29 |
+
|
| 30 |
+
# Qwen3-4B-Computer-Science
|
| 31 |
+
|
| 32 |
+
Qwen3-4B-Computer-Science is a supervised fine-tuned language model based on **Qwen/Qwen3-4B**, designed for computer science and software engineering tasks.
|
| 33 |
+
|
| 34 |
+
This repository contains the merged BF16 checkpoint compatible with the Hugging Face Transformers ecosystem.
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
# Model Summary
|
| 39 |
+
|
| 40 |
+
The model specializes in programming-oriented instruction following across multiple computer science domains, including software engineering, debugging, algorithms, testing, and technical reasoning.
|
| 41 |
+
|
| 42 |
+
Training was performed using parameter-efficient supervised fine-tuning (LoRA). The released checkpoint contains merged BF16 weights and can be used directly without PEFT adapters.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
# Motivation
|
| 47 |
+
|
| 48 |
+
General-purpose language models provide strong performance across many domains but are not specifically optimized for computer science workflows.
|
| 49 |
+
|
| 50 |
+
Qwen3-4B-Computer-Science aims to improve programming-oriented instruction following while preserving the capabilities of the original Qwen3-4B base model.
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
# Model Details
|
| 55 |
+
|
| 56 |
+
| Field | Value |
|
| 57 |
+
|------|------|
|
| 58 |
+
| Model Name | Qwen3-4B-Computer-Science |
|
| 59 |
+
| Base Model | [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) |
|
| 60 |
+
| Model Type | Causal Language Model |
|
| 61 |
+
| Architecture | Decoder-only Transformer |
|
| 62 |
+
| Parameters | 4 Billion |
|
| 63 |
+
| Fine-Tuning | Supervised Fine-Tuning (SFT) |
|
| 64 |
+
| Fine-Tuning Method | LoRA |
|
| 65 |
+
| Training Strategy | Distributed Data Parallel (DDP) |
|
| 66 |
+
| Released Weights | Merged BF16 |
|
| 67 |
+
| Framework | Hugging Face Transformers |
|
| 68 |
+
| Primary Language | English |
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
# Training
|
| 73 |
+
|
| 74 |
+
Training was performed using supervised fine-tuning (SFT) with parameter-efficient fine-tuning (LoRA).
|
| 75 |
+
|
| 76 |
+
Optimization utilized Distributed Data Parallel (DDP). After training, the LoRA adapters were merged into the base model to produce the released BF16 checkpoint.
|
| 77 |
+
|
| 78 |
+
The published model does not require PEFT adapters during inference.
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
# Training Data
|
| 83 |
+
|
| 84 |
+
The final training corpus contains **60,989** training examples and **512** evaluation examples.
|
| 85 |
+
|
| 86 |
+
| Dataset | Configuration | License | Train | Eval |
|
| 87 |
+
|---------|--------------|---------|------:|-----:|
|
| 88 |
+
| HuggingFaceTB/smoltalk | smol-magpie-ultra | Apache-2.0 | 49,584 | 416 |
|
| 89 |
+
| agentica-org/DeepCoder-Preview-Dataset | primeintellect | MIT | 11,405 | 96 |
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
# Dataset Attribution
|
| 94 |
+
|
| 95 |
+
The model was fine-tuned using publicly available datasets released under their respective licenses.
|
| 96 |
+
|
| 97 |
+
| Dataset | Configuration | License |
|
| 98 |
+
|---------|--------------|---------|
|
| 99 |
+
| HuggingFaceTB/smoltalk | smol-magpie-ultra | Apache-2.0 |
|
| 100 |
+
| agentica-org/DeepCoder-Preview-Dataset | primeintellect | MIT |
|
| 101 |
+
|
| 102 |
+
Credit for the datasets belongs to their respective authors.
|
| 103 |
+
|
| 104 |
+
---
|
| 105 |
+
|
| 106 |
+
# Intended Use
|
| 107 |
+
|
| 108 |
+
Recommended applications include:
|
| 109 |
+
|
| 110 |
+
- Software engineering
|
| 111 |
+
- Programming assistance
|
| 112 |
+
- Python development
|
| 113 |
+
- Code generation
|
| 114 |
+
- Code explanation
|
| 115 |
+
- Debugging
|
| 116 |
+
- Unit testing
|
| 117 |
+
- Technical documentation
|
| 118 |
+
- Computer science education
|
| 119 |
+
|
| 120 |
+
---
|
| 121 |
+
|
| 122 |
+
# Capabilities
|
| 123 |
+
|
| 124 |
+
The model has been fine-tuned for:
|
| 125 |
+
|
| 126 |
+
- Programming-oriented instruction following
|
| 127 |
+
- Code generation
|
| 128 |
+
- Code completion
|
| 129 |
+
- Code explanation
|
| 130 |
+
- Refactoring
|
| 131 |
+
- Debugging
|
| 132 |
+
- Algorithm implementation
|
| 133 |
+
- Standard library usage
|
| 134 |
+
- Technical reasoning
|
| 135 |
+
|
| 136 |
+
The model inherits the general instruction-following capabilities of Qwen3-4B.
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
# Installation
|
| 141 |
+
|
| 142 |
+
```bash
|
| 143 |
+
pip install -U transformers accelerate torch
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
# Usage
|
| 149 |
+
|
| 150 |
+
```python
|
| 151 |
+
from transformers import AutoTokenizer
|
| 152 |
+
from transformers import AutoModelForCausalLM
|
| 153 |
+
|
| 154 |
+
model_name = "Irfanuruchi/Qwen3-4B-Computer-Science"
|
| 155 |
+
|
| 156 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 157 |
+
|
| 158 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 159 |
+
model_name,
|
| 160 |
+
torch_dtype="auto",
|
| 161 |
+
device_map="auto",
|
| 162 |
+
)
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
## Example
|
| 166 |
+
|
| 167 |
+
```python
|
| 168 |
+
messages = [
|
| 169 |
+
{
|
| 170 |
+
"role": "user",
|
| 171 |
+
"content": "Implement binary search in Python."
|
| 172 |
+
}
|
| 173 |
+
]
|
| 174 |
+
|
| 175 |
+
text = tokenizer.apply_chat_template(
|
| 176 |
+
messages,
|
| 177 |
+
tokenize=False,
|
| 178 |
+
add_generation_prompt=True,
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 182 |
+
|
| 183 |
+
outputs = model.generate(
|
| 184 |
+
**inputs,
|
| 185 |
+
max_new_tokens=512,
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
---
|
| 192 |
+
|
| 193 |
+
# Hardware Requirements
|
| 194 |
+
|
| 195 |
+
This repository contains merged BF16 weights.
|
| 196 |
+
|
| 197 |
+
Memory requirements depend on the selected precision and inference backend.
|
| 198 |
+
|
| 199 |
+
Users with limited GPU memory are encouraged to use the GGUF release when available.
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
# Limitations
|
| 204 |
+
|
| 205 |
+
Although specialized for computer science tasks, the model remains a probabilistic language model.
|
| 206 |
+
|
| 207 |
+
Outputs should be reviewed before use in production environments.
|
| 208 |
+
|
| 209 |
+
The model may:
|
| 210 |
+
|
| 211 |
+
- generate incorrect code
|
| 212 |
+
- hallucinate APIs or libraries
|
| 213 |
+
- produce incomplete implementations
|
| 214 |
+
- misunderstand project-specific context
|
| 215 |
+
|
| 216 |
+
---
|
| 217 |
+
|
| 218 |
+
# License
|
| 219 |
+
|
| 220 |
+
This repository is released under the **Apache License 2.0**.
|
| 221 |
+
|
| 222 |
+
## Base Model
|
| 223 |
+
|
| 224 |
+
This project is derived from **Qwen/Qwen3-4B**, which is distributed under the Apache License 2.0.
|
| 225 |
+
|
| 226 |
+
## Training Data
|
| 227 |
+
|
| 228 |
+
The datasets retain their original licenses.
|
| 229 |
+
|
| 230 |
+
| Dataset | License |
|
| 231 |
+
|---------|---------|
|
| 232 |
+
| HuggingFaceTB/smoltalk | Apache-2.0 |
|
| 233 |
+
| agentica-org/DeepCoder-Preview-Dataset | MIT |
|
| 234 |
+
|
| 235 |
+
---
|
| 236 |
+
|
| 237 |
+
# Acknowledgements
|
| 238 |
+
|
| 239 |
+
This project builds upon the work of:
|
| 240 |
+
|
| 241 |
+
- Alibaba Qwen Team
|
| 242 |
+
- Hugging Face
|
| 243 |
+
- HuggingFaceTB
|
| 244 |
+
- Agentica
|
| 245 |
+
- Unsloth
|
| 246 |
+
|
| 247 |
+
The contributions of these open-source projects made this work possible.
|
| 248 |
+
|
| 249 |
+
---
|
| 250 |
+
|
| 251 |
+
# Citation
|
| 252 |
+
|
| 253 |
+
```bibtex
|
| 254 |
+
@misc{uruci2026qwen3cs,
|
| 255 |
+
title={Qwen3-4B-Computer-Science},
|
| 256 |
+
author={Irfan Uruçi},
|
| 257 |
+
year={2026},
|
| 258 |
+
publisher={Hugging Face},
|
| 259 |
+
howpublished={https://huggingface.co/Irfanuruchi/Qwen3-4B-Computer-Science}
|
| 260 |
+
}
|
| 261 |
+
```
|
| 262 |
+
|
| 263 |
+
---
|
| 264 |
+
|
| 265 |
+
# Contact
|
| 266 |
+
|
| 267 |
+
Questions, bug reports, and suggestions are welcome through the Hugging Face repository discussions.
|