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