The List / Trading, Investment, and Portfolio Management / paper
Large Language Model Adaptation for Financial Sentiment Analysis
Abstract
Natural language processing (NLP) has recently gained relevance within financial institutions by providing highly valuable insights into companies and markets' financial documents. However, the landscape of the financial domain presents extra challenges for NLP, due to the complexity of the texts and the use of specific terminology. Generalist language models tend to fall short in tasks specifically tailored for finance, even when using large language models (LLMs) with great natural language understanding and generative capabilities. This paper presents a study on LLM adaptation methods targeted at the financial domain and with high emphasis on financial sentiment analysis. To this purpose, two foundation models with less than 1.5B parameters have been adapted using a wide range of strategies. We show that through careful fine-tuning on both financial documents and instructions, these foundation models can be adapted to the target domain. Moreover, we observe that small LLMs have comparable performance to larger scale models, while being more efficient in terms of parameters and data. In addition to the models, we show how to generate artificial instructions through LLMs to augment the number of samples of the instruction dataset.
In one sentence
Summary
This paper addresses the challenge of adapting Large Language Models (LLMs) to the financial domain, specifically focusing on financial sentiment analysis. It argues that generalist LLMs often underperform on complex financial texts due to specific terminology and complexity, necessitating domain adaptation. The study aims to show that smaller, more efficient models can achieve competitive performance compared to larger, resource-intensive models like BloombergGPT or GPT-4, thereby lowering the barrier to entry for financial institutions. The research positions itself within the context of existing financial LLMs like FinBERT and FinMA, highlighting the need for efficient, accessible models that maintain high accuracy on financial NLP tasks. The methodology involves adapting two foundation models, Pythia-1.4B and OPT-1.3B, using a two-stage fine-tuning strategy. First, the models undergo further pre-training on a curated dataset of financial documents (EDGAR, Reuters, in-house) mixed with general data (The Pile) to shift their language understanding towards finance. Second, they are fine-tuned on an instruction dataset derived from the FLARE benchmark, which includes tasks like sentiment analysis, named entity recognition (NER), and news headline classification. A key innovation is the use of a larger LLM (LLaMA-2-13B) to generate synthetic instructions and inputs to augment the training data, particularly for tasks with limited samples. The models are evaluated on the FLARE benchmark, comparing their performance against classical ML algorithms, generalist LLMs (GPT-4), and other financial LLMs (BloombergGPT, FinMA). The results indicate that the two-stage adaptation strategy significantly improves model performance. The fine-tuned small models outperform GPT-4 and BloombergGPT on classification tasks such as financial sentiment analysis and headline classification, achieving F1 scores of 0.84-0.86 on the Financial Phrase Bank. They also show competitive performance on NER, though GPT-4 remains superior in generative tasks. The study finds that instruction fine-tuning yields greater improvements than document pre-training alone, and data augmentation enhances performance on sentiment tasks but can slightly degrade performance on others due to distribution shifts. The paper concludes that small, adapted LLMs offer a highly efficient alternative to large-scale models for specific financial tasks, though they lag in generative capabilities and may require further testing on unseen tasks and larger model scales.
Research problem
The paper addresses the difficulty of applying generalist Large Language Models (LLMs) to financial tasks, particularly sentiment analysis, due to the complexity and specific terminology of financial texts. It seeks to determine if smaller, more efficient LLMs can be effectively adapted to the financial domain to match or exceed the performance of larger, resource-intensive models. The study also explores methods for data augmentation to improve instruction fine-tuning for these smaller models.
Core contributions
- Demonstrates that small LLMs (under 1.5B parameters) can outperform larger generalist models like GPT-4 and specialized models like BloombergGPT on financial sentiment analysis and headline classification tasks.
- Proposes a two-stage domain adaptation strategy for LLMs: further pre-training on financial documents followed by instruction fine-tuning, which proves more effective than either stage alone.
- Introduces a method for generating synthetic instructions and inputs using a larger LLM (LLaMA-2-13B) to augment training datasets, improving performance on sentiment analysis tasks.
- Provides a detailed comparison of various LLM adaptation strategies and their impact on multiple financial NLP tasks, including sentiment analysis, NER, and headline classification.
- Highlights the efficiency benefits of using small, adapted LLMs, requiring significantly fewer parameters and training samples than state-of-the-art financial LLMs.
Method
- Further pre-training of foundation models on a mixed dataset of financial and general documents to adapt language understanding.
- Instruction fine-tuning on a curated dataset of financial tasks (sentiment analysis, NER, headline classification) using an instruction-input-answer format.
- Data augmentation strategy using LLaMA-2-13B to generate synthetic inputs and instructions for tasks with limited samples.
- Evaluation on the FLARE benchmark using F1 scores for classification tasks and standard metrics for NER.
- Comparison with baseline models including classical ML algorithms, generalist LLMs (GPT-4), and specialized financial LLMs (BloombergGPT, FinMA).
- Analysis of the impact of different fine-tuning stages and data augmentation on model performance.
Results & findings
- Small LLMs (Pythia-1.4B, OPT-1.3B) outperform GPT-4 and BloombergGPT on financial sentiment analysis (FPB) and headline classification tasks.
- The two-stage adaptation (document pre-training + instruction fine-tuning) yields the best performance across all evaluated tasks.
- Instruction fine-tuning provides greater performance gains than document pre-training alone.
- Data augmentation using LLaMA-2-13B improves sentiment analysis performance but can slightly degrade performance on headline classification and NER.
- The adapted small models achieve comparable or better results than FinMA-7B while using 78% fewer parameters and 43% fewer training instructions.
- GPT-4 remains superior in generative tasks like NER, indicating limitations in the adapted small models for open-ended generation.
- Classical ML algorithms (SVM, XGB) perform competitively with some LLMs on sentiment analysis, but LLMs show better generalization on other tasks.
Data & experiments
- Uses two foundation models: Pythia-1.4B and OPT-1.3B.
- Curates a document dataset combining EDGAR filings, Reuters news, in-house financial text, and The Pile (general data).
- Constructs an instruction dataset based on the FLARE benchmark, including tasks like Financial Phrase Bank (FPB), FIQA-SA, NER, and Headline classification.
- Evaluates models on the FLARE benchmark, comparing performance against classical ML algorithms, GPT-4, BloombergGPT, and FinMA models.
- Tests the impact of different fine-tuning strategies: document pre-training, instruction fine-tuning, and augmented instruction fine-tuning.
- Analyzes the effect of data augmentation on model performance across different tasks.
Limitations & caveats
- The adapted small models lag behind GPT-4 in generative tasks like Named Entity Recognition.
- Performance on unseen tasks is not evaluated, limiting the generalizability of the findings.
- The study focuses on models under 1.5B parameters; results may differ for larger models.
- Data augmentation introduces some noise, potentially degrading performance on certain tasks like headline classification.
- The in-house dataset used for pre-training is private, limiting reproducibility of the exact document mixture.
- The evaluation is limited to a specific set of tasks in the FLARE benchmark; other financial tasks may not be covered.
Curator notes
Discovery status: round4_promoted. Source links: Adaptive Financial Sentiment Analysis for NIFTY 50 via Instruction-Tuned LLMs ,RAG and Reinforcement Learning Approaches; Interpretable LLMs for Credit Risk: A Systematic Review and Taxonomy