Egyptian Legal Assistant (Llama 3.2 1B)
An Arabic legal assistant fine-tuned on Egyptian legal texts to identify laws and classify legal documents based on their content.
Model Details
- Developed by: ibrahim adel
- Base model: unsloth/llama-3.2-1b-instruct-unsloth-bnb-4bit
- Model type: Instruction-tuned Large Language Model
- Language: Arabic (Egyptian legal domain)
- License: MIT
Overview
This model is fine-tuned to understand Egyptian legal documents and assist with legal document analysis.
Given the text of a legal document or excerpt, the model can:
- Identify the name of the law.
- Classify the document into its legal category.
- Analyze Egyptian legal text in Arabic.
- Answer instruction-style legal questions based on the provided document.
The model was fine-tuned using Unsloth, QLoRA, Hugging Face Transformers, PEFT, and TRL for efficient instruction tuning.
Training Dataset
The model was trained on an Arabic corpus of Egyptian legal documents.
Each training example contains:
- Law Name
- Legal Category
- Full Arabic Legal Text
The instruction tuning process teaches the model to associate legal language with:
- the corresponding law,
- its legal category,
- and the relationship between both.
The dataset contains approximately:
- 2,434 legal documents
- 1,997 unique laws
- 224 legal categories
- 25 million+ Arabic tokens
Example Prompts
Identify the law
1ما اسم القانون الذي ينتمي إليه النص التالي؟
2
3[النص القانوني]
Identify the legal category
1ما التصنيف القانوني لهذا النص؟
2
3[النص القانوني]
Identify both
1اقرأ النص القانوني التالي وحدد:
2
31. اسم القانون
42. التصنيف القانوني
5
6[النص القانوني]
Analyze a legal document
1حلل النص القانوني التالي واستخرج اسم القانون والتصنيف.
2
3[النص القانوني]
Intended Uses
This model is intended for:
- Legal document analysis
- Legal document classification
- Educational purposes
- Legal research assistance
- Retrieval-augmented generation (RAG)
- Building Arabic legal assistants
Limitations
- This model does not provide legal advice.
- Predictions may be inaccurate or incomplete.
- Outputs should always be reviewed by qualified legal professionals before being relied upon.
- Performance is strongest on Egyptian legal texts and may not generalize to other legal systems.
Training
The model was fine-tuned using:
- Unsloth
- QLoRA (4-bit)
- PEFT / LoRA
- Hugging Face Transformers
- TRL SFTTrainer
Citation
If you use this model in your research or applications, please cite the repository or Hugging Face model page.
Acknowledgements
This model was trained using:
- Unsloth
- Hugging Face Transformers
- TRL
- PEFT
Special thanks to the Unsloth team for making efficient LLM fine-tuning accessible.