Add model card with training details and usage examples
Browse files
README.md
CHANGED
|
@@ -1,18 +1,121 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- zh
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen2.5-3B-Instruct
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
+
tags:
|
| 10 |
+
- finance
|
| 11 |
+
- chinese
|
| 12 |
+
- qlora
|
| 13 |
+
- private-equity
|
| 14 |
+
- fund-analysis
|
| 15 |
+
- distillation
|
| 16 |
+
metrics:
|
| 17 |
+
- loss
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# MachFund-1
|
| 21 |
+
|
| 22 |
+
A specialized Chinese private equity fund analysis model, fine-tuned from [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) using QLoRA knowledge distillation.
|
| 23 |
+
|
| 24 |
+
## Overview
|
| 25 |
+
|
| 26 |
+
MachFund-1 is trained to analyze Chinese private equity funds across multiple dimensions: performance analysis, risk assessment, strategy evaluation, manager background, fund comparisons, and investment advice. The model demonstrates a **68.75% improvement** over the base model on domain-specific tasks.
|
| 27 |
+
|
| 28 |
+
## Training Details
|
| 29 |
+
|
| 30 |
+
| Parameter | Value |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Base Model | Qwen2.5-3B-Instruct |
|
| 33 |
+
| Method | QLoRA (4-bit NF4 quantization) |
|
| 34 |
+
| LoRA Rank / Alpha | 32 / 64 |
|
| 35 |
+
| Training Samples | 6,976 (eval: 769) |
|
| 36 |
+
| Effective Batch Size | 16 (2 x 8 grad accumulation) |
|
| 37 |
+
| Learning Rate | 2e-4 (cosine schedule) |
|
| 38 |
+
| Epochs | 2 |
|
| 39 |
+
| Max Sequence Length | 6,144 tokens |
|
| 40 |
+
| Final Training Loss | 0.9269 |
|
| 41 |
+
| Training Time | 141 min on NVIDIA A100 80GB |
|
| 42 |
+
| Total Steps | 872 |
|
| 43 |
+
|
| 44 |
+
### Knowledge Distillation Pipeline
|
| 45 |
+
|
| 46 |
+
1. **Teacher Model**: Gemini 2.5 Pro generates ~50 Q&A pairs per fund across 8 categories for 178 Chinese private equity funds
|
| 47 |
+
2. **Quality Scoring**: Gemini 2.5 Flash scores each pair on 5 dimensions (accuracy, completeness, professionalism, data usage, coherence) with a threshold of 15/25
|
| 48 |
+
3. **Student Training**: QLoRA fine-tuning on 6,976 high-quality filtered samples
|
| 49 |
+
|
| 50 |
+
### Question Categories
|
| 51 |
+
|
| 52 |
+
- Fund overview and basic information
|
| 53 |
+
- Performance analysis and benchmarking
|
| 54 |
+
- Risk assessment and drawdown analysis
|
| 55 |
+
- Strategy analysis and market positioning
|
| 56 |
+
- Manager background and track record
|
| 57 |
+
- Fund comparisons (peer and category)
|
| 58 |
+
- Investment advice and suitability
|
| 59 |
+
- Structured data extraction
|
| 60 |
+
|
| 61 |
+
## Evaluation
|
| 62 |
+
|
| 63 |
+
| Gate | Metric | Result |
|
| 64 |
+
|---|---|---|
|
| 65 |
+
| Training Lift | Base vs Fine-tuned Score | **PASS** (4.8 to 8.1, +68.75%, threshold: 30%) |
|
| 66 |
+
| Speed (FP16) | Tokens/sec on RTX 5080 | 30.1 tok/s (threshold: 50) |
|
| 67 |
+
|
| 68 |
+
## Available Formats
|
| 69 |
+
|
| 70 |
+
| Format | File | Size | Use Case |
|
| 71 |
+
|---|---|---|---|
|
| 72 |
+
| SafeTensors (FP16) | `model.safetensors` | 6.17 GB | Full precision inference |
|
| 73 |
+
| GGUF Q8_0 | `gguf/mach-fund-1-Q8_0.gguf` | 3.29 GB | High-quality quantized inference |
|
| 74 |
+
| GGUF Q4_K_M | `gguf/mach-fund-1-Q4_K_M.gguf` | 1.93 GB | Efficient inference, recommended |
|
| 75 |
+
| GGUF F16 | `gguf/mach-fund-1-f16.gguf` | 6.18 GB | Full precision GGUF |
|
| 76 |
+
|
| 77 |
+
## Usage
|
| 78 |
+
|
| 79 |
+
### Transformers
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 83 |
+
|
| 84 |
+
model = AutoModelForCausalLM.from_pretrained("openalchemy/MachFund", torch_dtype="auto", device_map="auto")
|
| 85 |
+
tokenizer = AutoTokenizer.from_pretrained("openalchemy/MachFund")
|
| 86 |
+
|
| 87 |
+
messages = [
|
| 88 |
+
{"role": "system", "content": "You are a professional private equity fund analyst."},
|
| 89 |
+
{"role": "user", "content": "Analyze the performance of this fund"}
|
| 90 |
+
]
|
| 91 |
+
|
| 92 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 93 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 94 |
+
outputs = model.generate(**inputs, max_new_tokens=1024)
|
| 95 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### llama.cpp (GGUF)
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
./llama-cli -m mach-fund-1-Q4_K_M.gguf -p "Analyze the risk profile of this fund" -n 512
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
### Ollama
|
| 105 |
+
|
| 106 |
+
```bash
|
| 107 |
+
echo 'FROM ./mach-fund-1-Q4_K_M.gguf' > Modelfile
|
| 108 |
+
ollama create machfund -f Modelfile
|
| 109 |
+
ollama run machfund "What is the Sharpe ratio of this fund?"
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## Limitations
|
| 113 |
+
|
| 114 |
+
- Trained specifically on Chinese private equity fund data; may not generalize to other financial domains
|
| 115 |
+
- Training data reflects fund information available up to early 2026
|
| 116 |
+
- Should not be used as the sole basis for investment decisions
|
| 117 |
+
- Speed on consumer GPUs (RTX 5080) is below the 50 tok/s target at FP16; use GGUF Q4_K_M for faster inference
|
| 118 |
+
|
| 119 |
+
## License
|
| 120 |
+
|
| 121 |
+
MIT
|