xsa-dev commited on
Commit
6b2608a
·
verified ·
1 Parent(s): 7452a22

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +325 -0
README.md ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: meta-llama/Llama-3.2-1B-Instruct
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:meta-llama/Llama-3.2-1B-Instruct
7
+ - lora
8
+ - transformers
9
+ - financial
10
+ - compliance
11
+ - xbrl
12
+ - sentiment-analysis
13
+ - sec-filings
14
+ ---
15
+
16
+ # FinGPT Compliance Agents
17
+
18
+ A specialized language model for financial compliance and regulatory tasks, fine-tuned on SEC filings analysis, regulatory compliance, sentiment analysis, and XBRL data processing.
19
+
20
+ ## Model Details
21
+
22
+ ### Model Description
23
+
24
+ FinGPT Compliance Agents is a LoRA fine-tuned version of Llama-3.2-1B-Instruct, specifically designed for financial compliance and regulatory tasks. The model excels at:
25
+
26
+ - **SEC Filings Analysis**: Extract insights from SEC filings and XBRL data processing
27
+ - **Financial Q&A**: Answer questions about company filings and financial statements
28
+ - **Sentiment Analysis**: Classify financial text sentiment with high accuracy
29
+ - **XBRL Processing**: Extract tags, values, and construct formulas from XBRL data
30
+ - **Regulatory Compliance**: Handle real-time financial data retrieval and analysis
31
+
32
+ - **Developed by:** SecureFinAI Contest 2025 - Task 2 Team
33
+ - **Model type:** Causal Language Model with LoRA adaptation
34
+ - **Language(s) (NLP):** English (primary), Russian (audio processing)
35
+ - **License:** Apache 2.0
36
+ - **Finetuned from model:** meta-llama/Llama-3.2-1B-Instruct
37
+
38
+ ### Model Sources
39
+
40
+ - **Repository:** [GitHub Repository](https://github.com/your-repo/fingpt-compliance-agents)
41
+ - **Base Model:** [meta-llama/Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct)
42
+ - **Training Data:** FinanceBench, XBRL Analysis, Financial Sentiment datasets
43
+
44
+ ## Uses
45
+
46
+ ### Direct Use
47
+
48
+ This model is designed for direct use in financial compliance applications:
49
+
50
+ - **Financial Q&A Systems**: Answer questions about company filings and financial data
51
+ - **Sentiment Analysis**: Classify financial news, earnings calls, and market sentiment
52
+ - **XBRL Data Processing**: Extract and analyze structured financial data
53
+ - **Regulatory Compliance**: Process SEC filings and regulatory documents
54
+ - **Audio Processing**: Transcribe and analyze financial audio content
55
+
56
+ ### Downstream Use
57
+
58
+ The model can be further fine-tuned for specific financial domains:
59
+
60
+ - **Banking Compliance**: Anti-money laundering, fraud detection
61
+ - **Insurance**: Risk assessment, claims processing
62
+ - **Investment Analysis**: Portfolio management, risk evaluation
63
+ - **Regulatory Reporting**: Automated compliance reporting
64
+
65
+ ### Out-of-Scope Use
66
+
67
+ This model should not be used for:
68
+
69
+ - Financial advice or investment recommendations
70
+ - Legal advice or regulatory interpretation
71
+ - High-stakes financial decisions without human oversight
72
+ - Non-financial compliance tasks
73
+
74
+ ## Bias, Risks, and Limitations
75
+
76
+ ### Known Limitations
77
+
78
+ - **Model Size**: Limited to 1B parameters, may not capture complex financial relationships
79
+ - **Training Data**: Primarily English financial data, limited multilingual support
80
+ - **Temporal Scope**: Training data may not include recent financial events
81
+ - **Domain Specificity**: Optimized for compliance tasks, not general financial advice
82
+
83
+ ### Recommendations
84
+
85
+ Users should:
86
+
87
+ - Validate model outputs with domain experts
88
+ - Use appropriate guardrails for financial applications
89
+ - Regularly retrain with updated financial data
90
+ - Implement human oversight for critical decisions
91
+
92
+ ## How to Get Started with the Model
93
+
94
+ ### Basic Usage
95
+
96
+ ```python
97
+ from transformers import AutoTokenizer, AutoModelForCausalLM
98
+ from peft import PeftModel
99
+ import torch
100
+
101
+ # Load the model
102
+ base_model = AutoModelForCausalLM.from_pretrained(
103
+ "meta-llama/Llama-3.2-1B-Instruct",
104
+ torch_dtype=torch.float16,
105
+ device_map="auto"
106
+ )
107
+ model = PeftModel.from_pretrained(base_model, "QXPS/fingpt-compliance-agents")
108
+ tokenizer = AutoTokenizer.from_pretrained("QXPS/fingpt-compliance-agents")
109
+
110
+ # Generate response
111
+ def generate_response(prompt, max_length=512):
112
+ inputs = tokenizer(prompt, return_tensors="pt")
113
+ with torch.no_grad():
114
+ outputs = model.generate(
115
+ **inputs,
116
+ max_new_tokens=max_length,
117
+ temperature=0.7,
118
+ do_sample=True,
119
+ pad_token_id=tokenizer.eos_token_id
120
+ )
121
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
122
+
123
+ # Example usage
124
+ prompt = "Analyze the sentiment of this financial news: 'Company X reported strong quarterly earnings with 15% revenue growth.'"
125
+ response = generate_response(prompt)
126
+ print(response)
127
+ ```
128
+
129
+ ### Financial Q&A
130
+
131
+ ```python
132
+ # Financial Q&A example
133
+ qa_prompt = """
134
+ Question: What was the company's revenue growth in Q3 2023?
135
+ Context: The company reported Q3 2023 revenue of $2.5B, up 15% from Q3 2022 revenue of $2.17B.
136
+ Answer:
137
+ """
138
+ response = generate_response(qa_prompt)
139
+ ```
140
+
141
+ ### Sentiment Analysis
142
+
143
+ ```python
144
+ # Sentiment analysis example
145
+ sentiment_prompt = """
146
+ Classify the sentiment of this financial text as positive, negative, or neutral:
147
+ "The company's stock price plummeted 20% after missing earnings expectations."
148
+ Sentiment:
149
+ """
150
+ response = generate_response(sentiment_prompt)
151
+ ```
152
+
153
+ ## Training Details
154
+
155
+ ### Training Data
156
+
157
+ The model was trained on a diverse collection of financial datasets:
158
+
159
+ - **FinanceBench**: 150 financial Q&A examples from SEC filings
160
+ - **XBRL Analysis**: 574 examples of XBRL tag extraction, value extraction, and formula construction
161
+ - **Financial Sentiment**: 826 examples from FPB (Financial Phrase Bank) dataset
162
+ - **Total Training Examples**: 7,153 (5,722 train, 1,431 test)
163
+
164
+ ### Training Procedure
165
+
166
+ #### Preprocessing
167
+
168
+ - **Text Processing**: Standardized to conversation format with system/user/assistant roles
169
+ - **Tokenization**: Using Llama-3.2 tokenizer with 2048 max length
170
+ - **Data Splitting**: 80/20 train/test split with stratified sampling
171
+
172
+ #### Training Hyperparameters
173
+
174
+ - **Training regime**: LoRA fine-tuning with 4-bit quantization
175
+ - **Base Model**: meta-llama/Llama-3.2-1B-Instruct
176
+ - **LoRA Parameters**: r=8, alpha=16, dropout=0.1
177
+ - **Batch Size**: 1 with gradient accumulation of 4 steps
178
+ - **Learning Rate**: 1e-4 with linear warmup
179
+ - **Epochs**: 1 (845 training steps)
180
+ - **Optimizer**: AdamW
181
+ - **Scheduler**: Linear with warmup
182
+
183
+ #### Speeds, Sizes, Times
184
+
185
+ - **Training Time**: ~2 hours on single GPU
186
+ - **Model Size**: ~1.1GB (base model + LoRA weights)
187
+ - **Inference Speed**: ~50 tokens/second on GPU
188
+ - **Memory Usage**: ~4GB VRAM for inference
189
+
190
+ ## Evaluation
191
+
192
+ ### Testing Data, Factors & Metrics
193
+
194
+ #### Testing Data
195
+
196
+ - **FinanceBench**: 31 financial Q&A examples
197
+ - **XBRL Analysis**: 574 XBRL processing examples
198
+ - **Financial Sentiment**: 826 sentiment classification examples
199
+ - **Audio Processing**: 5 financial audio samples
200
+
201
+ #### Metrics
202
+
203
+ - **Accuracy**: Overall correctness across all tasks
204
+ - **F1-Score**: Harmonic mean of precision and recall
205
+ - **Precision**: True positives / (True positives + False positives)
206
+ - **Recall**: True positives / (True positives + False negatives)
207
+
208
+ ### Results
209
+
210
+ #### Financial Q&A Performance
211
+ - **Accuracy**: 67.7% (21/31 correct)
212
+ - **Sample Size**: 31 questions
213
+
214
+ #### Sentiment Analysis Performance
215
+ - **Accuracy**: 43.5% (359/826 correct)
216
+ - **F1-Score**: 46.7%
217
+ - **Precision**: 54.6%
218
+ - **Recall**: 43.5%
219
+ - **Sample Size**: 826 examples
220
+
221
+ #### XBRL Processing Performance
222
+ - **Tag Extraction**: 89.6% accuracy
223
+ - **Value Extraction**: 63.6% accuracy
224
+ - **Formula Construction**: 99.4% accuracy
225
+ - **Formula Calculation**: 82.2% accuracy
226
+ - **Overall XBRL**: 88.3% accuracy
227
+ - **Sample Size**: 574 examples
228
+
229
+ #### Overall Performance
230
+ - **Accuracy**: 55.6%
231
+ - **F1-Score**: 46.7%
232
+ - **Precision**: 54.6%
233
+ - **Recall**: 43.5%
234
+
235
+ #### Summary
236
+
237
+ The model shows strong performance in XBRL processing tasks (88.3% accuracy) and moderate performance in financial Q&A (67.7% accuracy). Sentiment analysis performance is lower (43.5%) but shows room for improvement with additional training data.
238
+
239
+ ## Model Examination
240
+
241
+ ### Key Strengths
242
+
243
+ 1. **XBRL Processing**: Excellent performance on structured financial data
244
+ 2. **Formula Construction**: Near-perfect accuracy (99.4%)
245
+ 3. **Financial Q&A**: Solid performance on factual questions
246
+ 4. **Efficiency**: Fast inference with 1B parameter model
247
+
248
+ ### Areas for Improvement
249
+
250
+ 1. **Sentiment Analysis**: Needs more diverse training data
251
+ 2. **Complex Reasoning**: Limited by model size for complex financial analysis
252
+ 3. **Multilingual Support**: Primarily English-focused
253
+
254
+ ## Environmental Impact
255
+
256
+ - **Hardware Type**: NVIDIA GPU (training), CPU/GPU (inference)
257
+ - **Hours used**: ~2 hours training
258
+ - **Cloud Provider**: Local development
259
+ - **Compute Region**: N/A
260
+ - **Carbon Emitted**: Estimated <1kg CO2
261
+
262
+ ## Technical Specifications
263
+
264
+ ### Model Architecture and Objective
265
+
266
+ - **Architecture**: Transformer-based causal language model
267
+ - **Parameters**: 1.1B (1B base + 0.1B LoRA)
268
+ - **Context Length**: 2048 tokens
269
+ - **Vocabulary Size**: 128,256 tokens
270
+ - **Objective**: Next token prediction with instruction following
271
+
272
+ ### Compute Infrastructure
273
+
274
+ #### Hardware
275
+ - **Training**: Single GPU (NVIDIA RTX 4090 or similar)
276
+ - **Inference**: CPU or GPU
277
+
278
+ #### Software
279
+ - **Framework**: PyTorch 2.0+
280
+ - **LoRA**: PEFT 0.17.1
281
+ - **Transformers**: 4.44.0+
282
+ - **Quantization**: bitsandbytes 0.41.0+
283
+
284
+ ## Citation
285
+
286
+ **BibTeX:**
287
+ ```bibtex
288
+ @misc{fingpt-compliance-agents2025,
289
+ title={FinGPT Compliance Agents: A Specialized Language Model for Financial Compliance},
290
+ author={SecureFinAI Contest 2025 Team},
291
+ year={2025},
292
+ publisher={Hugging Face},
293
+ howpublished={\url{https://huggingface.co/QXPS/fingpt-compliance-agents}}
294
+ }
295
+ ```
296
+
297
+ **APA:**
298
+ SecureFinAI Contest 2025 Team. (2025). FinGPT Compliance Agents: A Specialized Language Model for Financial Compliance. Hugging Face. https://huggingface.co/QXPS/fingpt-compliance-agents
299
+
300
+ ## Glossary
301
+
302
+ - **XBRL**: eXtensible Business Reporting Language - XML-based standard for financial reporting
303
+ - **LoRA**: Low-Rank Adaptation - Parameter-efficient fine-tuning method
304
+ - **SEC Filings**: Securities and Exchange Commission regulatory filings
305
+ - **FinanceBench**: Financial question-answering benchmark dataset
306
+ - **FPB**: Financial Phrase Bank - sentiment analysis dataset
307
+
308
+ ## Model Card Authors
309
+
310
+ - **Primary Authors**: SecureFinAI Contest 2025 - Task 2 Team
311
+ - **Contributors**: FinGPT development community
312
+ - **Reviewers**: Financial compliance domain experts
313
+
314
+ ## Model Card Contact
315
+
316
+ For questions about this model:
317
+ - **GitHub Issues**: [Repository Issues](https://github.com/your-repo/fingpt-compliance-agents/issues)
318
+ - **Hugging Face**: [Model Discussion](https://huggingface.co/QXPS/fingpt-compliance-agents/discussions)
319
+
320
+ ### Framework versions
321
+
322
+ - PEFT 0.17.1
323
+ - Transformers 4.44.0
324
+ - PyTorch 2.0.0
325
+ - bitsandbytes 0.41.0