saadys018/marocain-legal-documents-ocr-qwen3-1.0
116
YSLegalOCR-1.0 is a specialized Vision-Language Model (VLM) designed for high-precision Optical Character Recognition (OCR) of Moroccan legal documents. Built to address the specific challenges of administrative digitization, it accurately processes complex legal vocabulary and the unique document layouts utilized across the Kingdom's courts and institutions.
- Model Type: End-to-end Vision-Language Model (VLM).
- Language(s): Arabic (Legal/Standard), French, with native support for Moroccan administrative multilinguism.
- Version: v1.0
- Repository: saadys018/marocain-legal-documents-ocr-qwen3-1.0
📊 Dataset & Training
- Initial Scale: 1,400 high-quality training samples as a first step.
- Synthetic Data Generation: 56% of the dataset was generated synthetically using Mistral OCR to ensure high-quality ground truth for complex layout .
- Key Enhancements:
- 🚀 1,400 training samples as a first step
- 📸 High-fidelity conversion of complex PDFs to optimized 200 DPI images
- ⚖️ Designed for real-world complex Moroccan legal and administrative documents
- 📑 Administrative diversity covering decrees, statistical reports, and official circulars
⚡ Optimization with Unsloth
To achieve high performance on a 4B parameter scale, YSLegalOCR-1.0 was fine-tuned using the Unsloth library. This integration provides several key technical advantages:
- 🚀 Memory Efficiency: Significant reduction in VRAM usage, allowing for more complex document batching during training.
- ⚡ Fast Inference: Optimized kernels that deliver 2x faster token generation compared to standard fine-tuning methods.
- 📉 Optimized Precision: Leveraging 4-bit quantization (bitsandbytes) to maintain legal vocabulary accuracy while keeping the model lightweight.
Intended Use
Primary Use Cases
- ⚖️ Legal Document Digitization: Automated extraction of text and data from Moroccan official decrees and administrative decisions.
- 📊 Data Structuring: Transforming complex statistical reports and government circulars into machine-readable JSON formats.
- 📑 Archive Management: Indexing large-scale administrative archives from the Adala portal with high-fidelity image preprocessing.
- 🏦 Institutional Automation: Improving workflow efficiency for public and private organizations handling official Moroccan paperwork.
- 🔍 Layout & Visual Analysis: Extracting structured information from tables, charts, stamps, and official seals.
Out-of-Scope Use
- 🚫 Automated Legal Verdicts: This system is for data extraction and should not be used for critical legal decision-making without human validation.
- 🚫 Medical Diagnosis: Not intended for highly specialized medical document processing without further domain-specific adaptation.
- 🚫 Real-time Identity Verification: Not designed as a standalone biometric or high-security document authentication system.
Limitations
Due to the compact 4B parameter architecture, the model may encounter the following challenges:
- 📊 Complex Table Parsing: The model can become confused when processing highly condensed or complex tables, leading to alignment errors in the extracted data.
- 🧩 Semantic Hallucinations: In certain contexts, the model may extract irrelevant words or suffer from minor character substitutions (e.g., extracting "ألعاب" instead of the specialized term "أتعاب").
- 📉 Resolution Sensitivity: Performance may degrade on extremely small text or low-contrast scans despite the high-fidelity preprocessing steps.
