← All selected work

Arabic-English QLoRA Fine-tuning

Teaches a compact model how Gulf professionals naturally mix Arabic and English

Four-prompt experiment · 2026
Chart comparing Arabic-English code-switch ratios for the base and fine-tuned Qwen modelsInspect screenshot ↗

The problem

Arabic-speaking professionals often retain English technical terms inside Arabic sentences. This experiment asks whether a compact model can learn that register through lightweight adapter training.

My contribution

Personal project: dataset preparation, adapter training, experiment tracking, and stored base-versus-tuned comparisons.

  • Qwen2.5-3B
  • QLoRA / PEFT
  • MLflow
  • Python

What I built

The approach

A fine-tuning pipeline for Qwen2.5-3B that learns the Arabic-English code-switching used in Gulf workplaces: dataset prep, lightweight adapter training tracked in MLflow, and a base-versus-tuned comparison on the same prompts.

Read the source

Observed behavior change

34.7%fine-tuned ratio
5.1%base-model ratio
653clean examples

Average across four saved prompts. The benchmark counts whitespace-separated words containing at least two consecutive Latin letters. This measures English-term usage, not correctness, fluency, or generalization.

Follow the workflow

Source examples provide the starting point for dataset preparation.

Recorded outputs · no live inference

Same prompt. Two model outputs.

Choose one of the four saved prompts to compare the original model with the fine-tuned version. The text is reproduced as saved, including incomplete endings.

كيف نحسن الـ supply chain efficiency في الـ manufacturing؟

Showing Supply chain. Base: 3.2 percent. Fine-tuned: 46.0 percent.

Base Qwen2.5-3B

3.2% code-switch ratio

تحسين كفاءة الشبكة الصناعية (Supply Chain Efficiency) في الإنتاج يمكن أن يشمل عدة خطوات رئيسية: 1. التحليل العميق للشبكة: تحليل العميق للشبكة يمكن أن يوفر معلومات قيمة حول كيفية عمل الشبكة و哪里 يمكن تحسينها. 2. استخدام البيانات والتحليلات: استخدم البيانات والمعلومات التي تم جمعها من جميع أنحاء الشبكة لتحديد الأماكن التي يمكن فيها تحسين الكفاءة. 3. تطوير التكنولوجيا: الاستثمار في التكنولوجيا الحديثة مثل الذكاء الاصطناعي، والتعلم الآلي، والذكاء المرئي يمكن أن يساعد في تعزيز الكفاءة. 4. تحسين التواصل: ضمان أن جميع أطراف الشبكة تعرف بالضبط ما يتوقع منه وما هو مسؤول عنه. 5. التخطيط الاستراتيجي

Fine-tuned model

46.0% code-switch ratio

هناك عدة طرق يمكن استخدامها لتحسين الـ supply chain efficiency في الـ manufacturing، منها: 1. تحسين الـ inventory management باستخدام الـ ERP systems و الـ CRM systems لزيادة الـ visibility و الـ control على الـ inventory levels و الـ stockouts. 2. تقليل الـ lead times باستخدام الـ Just-In-Time inventory systems و الـ lean manufacturing principles. 3. تحسين الـ transportation efficiency باستخدام الـ GPS tracking systems و الـ transportation optimization tools. 4. تحسين الـ communication بين مختلف الأطراف في الـ supply chain باستخدام الـ enterprise collaboration tools و الـ blockchain technologies. 5. تحسين الـ quality control باستخدام الـ Six Sigma methodologies و الـ ISO standards. 6. تحسين الـ customer satisfaction باستخدام الـ Customer Relationship Management (CRM) و الـ Customer Experience Management (CEM) systems. 7. ت

How to read this comparison

The percentage is the share of whitespace-separated words that contain two or more consecutive Latin letters, using the repository's benchmark rule. Highlighting uses the same rule. More English terms demonstrate a register change; they do not prove a better answer. These four examples are not a held-out quality benchmark.

Inspect the saved source outputs ↗

Inside the project

Saved screenshots from the repository. Select an image to inspect it in detail.

Engineering decisions

01

Use Qwen2.5 as the base model

Its stronger Arabic foundation needs less task-specific data to learn the target style.

02

Train small adapters

QLoRA updates roughly 1% of the model parameters, making training practical on local hardware.

03

Compare the same prompts

Four stored base-versus-fine-tuned outputs make the claimed behaviour change easy to inspect.

Limitations & next steps

Build a held-out set with more domains and human ratings for naturalness, accuracy, and instruction following. Several saved responses end mid-sentence; generation completeness needs evaluation alongside the register change.