sweatSmile commited on
Commit
ce3dc18
·
verified ·
1 Parent(s): 374831a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +201 -3
README.md CHANGED
@@ -1,3 +1,201 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: microsoft/Phi-3-mini-4k-instruct
4
+ tags:
5
+ - phi3
6
+ - finance
7
+ - financial-qa
8
+ - fintech
9
+ - fine-tuned
10
+ - lora
11
+ - 4bit
12
+ language:
13
+ - en
14
+ library_name: transformers
15
+ pipeline_tag: text-generation
16
+ datasets:
17
+ - FinGPT/fingpt-fiqa_qa
18
+ ---
19
+
20
+ # Phi-3-Mini FinSight Financial Q&A Assistant
21
+
22
+ This model is a fine-tuned version of [microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) specialized for financial question answering. It serves as the core reasoning engine for the FinSight 360 financial intelligence system.
23
+
24
+ ## Model Details
25
+
26
+ ### Model Description
27
+
28
+ A 3.8B parameter language model fine-tuned using LoRA (Low-Rank Adaptation) on financial Q&A data. The model is optimized to answer questions about investments, banking, personal finance, and corporate finance topics.
29
+
30
+ - **Developed by:** sweatSmile
31
+ - **Model type:** Causal Language Model (Decoder-only Transformer)
32
+ - **Language(s):** English
33
+ - **License:** MIT
34
+ - **Finetuned from model:** microsoft/Phi-3-mini-4k-instruct
35
+
36
+ ### Model Sources
37
+
38
+ - **Repository:** [More Information Needed]
39
+ - **Base Model:** [microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct)
40
+
41
+ ## Uses
42
+
43
+ ### Direct Use
44
+
45
+ This model can be used directly for:
46
+ - Answering financial and investment questions
47
+ - Explaining financial concepts and terminology
48
+ - Providing guidance on personal finance topics
49
+ - Educational purposes for financial literacy
50
+
51
+ ### Downstream Use
52
+
53
+ The model is designed as a component of the FinSight 360 system, which includes:
54
+ - Real-time financial data retrieval (RAG architecture)
55
+ - Risk assessment and sentiment analysis
56
+ - Entity extraction from financial documents
57
+ - Interactive financial dashboard
58
+
59
+ ### Out-of-Scope Use
60
+
61
+ - **Not financial advice:** This model is for educational and informational purposes only
62
+ - **Not for trading decisions:** Should not be used as sole basis for investment decisions
63
+ - **Not licensed advice:** Does not replace consultation with qualified financial advisors
64
+ - **Not for emergency financial situations:** Cannot provide real-time crisis management
65
+
66
+ ## Bias, Risks, and Limitations
67
+
68
+ - Trained on only 500 samples - limited coverage of specialized financial topics
69
+ - May not reflect the most current market conditions or regulations
70
+ - Potential bias toward certain financial instruments or strategies present in training data
71
+ - Cannot access real-time market data or perform live calculations
72
+ - May generate plausible-sounding but incorrect information (hallucinations)
73
+
74
+ ### Recommendations
75
+
76
+ Users should:
77
+ - Verify all financial information with qualified professionals
78
+ - Not use for actual investment or financial decisions without expert consultation
79
+ - Be aware of the model's training data limitations
80
+ - Cross-reference answers with authoritative financial sources
81
+
82
+ ## How to Get Started with the Model
83
+
84
+ ```python
85
+ from transformers import AutoModelForCausalLM, AutoTokenizer
86
+
87
+ model_name = "sweatSmile/Phi3-Mini-FinSight-FinancialQA"
88
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
89
+ model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
90
+
91
+ prompt = """<|system|>
92
+ You are FinSight, an expert financial advisor.<|end|>
93
+ <|user|>
94
+ What's the difference between a Roth IRA and a Traditional IRA?<|end|>
95
+ <|assistant|>
96
+ """
97
+
98
+ inputs = tokenizer(prompt, return_tensors="pt")
99
+ outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7, do_sample=True)
100
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
101
+ print(response)
102
+ ```
103
+
104
+ ## Training Details
105
+
106
+ ### Training Data
107
+
108
+ Fine-tuned on 500 samples from [FinGPT/fingpt-fiqa_qa](https://huggingface.co/datasets/FinGPT/fingpt-fiqa_qa), which contains financial questions and expert answers covering:
109
+ - Investment strategies
110
+ - Banking and credit
111
+ - Personal finance management
112
+ - Corporate finance concepts
113
+ - Market analysis
114
+
115
+ ### Training Procedure
116
+
117
+ #### Training Hyperparameters
118
+
119
+ - **Training regime:** bf16 mixed precision
120
+ - **Epochs:** 3
121
+ - **Learning rate:** 2e-5
122
+ - **Batch size:** 4 per device
123
+ - **Max sequence length:** 1024 tokens
124
+ - **Optimizer:** AdamW with cosine learning rate schedule
125
+ - **Warmup ratio:** 0.1
126
+ - **Weight decay:** 0.01
127
+ - **Gradient clipping:** 1.0
128
+
129
+ #### LoRA Configuration
130
+
131
+ - **Rank (r):** 8
132
+ - **Alpha:** 16
133
+ - **Dropout:** 0.1
134
+ - **Target modules:** All linear layers
135
+ - **Quantization:** 4-bit (nf4)
136
+
137
+ #### Speeds, Sizes, Times
138
+
139
+ - **Training time:** ~30 minutes on single T4 GPU
140
+ - **Model size (merged):** ~7GB
141
+ - **Hardware:** Google Colab T4 GPU (16GB VRAM)
142
+
143
+ ## Evaluation
144
+
145
+ Due to the small training set (500 samples), formal evaluation metrics were not computed. The model is intended as a proof-of-concept and component for the larger FinSight 360 system.
146
+
147
+ ### Example Outputs
148
+
149
+ **Question:** "How do interest rates affect stock prices?"
150
+ **Response:** [Model provides explanation of inverse relationship between rates and equity valuations]
151
+
152
+ **Question:** "What is diversification in investing?"
153
+ **Response:** [Model explains portfolio risk management through asset allocation]
154
+
155
+ ## Technical Specifications
156
+
157
+ ### Model Architecture and Objective
158
+
159
+ - **Architecture:** Phi-3 (Dense transformer decoder)
160
+ - **Parameters:** 3.8 billion (base model)
161
+ - **Trainable parameters:** ~4.2 million via LoRA (0.11% of base)
162
+ - **Context window:** 4,096 tokens
163
+ - **Objective:** Causal language modeling with cross-entropy loss
164
+
165
+ ### Compute Infrastructure
166
+
167
+ #### Hardware
168
+
169
+ - GPU: NVIDIA T4 (16GB VRAM)
170
+ - Platform: Google Colab
171
+
172
+ #### Software
173
+
174
+ - Transformers: 4.x
175
+ - TRL (Transformer Reinforcement Learning)
176
+ - PEFT (Parameter-Efficient Fine-Tuning)
177
+ - PyTorch: 2.x
178
+ - bitsandbytes (4-bit quantization)
179
+
180
+ ## Citation
181
+
182
+ **BibTeX:**
183
+
184
+ ```bibtex
185
+ @misc{phi3-finsight-2025,
186
+ author = {sweatSmile},
187
+ title = {Phi-3-Mini FinSight Financial Q&A Assistant},
188
+ year = {2025},
189
+ publisher = {HuggingFace},
190
+ journal = {HuggingFace Model Hub},
191
+ howpublished = {\url{https://huggingface.co/sweatSmile/Phi3-Mini-FinSight-FinancialQA}}
192
+ }
193
+ ```
194
+
195
+ ## Model Card Authors
196
+
197
+ sweatSmile
198
+
199
+ ## Model Card Contact
200
+
201
+ Available via HuggingFace profile