[Paper Review] FinLlama: Financial Sentiment Classification for Algorithmic Trading Applications
FinLlama fine-tunes Llama 2 7B with LoRA on financial data to classify sentiment strength for trading, enabling finance-specific portfolio improvements with limited resources.
There are multiple sources of financial news online which influence market movements and trader's decisions. This highlights the need for accurate sentiment analysis, in addition to having appropriate algorithmic trading techniques, to arrive at better informed trading decisions. Standard lexicon based sentiment approaches have demonstrated their power in aiding financial decisions. However, they are known to suffer from issues related to context sensitivity and word ordering. Large Language Models (LLMs) can also be used in this context, but they are not finance-specific and tend to require significant computational resources. To facilitate a finance specific LLM framework, we introduce a novel approach based on the Llama 2 7B foundational model, in order to benefit from its generative nature and comprehensive language manipulation. This is achieved by fine-tuning the Llama2 7B model on a small portion of supervised financial sentiment analysis data, so as to jointly handle the complexities of financial lexicon and context, and further equipping it with a neural network based decision mechanism. Such a generator-classifier scheme, referred to as FinLlama, is trained not only to classify the sentiment valence but also quantify its strength, thus offering traders a nuanced insight into financial news articles. Complementing this, the implementation of parameter-efficient fine-tuning through LoRA optimises trainable parameters, thus minimising computational and memory requirements, without sacrificing accuracy. Simulation results demonstrate the ability of the proposed FinLlama to provide a framework for enhanced portfolio management decisions and increased market returns. These results underpin the ability of FinLlama to construct high-return portfolios which exhibit enhanced resilience, even during volatile periods and unpredictable market events.
Motivation & Objective
- Bridge sentiment signals from financial texts to actionable trading decisions.
- Develop a finance-specific sentiment analyzer using a general-purpose LLM with minimal resources.
- Integrate sentiment outputs into long-short portfolios to evaluate real-world metrics.
- Show that targeted fine-tuning can outperform finance-focused baselines while using limited computational power.
Proposed method
- Fine-tune the Llama 2 7B model on four labeled financial text datasets totaling 34,180 samples with a SoftMax classifier for positive, negative, neutral.
- Apply parameter-efficient fine-tuning (LoRA) to keep trainable parameters around 4.2M (0.0638% of model).
- Use AdamW with small learning rate and regularization (warm-up, weight decay) over 5 epochs.
- Quantize/streamline training to run on a single A100 GPU.
- Evaluate sentiment signals by integrating into a 35% long-short portfolio and compare against FinBERT and lexicon-based methods using real-world metrics.
- Benchmark against five sentiment methods on 417-company universe and 1,672 trading days.
Experimental results
Research questions
- RQ1Can finance-specific sentiment analysis be effectively tailored with LLMs for algorithmic trading?
- RQ2Can parameter-efficient fine-tuning enable finance-tuned LLMs on modest hardware without sacrificing performance?
- RQ3Do sentiment-derived signals from FinLlama improve real-world portfolio metrics compared to existing methods?
Key findings
- FinLlama achieves higher cumulative returns and Sharpe ratio than all considered baselines, including FinBERT.
- FinLlama shows higher annualized return and lower annualized volatility compared with FinBERT and lexicon-based methods.
- Deep learning approaches outperform lexicon-based approaches in cumulative returns, with strongest performance during volatile periods (e.g., early 2020).
- The 35% long-short portfolio using FinLlama yields cumulative returns of 308.2% versus 213.0% (FinBERT) and 83.1% (S&P 500).
- FinLlama achieves a Sharpe ratio of 2.4 and an annualized volatility of 18.6%, outperforming FinBERT (Sharpe 1.5; vol 20.3%).
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.