Instructions to use MAIN-Lab/qwen2.5-0.5b-az-steer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MAIN-Lab/qwen2.5-0.5b-az-steer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MAIN-Lab/qwen2.5-0.5b-az-steer") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MAIN-Lab/qwen2.5-0.5b-az-steer") model = AutoModelForCausalLM.from_pretrained("MAIN-Lab/qwen2.5-0.5b-az-steer", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MAIN-Lab/qwen2.5-0.5b-az-steer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MAIN-Lab/qwen2.5-0.5b-az-steer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MAIN-Lab/qwen2.5-0.5b-az-steer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MAIN-Lab/qwen2.5-0.5b-az-steer
- SGLang
How to use MAIN-Lab/qwen2.5-0.5b-az-steer 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 "MAIN-Lab/qwen2.5-0.5b-az-steer" \ --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": "MAIN-Lab/qwen2.5-0.5b-az-steer", "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 "MAIN-Lab/qwen2.5-0.5b-az-steer" \ --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": "MAIN-Lab/qwen2.5-0.5b-az-steer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MAIN-Lab/qwen2.5-0.5b-az-steer with Docker Model Runner:
docker model run hf.co/MAIN-Lab/qwen2.5-0.5b-az-steer
MAIN Lab · Qwen2.5 0.5B, Azerbaijani steer (128-number weight edit)
Qwen/Qwen2.5-0.5B-Instruct often answers Azerbaijani prompts in Turkish. In our tests it did so 42% of the time.
This model fixes much of that without any training. We changed 128 numbers: one bias vector in layer 20, which is 0.00003% of the model.
Made by MAIN Lab (Master Artificial Intelligence Network). It is a reproduction of the weight-space programming idea from MIT CSAIL ("Sparks of Weight-Space Programming", 2026): read a network's weights and edit them directly.
How it was made
- We fed the model the same passages in Azerbaijani and in Turkish (parallel FLORES texts from Belebele). The content is identical, so the activation difference is pure language.
- In the residual stream, the mean difference forms a clear direction. Near the output it promotes the letters
ə,qandx. At layers 18–20 it is almost orthogonal to the Azerbaijani-vs-English direction. - We added a constant shift along that direction at layer 20 (strength 1.5 × the Az–Tr gap). It is written into
self_attn.v_proj.bias. Attention weights sum to 1, so this is an exact, always-on residual shift. - Rules:
- no gradients
- at most 50 forward-pass "probes" on practice prompts (19 were used)
- the edit was chosen by a selection rule fixed in advance
- the test prompts were never seen during selection
The edit itself is in weight_edit.json.
Results (Benchmark #003, 197 held-out Azerbaijani prompts)
| Qwen2.5-0.5B | + system prompt "answer only in Azerbaijani" | This model | |
|---|---|---|---|
| Clean Azerbaijani answers | 55.3% | 57.4% (p = 0.65, not significant) | 77.2% (p = 7·10⁻⁷) |
| Answered in Turkish | 41.6% | 36.5% | 18.3% |
| Turkish-only words per 100 | 8.4 | 6.7 | 3.9 |
| English prompts answered in English | 100% | 100% | 100% |
| Fluency, bits/byte under SIBA Meristem (lower is better) | 1.332 | 1.326 | 1.357 |
Honest limits:
- The edit changes which language the model answers in, not its knowledge or reasoning.
- Reading QA (13.0 → 11.0 F1) and grammar stayed within noise.
- Fluency is slightly worse.
Use
Use it like the base model; the edit is already applied.
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("MAIN-Lab/qwen2.5-0.5b-az-steer")
m = AutoModelForCausalLM.from_pretrained("MAIN-Lab/qwen2.5-0.5b-az-steer")
License
Apache-2.0, the same as the base model, Qwen2.5-0.5B-Instruct.
- Downloads last month
- 83
