Table of Contents
Fetching ...

FinLlama: Financial Sentiment Classification for Algorithmic Trading Applications

Thanos Konstantinidis, Giorgos Iacovides, Mingxue Xu, Tony G. Constantinides, Danilo Mandic

TL;DR

The paper tackles finance-specific sentiment analysis for algorithmic trading by fine-tuning a lightweight LLM, FinLlama, on public financial news data. It uses LoRA-based parameter-efficient fine-tuning of Llama 2 7B to produce both sentiment valence and strength, enabling nuanced signals for portfolio decisions. A long-short portfolio framework with finance-oriented metrics demonstrates that FinLlama outperforms FinBERT in cumulative returns and Sharpe ratio while reducing volatility. This work offers a practical, resource-efficient path to integrating LLM-based sentiment into quantitative trading pipelines and sets a new benchmark for finance-focused sentiment analysis.

Abstract

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.

FinLlama: Financial Sentiment Classification for Algorithmic Trading Applications

TL;DR

The paper tackles finance-specific sentiment analysis for algorithmic trading by fine-tuning a lightweight LLM, FinLlama, on public financial news data. It uses LoRA-based parameter-efficient fine-tuning of Llama 2 7B to produce both sentiment valence and strength, enabling nuanced signals for portfolio decisions. A long-short portfolio framework with finance-oriented metrics demonstrates that FinLlama outperforms FinBERT in cumulative returns and Sharpe ratio while reducing volatility. This work offers a practical, resource-efficient path to integrating LLM-based sentiment into quantitative trading pipelines and sets a new benchmark for finance-focused sentiment analysis.

Abstract

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.
Paper Structure (16 sections, 5 equations, 3 figures, 1 table)

This paper contains 16 sections, 5 equations, 3 figures, 1 table.

Figures (3)

  • Figure 1: Overview of sentiment analysis methods.
  • Figure 2: Framework for sentiment analysis.
  • Figure 3: Comparison of performance of the 35% long-short portfolios which were constructed using the five sentiment analysis methods, for the time period of February 2015 to June 2021. MA(30) and MSTD(30) represent the moving average and moving standard deviation, respectively, of the returns calculated over a 30-day rolling window.