76 lines
2.1 KiB
Markdown
76 lines
2.1 KiB
Markdown
|
|
---
|
||
|
|
license: apache-2.0
|
||
|
|
license_link: https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct/blob/main/LICENSE
|
||
|
|
language:
|
||
|
|
- en
|
||
|
|
pipeline_tag: text-generation
|
||
|
|
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
||
|
|
tags:
|
||
|
|
- text-generation
|
||
|
|
- lora
|
||
|
|
- sft
|
||
|
|
- mlx
|
||
|
|
- finance
|
||
|
|
- itr
|
||
|
|
- indian-tax
|
||
|
|
library_name: mlx
|
||
|
|
---
|
||
|
|
|
||
|
|
# ligaments-dev/Qwen2.5-1.5B-Instruct-itr-finetuned
|
||
|
|
|
||
|
|
Fine-tuned version of [Qwen/Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) for **Indian Income Tax Return (ITR) structured JSON extraction**. The LoRA adapter has been merged into the base model weights (fused model).
|
||
|
|
|
||
|
|
## Model Details
|
||
|
|
|
||
|
|
- **Base model:** Qwen/Qwen2.5-1.5B-Instruct
|
||
|
|
- **Fine-tuning method:** LoRA (rank=16, scale=32, dropout=0.05)
|
||
|
|
- **Framework:** MLX-LM v0.31.3 (Apple Silicon)
|
||
|
|
- **Task:** Extract structured JSON from ITR documents (ITR-1, ITR-2, ITR-3, ITR-4)
|
||
|
|
- **Training:** 3 epochs, 1500 iterations, lr=2e-5 (cosine decay), batch size=1 with grad accumulation=4
|
||
|
|
- **Developed by:** Ligaments AI
|
||
|
|
|
||
|
|
## Evaluation Results
|
||
|
|
|
||
|
|
Evaluated on 49 held-out ITR examples:
|
||
|
|
|
||
|
|
| Metric | Pass Rate |
|
||
|
|
|---|---|
|
||
|
|
| JSON Validity | 98.0% |
|
||
|
|
| Form Type Match | 98.0% |
|
||
|
|
| Numeric Sums Correct | 98.0% |
|
||
|
|
| Boolean Y/N Only | 98.0% |
|
||
|
|
| Date YYYY-MM-DD Format | 98.0% |
|
||
|
|
| State/Country Numeric Codes | 98.0% |
|
||
|
|
| No Round Numbers | 81.6% |
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pip install mlx-lm
|
||
|
|
```
|
||
|
|
|
||
|
|
```python
|
||
|
|
from mlx_lm import load, generate
|
||
|
|
from mlx_lm.sample_utils import make_sampler
|
||
|
|
|
||
|
|
model, tokenizer = load("ligaments-dev/Qwen2.5-1.5B-Instruct-itr-finetuned")
|
||
|
|
sampler = make_sampler(temp=0.1)
|
||
|
|
|
||
|
|
messages = [
|
||
|
|
{"role": "system", "content": "You are an ITR JSON extraction assistant..."},
|
||
|
|
{"role": "user", "content": "<your ITR document text here>"}
|
||
|
|
]
|
||
|
|
|
||
|
|
prompt = tokenizer.apply_chat_template(
|
||
|
|
messages, add_generation_prompt=True, return_dict=False
|
||
|
|
)
|
||
|
|
|
||
|
|
response = generate(model, tokenizer, prompt=prompt, sampler=sampler, max_tokens=4096, verbose=True)
|
||
|
|
```
|
||
|
|
|
||
|
|
## Intended Use
|
||
|
|
|
||
|
|
- Extracting structured financial data from Indian ITR documents for MSME lending workflows
|
||
|
|
- Automating credit risk assessment pipelines
|
||
|
|
- Not intended for general-purpose tax advice or legal decisions
|