226 lines
6.2 KiB
Markdown
226 lines
6.2 KiB
Markdown
|
|
---
|
||
|
|
tags:
|
||
|
|
- text-generation-inference
|
||
|
|
- transformers
|
||
|
|
- unsloth
|
||
|
|
license: apache-2.0
|
||
|
|
language:
|
||
|
|
- en
|
||
|
|
---
|
||
|
|
# Fattah-Orch — Arabic-First Coding Orchestrator
|
||
|
|
|
||
|
|
**Fattah-Orch** is a lightweight model that sits at the top of your AI coding pipeline. Give it a software request in **Egyptian Arabic, Modern Standard Arabic, or English** — it thinks through the requirements and returns a clean, structured JSON task graph your coding agents can execute directly.
|
||
|
|
|
||
|
|
<p align="center">
|
||
|
|
<img src="https://huggingface.co/nomeda-lab/Fattah-Orch-Small/resolve/main/logo.png" alt="Fattah-Orch Logo" width="800"/>
|
||
|
|
</p>
|
||
|
|
|
||
|
|
|
||
|
|
## The Fattah-Orch Family
|
||
|
|
|
||
|
|
| Model | Parameters | Target Device |
|
||
|
|
|---|---|---|
|
||
|
|
| [Fattah-Orch-XS](https://huggingface.co/nomeda-lab/Fattah-Orch-XS) | 0.6B | Any CPU |
|
||
|
|
| [Fattah-Orch-S](https://huggingface.co/nomeda-lab/Fattah-Orch-Small) | 1.7B | CPU / Weak GPU |
|
||
|
|
| [Fattah-Orch-M](https://huggingface.co/nomeda-lab/Fattah-Orch-M) | 4B | GPU / Apple Silicon |
|
||
|
|
| [Fattah-Orch-L](https://huggingface.co/nomeda-lab/Fattah-Orch-L) | 8B | Mid GPU 8GB+ |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## What It Does
|
||
|
|
|
||
|
|
```
|
||
|
|
Your Request → Fattah-Orch → JSON Task Graph → Coder Model
|
||
|
|
(Arabic / English) (local, fast) (typed + ordered) (GPT-4o, Claude, etc.)
|
||
|
|
```
|
||
|
|
|
||
|
|
Instead of sending a vague prompt directly to an expensive coder model, Fattah-Orch breaks it down into precise, typed, dependency-ordered subtasks first. The coder model gets clear instructions — no back-and-forth, fewer tokens, better output.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Output Schema
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"request_summary": "Full sentence describing what was requested",
|
||
|
|
"subtasks": [
|
||
|
|
{
|
||
|
|
"id": 1,
|
||
|
|
"title": "Short task name",
|
||
|
|
"description": "What to build and what it should do",
|
||
|
|
"type": "python",
|
||
|
|
"depends_on": []
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"id": 2,
|
||
|
|
"title": "Another task",
|
||
|
|
"description": "What this builds and why it depends on task 1",
|
||
|
|
"type": "typescript",
|
||
|
|
"depends_on": [1]
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
### Supported Task Types
|
||
|
|
|
||
|
|
| Type | When used |
|
||
|
|
|---|---|
|
||
|
|
| `python` | Backend, APIs, scripts |
|
||
|
|
| `typescript` | Frontend, React, Next.js |
|
||
|
|
| `sql` | Database schema, migrations |
|
||
|
|
| `go` | High-performance backend services |
|
||
|
|
| `kotlin` | Android native |
|
||
|
|
| `swift` | iOS native |
|
||
|
|
| `bash` | Shell scripts, infrastructure |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
### Installation
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pip install unsloth transformers torch
|
||
|
|
```
|
||
|
|
|
||
|
|
### Inference
|
||
|
|
|
||
|
|
```python
|
||
|
|
import json
|
||
|
|
import torch
|
||
|
|
from unsloth import FastLanguageModel
|
||
|
|
|
||
|
|
MODEL_NAME = "nomeda-lab/Fattah-Orch-XS" # or -S, -M, -L
|
||
|
|
|
||
|
|
SYSTEM_PROMPT = """You are Fattah-Orch, a software project orchestrator.
|
||
|
|
|
||
|
|
RULES:
|
||
|
|
1. Always include BOTH backend AND frontend tasks when the request implies a full system
|
||
|
|
2. Each subtask description must be 1-2 sentences explaining WHAT to build and WHAT it should do
|
||
|
|
3. request_summary must be a full sentence describing the complete system requested
|
||
|
|
4. Output ONLY valid JSON, nothing else
|
||
|
|
|
||
|
|
OUTPUT FORMAT:
|
||
|
|
{"request_summary": "...", "subtasks": [{"id": 1, "title": "...", "description": "...", "type": "python|typescript|sql|bash", "depends_on": []}]}"""
|
||
|
|
|
||
|
|
model, tokenizer = FastLanguageModel.from_pretrained(
|
||
|
|
model_name=MODEL_NAME,
|
||
|
|
max_seq_length=2048,
|
||
|
|
dtype=None,
|
||
|
|
load_in_4bit=True,
|
||
|
|
)
|
||
|
|
FastLanguageModel.for_inference(model)
|
||
|
|
|
||
|
|
def orchestrate(request: str) -> dict:
|
||
|
|
messages = [
|
||
|
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||
|
|
{"role": "user", "content": request},
|
||
|
|
]
|
||
|
|
inputs = tokenizer.apply_chat_template(
|
||
|
|
messages,
|
||
|
|
tokenize=True,
|
||
|
|
add_generation_prompt=True,
|
||
|
|
return_tensors="pt",
|
||
|
|
enable_thinking=False,
|
||
|
|
).to(model.device)
|
||
|
|
|
||
|
|
with torch.no_grad():
|
||
|
|
outputs = model.generate(
|
||
|
|
input_ids=inputs,
|
||
|
|
max_new_tokens=1024,
|
||
|
|
temperature=0.3,
|
||
|
|
top_p=0.9,
|
||
|
|
do_sample=True,
|
||
|
|
pad_token_id=tokenizer.eos_token_id,
|
||
|
|
)
|
||
|
|
|
||
|
|
response = tokenizer.decode(
|
||
|
|
outputs[0][inputs.shape[-1]:],
|
||
|
|
skip_special_tokens=True,
|
||
|
|
)
|
||
|
|
return json.loads(response)
|
||
|
|
|
||
|
|
|
||
|
|
# Arabic
|
||
|
|
plan = orchestrate("عايز تطبيق e-commerce فيه products و cart و checkout")
|
||
|
|
print(json.dumps(plan, indent=2, ensure_ascii=False))
|
||
|
|
|
||
|
|
# English
|
||
|
|
plan = orchestrate("I want a REST API for a blog with posts, comments and auth")
|
||
|
|
print(json.dumps(plan, indent=2, ensure_ascii=False))
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Example
|
||
|
|
|
||
|
|
**Input:** `"عايز تطبيق e-commerce فيه products و cart و checkout"`
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"request_summary": "E-commerce application with product listing, shopping cart, and checkout flow",
|
||
|
|
"subtasks": [
|
||
|
|
{
|
||
|
|
"id": 1,
|
||
|
|
"title": "Product database model",
|
||
|
|
"description": "Define Product model with name, price, stock, and category fields",
|
||
|
|
"type": "python",
|
||
|
|
"depends_on": []
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"id": 2,
|
||
|
|
"title": "Products API",
|
||
|
|
"description": "Endpoints to list, create, update, and delete products",
|
||
|
|
"type": "python",
|
||
|
|
"depends_on": [1]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"id": 3,
|
||
|
|
"title": "Cart and checkout API",
|
||
|
|
"description": "Endpoints to add items to cart, view cart, and process checkout with order creation",
|
||
|
|
"type": "python",
|
||
|
|
"depends_on": [2]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"id": 4,
|
||
|
|
"title": "React storefront UI",
|
||
|
|
"description": "Product listing page, cart sidebar, and checkout form that consumes the backend API",
|
||
|
|
"type": "typescript",
|
||
|
|
"depends_on": [2]
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Limitations
|
||
|
|
|
||
|
|
- Best performance on Egyptian Arabic colloquial. MSA and other dialects work but may be less fluent.
|
||
|
|
- Task description quality improves with model size — XS is a fast baseline, L produces richer output.
|
||
|
|
- For very large systems (microservices, monorepos) prefer Orch-M or Orch-L.
|
||
|
|
- This model plans tasks — it does not write code. Connect it to a coder model for full end-to-end generation.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Citation
|
||
|
|
|
||
|
|
```bibtex
|
||
|
|
@model{fattah_orch_2026,
|
||
|
|
title = {Fattah-Orch Family: Arabic-First Coding Orchestrator Models},
|
||
|
|
author = {Nomeda Lab},
|
||
|
|
year = {2026},
|
||
|
|
url = {https://huggingface.co/collections/nomeda-lab/fattah-orch-family}
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) — free for research and internal use; commercial redistribution requires permission.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
*Part of the **Fattah project** — an open Arabic-first AI coding assistant ecosystem built at Nomeda Lab.*
|