Upload docs/PRODUCTION_READINESS.md with huggingface_hub
Browse files- docs/PRODUCTION_READINESS.md +115 -0
docs/PRODUCTION_READINESS.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FinEE Production Readiness Report
|
| 2 |
+
|
| 3 |
+
## Current Status vs Production Target
|
| 4 |
+
|
| 5 |
+
| Aspect | Current Status | Target | Gap |
|
| 6 |
+
|--------|---------------|--------|-----|
|
| 7 |
+
| **Training Data** | 137,267 samples | 50,000+ | ✅ **EXCEEDED** |
|
| 8 |
+
| **Bank Coverage** | 8 banks | 15+ banks | ⚠️ Need 7 more |
|
| 9 |
+
| **Document Types** | Email, SMS | Email, PDF, SMS, Images | ⚠️ PDF/Image parsers added |
|
| 10 |
+
| **Evaluation** | F1=56.8% (regex) | F1 > 95% | ❌ LLM fine-tuning needed |
|
| 11 |
+
| **Deployment** | Mac (MLX) | Cloud + Mobile + Edge | ⚠️ Export scripts ready |
|
| 12 |
+
| **Users** | 0 external | 10+ active | ❌ Beta testing needed |
|
| 13 |
+
|
| 14 |
+
## Benchmark Results
|
| 15 |
+
|
| 16 |
+
### Regex Extractor (Baseline)
|
| 17 |
+
|
| 18 |
+
| Field | Accuracy | Status |
|
| 19 |
+
|-------|----------|--------|
|
| 20 |
+
| Amount | 85.8% | ✅ Good |
|
| 21 |
+
| Type | 65.0% | ⚠️ Needs improvement |
|
| 22 |
+
| Bank | 100% | ✅ Excellent |
|
| 23 |
+
| Merchant | 28.3% | ❌ LLM needed |
|
| 24 |
+
| Category | 15.8% | ❌ LLM needed |
|
| 25 |
+
| **Overall** | **56.8%** | ❌ Below target |
|
| 26 |
+
|
| 27 |
+
### Expected with LLM Fine-tuning
|
| 28 |
+
|
| 29 |
+
| Field | With LLM | Target |
|
| 30 |
+
|-------|----------|--------|
|
| 31 |
+
| Amount | ~98% | 99% |
|
| 32 |
+
| Type | ~97% | 98% |
|
| 33 |
+
| Bank | 100% | 100% |
|
| 34 |
+
| Merchant | ~92% | 95% |
|
| 35 |
+
| Category | ~88% | 90% |
|
| 36 |
+
| **Overall** | **~95%** | 95% |
|
| 37 |
+
|
| 38 |
+
## Priority Actions
|
| 39 |
+
|
| 40 |
+
### High Priority (This Week)
|
| 41 |
+
|
| 42 |
+
1. **Fine-tune LLM on 137K dataset**
|
| 43 |
+
- Use `scripts/finetune.py` with MLX or PyTorch
|
| 44 |
+
- Target: Phi-3 or Llama 3.1 8B
|
| 45 |
+
- Expected improvement: +40% F1
|
| 46 |
+
|
| 47 |
+
2. **Add remaining banks**
|
| 48 |
+
- BOB, Canara, Union, IDBI, Federal, South Indian, Karur Vysya
|
| 49 |
+
- Update `scripts/data_pipeline/generate_synthetic.py`
|
| 50 |
+
|
| 51 |
+
3. **Test PDF parsing**
|
| 52 |
+
- Collect sample bank statements
|
| 53 |
+
- Test with `src/finee/pdf_parser.py`
|
| 54 |
+
|
| 55 |
+
### Medium Priority (This Month)
|
| 56 |
+
|
| 57 |
+
4. **Export to ONNX**
|
| 58 |
+
- Run `scripts/export_model.py --format onnx`
|
| 59 |
+
- Test inference speed
|
| 60 |
+
|
| 61 |
+
5. **Deploy to HF Inference**
|
| 62 |
+
- Push model to Hugging Face
|
| 63 |
+
- Enable Inference API
|
| 64 |
+
|
| 65 |
+
6. **Get beta users**
|
| 66 |
+
- Share demo: https://huggingface.co/spaces/Ranjit0034/finee-demo
|
| 67 |
+
- Collect feedback
|
| 68 |
+
|
| 69 |
+
### Low Priority (Next Month)
|
| 70 |
+
|
| 71 |
+
7. **Mobile deployment (GGUF)**
|
| 72 |
+
8. **Multi-turn agent**
|
| 73 |
+
9. **Knowledge graph integration**
|
| 74 |
+
|
| 75 |
+
## Files Added
|
| 76 |
+
|
| 77 |
+
| File | Description |
|
| 78 |
+
|------|-------------|
|
| 79 |
+
| `src/finee/rag.py` | RAG engine with 50+ merchants |
|
| 80 |
+
| `src/finee/api.py` | FastAPI backend (8 endpoints) |
|
| 81 |
+
| `src/finee/ui.py` | Gradio web interface |
|
| 82 |
+
| `src/finee/pdf_parser.py` | PDF/Image parsing |
|
| 83 |
+
| `scripts/benchmark.py` | Production benchmark suite |
|
| 84 |
+
| `scripts/export_model.py` | ONNX/GGUF/CoreML export |
|
| 85 |
+
| `tests/test_rag.py` | 33 comprehensive tests |
|
| 86 |
+
|
| 87 |
+
## Commands
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
# Run benchmark
|
| 91 |
+
python scripts/benchmark.py --test-file data/instruction/test.jsonl --max-samples 1000
|
| 92 |
+
|
| 93 |
+
# Fine-tune LLM
|
| 94 |
+
python scripts/finetune.py --backend mlx --model microsoft/phi-3-mini-4k-instruct
|
| 95 |
+
|
| 96 |
+
# Export to ONNX
|
| 97 |
+
python scripts/export_model.py models/finetuned --format onnx
|
| 98 |
+
|
| 99 |
+
# Start API server
|
| 100 |
+
python -m finee.api --port 8000
|
| 101 |
+
|
| 102 |
+
# Launch Gradio UI
|
| 103 |
+
python -m finee.ui --port 7860
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## Links
|
| 107 |
+
|
| 108 |
+
- **Demo**: https://huggingface.co/spaces/Ranjit0034/finee-demo
|
| 109 |
+
- **Dataset**: https://huggingface.co/datasets/Ranjit0034/finee-dataset
|
| 110 |
+
- **Model**: https://huggingface.co/Ranjit0034/finee-phi3-4b
|
| 111 |
+
- **Code**: https://huggingface.co/Ranjit0034/finance-entity-extractor
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
*Last updated: 2026-01-14*
|