Instructions to use nsa01n/qwen3-0.6b-ar-codeswitch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nsa01n/qwen3-0.6b-ar-codeswitch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nsa01n/qwen3-0.6b-ar-codeswitch") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nsa01n/qwen3-0.6b-ar-codeswitch") model = AutoModelForCausalLM.from_pretrained("nsa01n/qwen3-0.6b-ar-codeswitch", 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 nsa01n/qwen3-0.6b-ar-codeswitch with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nsa01n/qwen3-0.6b-ar-codeswitch" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nsa01n/qwen3-0.6b-ar-codeswitch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nsa01n/qwen3-0.6b-ar-codeswitch
- SGLang
How to use nsa01n/qwen3-0.6b-ar-codeswitch 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 "nsa01n/qwen3-0.6b-ar-codeswitch" \ --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": "nsa01n/qwen3-0.6b-ar-codeswitch", "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 "nsa01n/qwen3-0.6b-ar-codeswitch" \ --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": "nsa01n/qwen3-0.6b-ar-codeswitch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nsa01n/qwen3-0.6b-ar-codeswitch with Docker Model Runner:
docker model run hf.co/nsa01n/qwen3-0.6b-ar-codeswitch
Qwen3-0.6B — Arabic/English Code-Switch Normalizer
A 0.6B text normalizer that repairs English technical terms mangled by Arabic speech-to-text. It is not an ASR model and not a chat model — it runs after transcription, as a cleanup pass.
in: الـ query رجع نتائج ناقصة، يمكن الصب نت حاصر بعض الاتصالات
out: الـ query رجع نتائج ناقصة، يمكن الـ subnet حاصر بعض الاتصالات
in: طلع لنا بريكنج تشينج بعد التحديث، ولازم نبلغ الفريق قبل الدمج
out: طلع لنا breaking change بعد التحديث، ولازم نبلغ الفريق قبل الدمج
Scope
Deliberately narrow — a 0.6B model does one job reliably.
Does: restore English terms that ASR transliterated into Arabic script or mis-spelled phonetically.
Does not: translate English into Arabic, convert Arabizi, add diacritics, restructure sentences, or correct Arabic spelling. Arabic text passes through untouched.
Usage
enable_thinking=False is required. Qwen3 renders an empty <think></think> block and
training used that form — a mismatch produces empty output.
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL = "nsa01/qwen3-0.6b-ar-codeswitch"
tok = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(MODEL, dtype="auto")
SYSTEM = (
"You restore English technical terms in Arabic speech-to-text transcripts. "
"Fix only mangled English words. Leave all Arabic text, punctuation, and meaning "
"unchanged. Output only the corrected transcript."
)
def normalize(transcript):
msgs = [{"role": "system", "content": SYSTEM},
{"role": "user", "content": transcript}]
text = tok.apply_chat_template(
msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inp = tok(text, return_tensors="pt").to(model.device)
out = model.generate(**inp, max_new_tokens=512, do_sample=False)
return tok.decode(out[0][inp.input_ids.shape[1]:], skip_special_tokens=True).strip()
Greedy decoding. Sampling adds nothing here and invites drift.
Training
| Base | Qwen/Qwen3-0.6B (596M params, 28 layers) |
| Method | Full supervised fine-tune — not LoRA |
| Precision | bf16 |
| LR / schedule | 1e-5, cosine, 25 warmup steps |
| Epochs | 3 (846 steps, effective batch 32) |
| Max length | 1024 tokens |
| Loss | Completion-only — prompt tokens masked |
| Hardware | 1 x RTX 4090 (24 GB), ~45 min |
Evaluation
Held-out synthetic validation — 20 examples, 27 English terms.
| Metric | Result | Target |
|---|---|---|
| Term Restoration Rate | 88.89% (24/27) | >= 95% |
| Over-edit rate | 0.00% | < 2% |
| Identity pass rate | 100.00% (7/7) | >= 98% |
Over-edit rate and identity pass are the release-critical numbers and both are clean: the model does not alter text it is meant to leave untouched. Its failure mode is omission, not corruption.
Term restoration sits below target, but the sample is small — at 27 terms the 95% confidence interval spans roughly 71-97%, so the figure is not yet statistically distinguishable from the target. Of the three misses, one asked the model to restore a word absent from the input entirely and one had a corrupted source string; a single miss was a genuine vocabulary gap.
Not yet evaluated on real dictation.
Raw output
Term Restoration Rate 88.89% target >= 95 (24/27)
Over-edit rate 0.00% target < 2 <-- RELEASE GATE
Identity pass rate 100.00% target >= 98 (7/7)
The three missed terms
missing: accuracy
in : نحتاج نرفع ونحافظ على Precision قبل ما نعلن النتيجة.
want : نحتاج نرفع accuracy ونحافظ على precision قبل ما نعلن النتيجة.
got : نحتاج نرفع ونحافظ على precision قبل ما نعلن النتيجة.
missing: whisper
in : الوسبر التقط الكلام زين، لكن لخبط بالأسماء الأجنبية شوي.
want : الـ Whisper التقط الكلام زين، لكن لخبط بالأسماء الأجنبية شوي.
got : الـ voice التقط الكلام زين، لكن لخبط بالأسماء الأجنبية شوي.
missing: foreign
in : جانا اتصال (فورًا إن ومصدره مشبوه، اقفله مؤقت لين نفهم السالفة.
want : جانا اتصال foreign ومصدره مشبوه، اقفله مؤقت لين نفهم السالفة.
got : جانا اتصال forward، ومصدره مشبوه، اقفله مؤقت لين نفهم السالفة.
- accuracy — the word is absent from the input; the ASR dropped it. The reference asks the model to invent it, which no model can do. Not a model failure.
- whisper — a genuine miss.
الوسبرclearly encodes Whisper; the model produced a semantic near-guess. A vocabulary gap. - foreign — corrupted source string (note the stray parenthesis).
forwardis a phonetically defensible reading ofفورًا.
Limitations
- Not evaluated on real dictation. Synthetic scores measure whether the model inverts a known corruption function, a weaker claim than fixing genuine ASR output.
- Terms outside the model's learned vocabulary may pass through unrepaired.
- Tuned for the Najdi/Gulf spoken register; other dialects untested.
- Long-form input is out of distribution — built for dictation-length text, <= 1024 tokens.
- Case handling follows convention: acronyms such as
RAIDstay uppercase, commands such asgitandsystemdstay lowercase.
License
Apache 2.0, inherited from Qwen3-0.6B.
- Downloads last month
- 23