🚀 Cohere Labs Command R7B Arabic
Cohere Labs Command R7B Arabic is an open weights research release optimized for Arabic and English, excelling at various enterprise - relevant tasks and demonstrating strong performance on multiple benchmarks.
🚀 Quick Start
You can try out Cohere Labs Command R7B Arabic in our hosted Hugging Face Space before downloading the weights.
Please install transformers from the source repository that includes the necessary changes for this model.
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "CohereLabs/c4ai-command-r7b-arabic-02-2025"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
messages = [{"role": "user", "content": "مرحبا، كيف حالك؟"}]
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
gen_tokens = model.generate(
input_ids,
max_new_tokens=100,
do_sample=True,
temperature=0.3,
)
gen_text = tokenizer.decode(gen_tokens[0])
print(gen_text)
✨ Features
- Task - Oriented Excellence: The model excels at tasks that enterprises care about, such as instruction following, length control, RAG, and responding in the correct language.
- Language Proficiency: Demonstrates excellent general - purpose knowledge and understanding of Arabic language and cultures, and also performs well in English.
- High - Performance Benchmarks: Excels on standardized and externally verifiable Arabic language benchmarks like AlGhafa - Native, Arabic MMLU, and on other well - known benchmarks such as those on the HuggingFace Open LLM Leaderboard.
📦 Installation
Please install transformers from the source repository that includes the necessary changes for this model.
💻 Usage Examples
Basic Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "CohereLabs/c4ai-command-r7b-arabic-02-2025"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
messages = [{"role": "user", "content": "مرحبا، كيف حالك؟"}]
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
gen_tokens = model.generate(
input_ids,
max_new_tokens=100,
do_sample=True,
temperature=0.3,
)
gen_text = tokenizer.decode(gen_tokens[0])
print(gen_text)
Advanced Usage - RAG Example
conversation = [{"role": "user", "content": "اقترح طبقًا يمزج نكهات من عدة دول عربية"}]
documents = [
{"heading": "المطبخ العربي: أطباقنا التقليدية", "body": "يشتهر المطبخ العربي بأطباقه الغنية والنكهات الفريدة. في هذا المقال، سنستكشف ..."},
{"heading": "وصفة اليوم: مقلوبة", "body": "المقلوبة هي طبق فلسطيني تقليدي، يُحضر من الأرز واللحم أو الدجاج والخضروات. في وصفتنا اليوم ..."}
]
input_prompt = tokenizer.apply_chat_template(conversation=conversation,documents=documents, tokenize=False, add_generation_prompt=True, return_tensors="pt")
input_ids = tokenizer.encode_plus(input_prompt, return_tensors="pt")
You can then generate text from this input as usual.
📚 Documentation
Model Details
Property |
Details |
Input |
The model takes text as input only. |
Output |
The model generates text only. |
Model Architecture |
It is an auto - regressive language model using an optimized transformer architecture. After pretraining, it uses supervised fine - tuning (SFT) and preference training. It features three layers with sliding window attention (window size 4096) and ROPE for efficient local context modeling and relative positional encoding, and a fourth layer with global attention without positional embeddings. |
Languages covered |
Trained and evaluated for Arabic and English, with training data including samples from other languages. |
Context length |
Supports a context length of 128,000 tokens. |
Chat Capabilities
Command R7B Arabic can be configured as both a conversational and instruct model based on which preamble is supplied.
- Conversational Mode: Conditions the model on interactive behavior, suitable for chatbots, and can use Markdown and LaTeX where appropriate.
- Instruct Mode: Conditions the model to provide concise yet comprehensive responses, and does not use Markdown / LaTeX by default, designed for non - interactive, task - focused use cases.
Note: Command R7B Arabic is delivered without a system preamble by default. More information can be found in our docs.
Multilingual RAG Capabilities
Cohere Labs Command R7B Arabic has been trained specifically for tasks such as the generation step of Retrieval Augmented Generation (RAG) in Arabic and English. RAG is supported through chat templates in Transformers.
Document snippets should be short chunks (around 100 - 400 words per chunk), formatted as key - value pairs. You may find that simply including relevant documents directly in a user message works just as well or better than using the documents parameter to render the special RAG template.
🔧 Technical Details
This is an auto - regressive language model that uses an optimized transformer architecture. After pretraining, this model uses supervised fine - tuning (SFT) and preference training to align model behavior to human preferences for helpfulness and safety. The model features three layers with sliding window attention (window size 4096) and ROPE for efficient local context modeling and relative positional encoding. A fourth layer uses global attention without positional embeddings, enabling unrestricted token interactions across the entire sequence.
📄 License
The model is under CC - BY - NC and requires also adhering to Cohere Lab's Acceptable Use Policy.
📚 Citation
@misc{alnumay2025command,
title={Command R7B Arabic: A Small, Enterprise Focused, Multilingual, and Culturally Aware Arabic LLM},
author={Yazeed Alnumay and Alexandre Barbet and Anna Bialas and William Darling and Shaan Desai and Joan Devassy and Kyle Duffy and Stephanie Howe and Olivia Lasche and Justin Lee and Anirudh Shrinivason and Jennifer Tracey},
year={2025},
eprint={2503.14603},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
📞 Model Card Contact
For errors or additional questions about details in this model card, contact labs@cohere.com