• Stars
    star
    10,786
  • Rank 2,992 (Top 0.07 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created about 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

FinGPT: Open-Source Financial Large Language Models! Revolutionize 🔥 We release the trained model on HuggingFace.

Data-Centric FinGPT: Open-source for Open Finance.

Downloads Downloads Python 3.8 PyPI License

Let us DO NOT expect Wall Street to open-source LLMs nor open APIs, due to FinTech institutes' internal regulations and policies.

We democratize Internet-scale data for financial large language models (FinLLMs) at FinNLP and FinNLP Website

Blueprint of FinGPT

Disclaimer: We are sharing codes for academic purposes under the MIT education license. Nothing herein is financial advice, and NOT a recommendation to trade real money. Please use common sense and always first consult a professional before trading or investing.

Why FinGPT?

1). Finance is highly dynamic. BloombergGPT trained an LLM using a mixture of finance data and general-purpose data, which too about 53 days, at a cost of around $3M). It is costly to retrain an LLM model like BloombergGPT every month or every week, thus lightweight adaptation is highly favorable. FinGPT can be fine-tuned swiftly to incorporate new data (the cost falls significantly, less than $300 per fine-tuning).

2). Democratizing Internet-scale financial data is critical, say allowing timely updates of the model (monthly or weekly updates) using an automatic data curation pipeline. BloombergGPT has privileged data access and APIs, while FinGPT presents a more accessible alternative. It prioritizes lightweight adaptation, leveraging the best available open-source LLMs.

3). The key technology is "RLHF (Reinforcement learning from human feedback)", which is missing in BloombergGPT. RLHF enables an LLM model to learn individual preferences (risk-aversion level, investing habits, personalized robo-advisor, etc.), which is the "secret" ingredient of ChatGPT and GPT4.

FinGPT Demos

  • FinGPT V3 (Updated on 8/4/2023)

    • FinGPT v3 series are LLMs finetuned with LoRA method on the News and Tweets sentiment analysis dataset which achieve best scores on most of the financial sentiment analysis datasets.
    • FinGPT v3.1 uses chatglm2-6B as base model; FinGPT v3.2 uses llama2-7b as base model
    • Benchmark Results:
      Weighted F1 BloombergGPT ChatGLM2 Llama2 FinGPT v3.1 v3.1.1 (8bit) v3.1.2 (QLoRA) FinGPT v3.2
      FPB 0.511 0.381 0.390 0.855 0.855 0.777 0.850
      FiQA-SA 0.751 0.790 0.800 0.850 0.847 0.752 0.860
      TFNS - 0.189 0.296 0.875 0.879 0.828 0.894
      NWGI - 0.449 0.503 0.642 0.632 0.583 0.636
      Devices 512 × A100 64 × A100 2048 × A100 8 × A100 A100 A100 8 × A100
      Time 53 days 2.5 days 21 days 2 hours 6.47 hours 4.15 hours 2 hours
      Cost $2.67 million $ 14,976 $4.23 million $65.6 $25.88 $17.01 $65.6

Cost per GPU hour. For A100 GPUs, the AWS p4d.24xlarge instance, equipped with 8 A100 GPUs is used as a benchmark to estimate the costs. Note that BloombergGPT also used p4d.24xlarge As of July 11, 2023, the hourly rate for this instance stands at $32.773. Consequently, the estimated cost per GPU hour comes to $32.77 divided by 8, resulting in approximately $4.10. With this value as the reference unit price (1 GPU hour). BloombergGPT estimated cost= 512 x 53 x 24 = 651,264 GPU hours x $4.10 = $2,670,182.40

  • Reproduce the results by running benchmarks, and the detailed tutorial is on the way.

  • Finetune your own FinGPT v3 model with the LoRA method on only an RTX 3090 with this notebook in 8bit or this notebook in int4 (QLoRA)

  • FinGPT V2

    • Let's train our own FinGPT in American Financial Market with LLaMA and LoRA (Low-Rank Adaptation)
  • FinGPT V1

    • Let's train our own FinGPT in Chinese Financial Market with ChatGLM and LoRA (Low-Rank Adaptation)

Understanding FinGPT: An Educational Blog Series

What is FinGPT and FinNLP?

The Goals of FinGPT

  1. Real-time data curation pipeline to democratize data for FinGPT
  2. Lightweight adaptation to democratize the FinGPT model for both individuals and institutes (frequent updates)
  3. Support various financial applications
  • FinNLP provides a playground for all people interested in LLMs and NLP in Finance. Here we provide full pipelines for LLM training and finetuning in the field of finance. The full architecture is shown in the following picture. Detail codes and introductions can be found here. Or you may refer to the wiki

End-to-end framework: FinGPT embraces a full-stack framework for FinLLMs with four layers:

  • Data source layer: This layer assures comprehensive market coverage, addressing the temporal sensitivity of financial data through real-time information capture.
  • Data engineering layer: Primed for real-time NLP data processing, this layer tackles the inherent challenges of high temporal sensitivity and low signal-to-noise ratio in financial data.
  • LLMs layer: Focusing on a range of fine-tuning methodologies such as LoRA, this layer mitigates the highly dynamic nature of financial data, ensuring the model’s relevance and accuracy.
  • Application layer: Showcasing practical applications and demos, this layer highlights the potential capability of FinGPT in the financial sector.

Open-Source Base Model used in the LLMs layer of FinGPT

  • Feel free to contribute more open-source base models tailored for various language-specific financial markets.
Base Model Pretraining Tokens Context Length Model Advantages Model Size Experiment Results Applications
Llama-2 2 Trillion 4096 Llama-2 excels on English-based market data llama-2-7b and Llama-2-13b llama-2 consistently shows superior fine-tuning results Financial Sentiment Analysis, Robo-Advisor
Falcon 1,500B 2048 Maintains high-quality results while being more resource-efficient falcon-7b Good for English market data Financial Sentiment Analysis
ChatGLM2 1.4T 32K Exceptional capability for Chinese language expression chatglm2-6b Shows prowess for Chinese market data. Financial Sentiment Analysis, Financial Report Summary
InternLM 1.8T 8k Can flexibly and independently construct workflows internlm-7b Effective for Chinese market data Financial Sentiment Analysis

News

ChatGPT at AI4Finance

Introductory

The Journey of Open AI GPT models. GPT models explained. Open AI's GPT-1, GPT-2, GPT-3.

(Financial) Big Data

Interesting Demos

  • GPT-3 Creative Fiction Creative writing by OpenAI’s GPT-3 model, demonstrating poetry, dialogue, puns, literary parodies, and storytelling. Plus advice on effective GPT-3 prompt programming & avoiding common errors.

ChatGPT for FinTech

ChatGPT Trading Bot

Links

More Repositories

1

FinRL

FinRL: Financial Reinforcement Learning. 🔥
Jupyter Notebook
8,979
star
2

ElegantRL

Massively Parallel Deep Reinforcement Learning. 🔥
Python
3,430
star
3

FinRL-Trading

For trading. Please star.
Jupyter Notebook
1,885
star
4

FinRL-Meta

FinRL­-Meta: Dynamic datasets and market environments for FinRL.
Python
1,128
star
5

FinNLP

Democratizing Internet-scale financial data.
Jupyter Notebook
967
star
6

FinRL-Tutorials

Tutorials. Please star.
Jupyter Notebook
715
star
7

FinRL_Podracer

Cloud-native Financial Reinforcement Learning
Python
331
star
8

Awesome_AI4Finance

Resources
118
star
9

RLSolver

Solvers for NP-hard and NP-complete problems with an emphasis on high-performance GPU computing.
Python
106
star
10

FinRL_Market_Simulator

Python
63
star
11

Machine-Learning-for-Stock-Recommendation-IEEE-2018

A Practical Machine Learning Approach for Dynamic Stock Recommendation. IEEE TrustCom 2018.
Jupyter Notebook
62
star
12

FinRL_Crypto

FinRL_Crypto: Cryptocurrency trading of FinRL
Python
61
star
13

Quantifying-ESG-Alpha-using-Scholar-Big-Data-ICAIF-2020

Quantifying ESG Alpha using Scholar Big Data: An Automated Machine Learning Approach.
Jupyter Notebook
59
star
14

FinRL-Blogs

Blogs, tutorials, news. Please star.
56
star
15

Deep-Reinforcement-Learning-for-Stock-Trading-DDPG-Algorithm-NIPS-2018

Practical Deep Reinforcement Learning Approach for Stock Trading. NeurIPS 2018 AI in Finance.
Python
50
star
16

Financial-News-for-Stock-Prediction-using-DP-LSTM-NIPS-2019

Differential Privacy-inspired LSTM for Stock Prediction Using Financial News. NeurIPS Robust AI in Financial Services 2019.
Python
30
star
17

Liquidation-Analysis-using-Multi-Agent-Reinforcement-Learning-ICML-2019

Multi-agent Reinforcement Learning for Liquidation Strategy Analysis. ICML 2019 AI in Finance.
Jupyter Notebook
24
star
18

Popular-RL-Algorithms

Jupyter Notebook
22
star
19

FinEmotion

Python
20
star
20

ElegantRL_Transportation

High-performance RL library for transportation problems, e.g., autonomous driving, traffic light control, UAV control, and path planning.
Python
18
star
21

AI4Finance-Education

education channel
16
star
22

Risk-Management-using-Deep-Learning-for-Midterm-Stock-Prediction-KDD-2019

Risk Management via Anomaly Circumvent: Mnemonic Deep Learning for Midterm Stock Prediction. KDD 2019.
Jupyter Notebook
15
star
23

FinRL_Imitation_Learning

Jupyter Notebook
14
star
24

Quantum-Tensor-Networks-for-Variational-Reinforcement-Learning-NeurIPS-2020

Quantum Tensor Networks for Variational Reinforcement Learning. NeurIPS 2020.
Python
13
star
25

AI4Finance_Job_Info

Job Infor in the intersection of AI, Big data, and Finance.
6
star
26

Optimistic-Bull-Pessimistic-Bear-DRL-Stock-Portfolio-Allocation-ICML-2019

5
star
27

Awesome_FinRL

FinRL resources: papers, projects
5
star
28

Scholar-Data-Driven-Alpha-in-AI-Industry-IEEE-BigData-2019

Practical Machine Learning Approach to Capture the Scholar Data Driven Alpha in AI Industry. IEEE BigData 2019.
Jupyter Notebook
5
star
29

FinGPT-Earnings-Call-LLM-Agent

Jupyter Notebook
4
star
30

.github

4
star
31

ML_Price_Prediction

Predict price
4
star
32

PlotFigs

Plot figures for academic papers.
Python
1
star