Overview
FinGPT, from the AI4Finance Foundation, is an open-source effort to build financial large language models that anyone can run and adapt. Instead of training a costly model from scratch like BloombergGPT, FinGPT takes strong open base models and fine-tunes them with the lightweight LoRA method, so a fresh model can be produced for less than $300 per run.
The project ships ready-to-use models on Hugging Face for tasks such as financial sentiment analysis, relation extraction, headline classification, named-entity recognition, and the FinGPT-Forecaster, which reads recent market news and predicts the next week's stock-price direction. Because finance data changes constantly, the design favors fast, frequent re-tuning over expensive one-time training.
What it does
- Open-source financial LLMs published on Hugging Face for sentiment analysis, relation extraction, headline classification, and named-entity recognition
- LoRA fine-tuning that adapts large base models cheaply, reportedly under $300 and runnable on a single RTX 3090 in 8-bit or int4 (QLoRA)
- Multi-task models built on open bases including Llama-2, Falcon, Bloom, MPT, ChatGLM2, and Qwen
- FinGPT-Forecaster: enter a ticker, a date, and a news look-back window to get a company analysis and a next-week price-movement prediction
- Public instruction-tuning datasets for sentiment, financial relations, headlines, NER, and Q&A to reproduce and extend results
- Five-layer full-stack framework spanning data source, data engineering, LLMs, tasks, and applications
Getting started
FinGPT models are loaded with Hugging Face Transformers and PEFT: you load an open base model and then apply the FinGPT LoRA adapter on top. The example below runs the v3 financial sentiment model.
Install the libraries
Install Transformers and PEFT (plus a GPU-capable PyTorch). The v3 sentiment example was tested with PEFT 0.5.0.
pip install transformers peft torchLoad the base model and the FinGPT LoRA adapter
Load the open base model from Hugging Face, then attach the FinGPT sentiment LoRA weights with PeftModel.
from transformers import LlamaForCausalLM, LlamaTokenizerFast
from peft import PeftModel # 0.5.0
base_model = "NousResearch/Llama-2-13b-hf"
peft_model = "FinGPT/fingpt-sentiment_llama2-13b_lora"
tokenizer = LlamaTokenizerFast.from_pretrained(base_model, trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
model = LlamaForCausalLM.from_pretrained(base_model, trust_remote_code=True, device_map="cuda:0", load_in_8bit=True)
model = PeftModel.from_pretrained(model, peft_model)
model = model.eval()Run a financial sentiment prompt
Format an instruction prompt, generate, and read the answer after the 'Answer:' marker.
prompt = ['''Instruction: What is the sentiment of this news? Please choose an answer from {negative/neutral/positive}
Input: FINANCING OF ASPOCOMP 'S GROWTH Aspocomp is aggressively pursuing its growth strategy.
Answer: ''']
tokens = tokenizer(prompt, return_tensors='pt', padding=True, max_length=512)
res = model.generate(**tokens, max_length=512)
res_sentences = [tokenizer.decode(i) for i in res]
out_text = [o.split("Answer: ")[1] for o in res_sentences]
for sentiment in out_text:
print(sentiment)Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Classify the sentiment of financial news headlines and tweets as positive, neutral, or negative
- Fine-tune your own low-cost financial LLM with LoRA on a single consumer GPU instead of paying for a from-scratch model
- Forecast a stock's next-week price direction from recent market news with FinGPT-Forecaster
- Extract financial relations and named entities from filings and news for downstream analysis
How FinGPT compares
FinGPT alongside other open-source fine-tuning frameworks tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| LLaMA-Factory | ★ 72.3k | An end-to-end training suite with a web UI that covers pre-training, supervised fine-tuning, and RLHF for hundreds of LLMs and multimodal models. |
| Unsloth | ★ 66.9k | A library that speeds up LoRA and QLoRA fine-tuning while cutting memory use, aimed at training models on a single GPU. |
| PEFT | ★ 21.3k | Hugging Face's library of parameter-efficient fine-tuning methods such as LoRA, DoRA, and prompt tuning that train small adapters instead of full models. |
| FinGPT | ★ 20.5k | Open-source financial large language models you can fine-tune for under $300 |
| ms-swift | ★ 14.6k | ModelScope's framework for fine-tuning and deploying 600+ LLMs and 300+ multimodal models, supporting PEFT and full-parameter SFT, DPO, and GRPO. |
| LitGPT | ★ 13.4k | An open-source toolkit from Lightning AI to pretrain, finetune, and serve 20+ large language models, each written from scratch for speed and full control. |
| Axolotl | ★ 12.1k | A config-driven tool for fine-tuning and post-training open LLMs that supports SFT, LoRA/QLoRA, DPO, GRPO, and multi-GPU training across many model families. |
| Ludwig | ★ 11.7k | Ludwig is a low-code framework that lets you train, fine-tune, and deploy LLMs, multimodal, and tabular models using a YAML config instead of boilerplate Python. |