PEFT
Safetensors
Russian
qwen2
legal
contract-extraction
information-extraction
json-generation
lora
qwen
russian
enterprise
Instructions to use zieglerd/RussianConcsExt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use zieglerd/RussianConcsExt with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-32B-Instruct") model = PeftModel.from_pretrained(base_model, "zieglerd/RussianConcsExt") - Notebooks
- Google Colab
- Kaggle
| base_model: Qwen/Qwen2.5-14B-Instruct | |
| library_name: peft | |
| license: apache-2.0 | |
| language: | |
| - ru | |
| tags: | |
| - legal | |
| - contract-extraction | |
| - information-extraction | |
| - json-generation | |
| - peft | |
| - lora | |
| - qwen | |
| - russian | |
| - enterprise | |
| # Russian Contract Extraction LoRA | |
| ## Model Details | |
| ### Model Description | |
| Russian Contract Extraction LoRA is a domain-specific LoRA adapter for extracting structured information from Russian-language procurement and corporate contracts. | |
| The adapter is fine-tuned on top of **Qwen2.5-14B-Instruct** and is designed to convert free-form contract text into a structured JSON representation suitable for downstream processing in enterprise document management systems, ERP platforms, procurement systems, and legal automation pipelines. | |
| Unlike generic information extraction models, this adapter focuses on complex real-world Russian contracts, including framework agreements, contracts without fixed amounts, contracts with indirect subject descriptions, advance payment schemes, and various VAT configurations. | |
| - **Developed by:** Dmitry Ziegler (Lead), Denis Karpov (MLOps), Andrey Tolstov (jun. MLOps) | |
| - **Model type:** LoRA Adapter | |
| - **Language(s):** Russian | |
| - **License:** Apache-2.0 (inherits base model license) | |
| - **Finetuned from model:** Qwen/Qwen2.5-14B-Instruct | |
| --- | |
| ## Uses | |
| ### Direct Use | |
| The adapter is intended for automated extraction of structured information from Russian contracts. | |
| **The current version is optimized for contracts with a single supplier. Support for multi-supplier and multi-party agreements has not been evaluated and may require additional fine-tuning.** | |
| Input: | |
| - free-form Russian contract text; | |
| - OCR output; | |
| - document text with appendices; | |
| - specifications; | |
| - procurement documentation. | |
| Output: | |
| Structured JSON describing: | |
| - contract subject; | |
| - contract amount; | |
| - VAT information; | |
| - payment schedule; | |
| - advance payments; | |
| - specification items; | |
| - financial conditions. | |
| ### Downstream Use | |
| The model can be integrated into: | |
| - ERP systems; | |
| - document management systems; | |
| - procurement automation; | |
| - legal document processing; | |
| - enterprise AI assistants; | |
| - contract analytics platforms. | |
| ### Out-of-Scope Use | |
| The model is **not** intended to: | |
| - provide legal advice; | |
| - interpret legislation; | |
| - replace professional legal review; | |
| - validate legal compliance. | |
| --- | |
| ## Bias, Risks and Limitations | |
| The model is intended exclusively for information extraction. | |
| Performance depends on: | |
| - OCR quality; | |
| - document formatting; | |
| - contract complexity; | |
| - ambiguity of legal language. | |
| Users should validate extracted information before using it in legal or financial processes. | |
| --- | |
| ## Training Procedure | |
| The adapter was trained using supervised instruction tuning (SFT). | |
| Input consists of free-form Russian procurement contract text. | |
| Output consists of structured JSON following a fixed extraction schema. | |
| The model was optimized to preserve factual correctness and return `null` whenever required information is absent instead of hallucinating unsupported values. | |
| --- | |
| ## Training Configuration | |
| | Parameter | Value | | |
| |-----------|-------| | |
| | Base model | Qwen/Qwen2.5-14B-Instruct | | |
| | Training method | Supervised Fine-Tuning (SFT) | | |
| | Adapter type | LoRA | | |
| | LoRA rank | 32 | | |
| | LoRA alpha | 64 | | |
| | LoRA dropout | 0.03 | | |
| | Trainable modules | `q_proj`, `k_proj`, `v_proj`, `o_proj`, `up_proj`, `down_proj`, `gate_proj` | | |
| | Training file | `merged_train.jsonl` | | |
| | Validation file | `merged_val.jsonl` | | |
| | Model suffix | `SWAGA_LLM` | | |
| | Epochs | 3 | | |
| | Batch size | 8 | | |
| | Gradient accumulation | 1 | | |
| | Effective batch size | 8 | | |
| | Sequence packing | Enabled | | |
| | Maximum sequence length | 32768 | | |
| | Learning rate | 2e-5 | | |
| | Warmup ratio | 0.03 | | |
| | Weight decay | 0 | | |
| | Max gradient norm | 1.0 | | |
| | LR scheduler | Cosine | | |
| | Minimum LR ratio | 0 | | |
| | Scheduler cycles | 0.5 | | |
| | Checkpoints saved | 5 | | |
| | Evaluation runs | 6 | | |
| | Train on inputs | False | | |
| --- | |
| ## Benchmark | |
| The model was evaluated on an internal validation set containing Russian enterprise procurement contracts that were not used during training. | |
| Evaluation focused on structured information extraction rather than natural language generation. | |
| The benchmark includes contracts with: | |
| - framework agreements; | |
| - contracts without fixed total amounts; | |
| - contracts with multiple payment stages; | |
| - contracts containing specifications; | |
| - contracts with multiple VAT rates; | |
| - advance payment contracts; | |
| - contracts with complex financial conditions; | |
| - contracts containing incomplete or ambiguous information. | |
| | Field Accuracy | 96.2% | | |
| | Field | Accuracy | | |
| |-------|----------:| | |
| | Contract number | 99.8% | | |
| | Contract date | 99.3% | | |
| | Supplier | 98.7% | | |
| | Customer | 98.5% | | |
| | Subject | 96.1% | | |
| | Contract amount | 95.6% | | |
| | VAT | 98.9% | | |
| | Payment terms | 91.8% | | |
| | Validity period | 94.2% | | |
| ### Evaluation criteria | |
| The following aspects were manually verified: | |
| - correct extraction of contract metadata; | |
| - supplier and customer identification; | |
| - subject extraction; | |
| - total contract amount extraction; | |
| - VAT identification; | |
| - payment schedule extraction; | |
| - contract validity dates; | |
| - preservation of missing values using `null`; | |
| - JSON schema validity; | |
| - absence of hallucinated values. | |
| The model was optimized for high factual precision and schema consistency on long Russian legal documents (up to 32k tokens). | |
| ## Evaluation | |
| ### Benchmark | |
| Russian Purchase Contracts Benchmark | |
| ### Metric | |
| Extraction Accuracy | |
| ### Results | |
| | Model | Accuracy | | |
| |--------|----------| | |
| | Qwen2.5-14B-Instruct | ~85% | | |
| The benchmark evaluates extraction of structured information from Russian procurement contracts. | |
| --- | |
| ## Example | |
| ### Input | |
| ```text | |
| ДОГОВОР ПОСТАВКИ №458/26 | |
| ООО "Поставщик" обязуется поставить ООО "Заказчик" | |
| общехозяйственные товары согласно спецификации. | |
| Стоимость договора составляет | |
| 34 132 686,08 рублей, | |
| в том числе НДС 5%. | |
| Оплата производится следующим образом: | |
| 85% — авансовый платеж. | |
| 15% — после поставки товара. | |
| ``` | |
| ### Output | |
| ```json | |
| { | |
| "document_object": "Общехозяйственные товары", | |
| "total_amount": { | |
| "total": { | |
| "amount_value": 34132686.08, | |
| "vat_rate": 5, | |
| "include_vat": true | |
| } | |
| }, | |
| "advance_payments": [ | |
| { | |
| "percent": 85 | |
| }, | |
| { | |
| "percent": 15 | |
| } | |
| ] | |
| } | |
| ``` | |
| --- | |
| ## Features | |
| The adapter supports extraction of: | |
| - contract subject; | |
| - contract amount; | |
| - VAT amount and rate; | |
| - VAT inclusion; | |
| - payment schedule; | |
| - advance payments; | |
| - post-payment terms; | |
| - specification tables; | |
| - product positions; | |
| - quantities; | |
| - unit prices; | |
| - total prices. | |
| Special attention was given to difficult enterprise scenarios: | |
| - framework agreements; | |
| - contracts without a fixed subject; | |
| - contracts without a fixed total amount; | |
| - multiple specifications; | |
| - multiple VAT rates; | |
| - complex payment schedules. | |
| --- | |
| ## Technical Specifications | |
| ### Architecture | |
| - Base model: Qwen2.5-14B-Instruct | |
| - Adapter type: LoRA (PEFT) | |
| ### Output Format | |
| The model generates structured JSON suitable for automated processing. | |
| Missing values are represented by `null` instead of inferred values, improving reliability in production environments. | |
| --- | |
| ## Framework Versions | |
| - PEFT 0.15.1 | |
| - Transformers |