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). forward is 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 RAID stay uppercase, commands such as git and systemd stay lowercase.

License

Apache 2.0, inherited from Qwen3-0.6B.

Downloads last month
23
Safetensors
Model size
0.6B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for nsa01n/qwen3-0.6b-ar-codeswitch

Finetuned
Qwen/Qwen3-0.6B
Finetuned
(1300)
this model