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
15
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
(1394)
this model