Source-linked AI summary

Fine-tuning and Utilization Methods of Domain-specific LLMs

Cheonsu Jeong

arXiv:2401.02981v2cs.CLcs.AI

TL;DR

Research on fine-tuning and using domain-specific LLMs remains limited, including for financial tasks. This study outlines a finance-focused fine-tuning workflow and applications, reports step-by-step validation, and identifies dataset-diversity and generalization limitations.

  • Problem

    Research comprehensively addressing issues in constructing and using task-specific LLMs remains limited, including for finance.

    Source: §1 · p. 2
  • Method

    The study outlines finance-specific dataset preparation, model selection, hyperparameter tuning, fine-tuning, and validation, alongside financial applications.

    Source: §3 · p. 11, §5 · p. 29
  • Results

    The study reports step-by-step validation of the finance-domain dataset, preprocessing, model selection, tuning, execution setup, evaluation metrics, and model generation procedures.

    Source: §5 · p. 29
  • Takeaways & Limitations

    The authors conclude that enterprises should actively use LLMs in financial services, while identifying specialized finance research as a basis for future advances.

    Source: §5 · p. 30

    The study focuses primarily on fine-tuning methodology, and limited dataset diversity may bias models toward specific domains; generalization may require further tuning or structural optimization.

    Source: §5 · pp. 29–30

Abstract

from arXiv · show

Recent releases of pre-trained Large Language Models (LLMs) have gained considerable traction, yet research on fine-tuning and employing domain-specific LLMs remains scarce. This study investigates approaches for fine-tuning and leveraging domain-specific LLMs, highlighting trends in LLMs, foundational models, and methods for domain-specific pre-training. Focusing on the financial sector, it details dataset selection, preprocessing, model choice, and considerations crucial for LLM fine-tuning in finance. Addressing the unique characteristics of financial data, the study explores the construction of domain-specific vocabularies and considerations for security and regulatory compliance. In the practical application of LLM fine-tuning, the study outlines the procedure and implementation for generating domain-specific LLMs in finance. Various financial cases, including stock price prediction, sentiment analysis of financial news, automated document processing, research, information extraction, and customer service enhancement, are exemplified. The study explores the potential of LLMs in the financial domain, identifies limitations, and proposes directions for improvement, contributing valuable insights for future research. Ultimately, it advances natural language processing technology in business, suggesting proactive LLM utilization in financial services across industries.

1. Introduction

This study examines how to fine-tune and use domain-specific LLMs in finance, where research addressing construction and utilization issues remains limited. It outlines methods and financial use cases while noting the study’s scope limits.

1. Introduction

  • In-depth research on the construction and use of task-specific LLMs remains limited despite active releases of general LLMs.The study frames this gap against finance’s rapidly changing markets, diverse events, and large volumes of data.Source: §1 · p. 2
  • The study aims to develop methods for fine-tuning finance-specific LLMs and examine their use in real-world financial tasks.It presents the work as addressing financial data characteristics and applications of domain-specific models.Source: §1 · pp. 2–3
  • Its coverage does not extend to every financial subfield, and the interpretation of results accounts for language-model limitations and constraints.Source: §1 · p. 3
  • The paper covers LLMs and fine-tuning, finance-focused model creation and applications, then concludes with future directions.Source: §1 · p. 3

2. Related Work

The related work reviews LLM foundations and trends, domain-specific pre-training, and fine-tuning approaches. It describes parameter-efficient methods as alternatives for adapting large models and discusses instruction tuning.

2.1. Overview of Large Language Models (LLMs)

  • LLMs such as BERT and GPT use Transformer-based pre-training, while chatbots raise prompt, privacy, and information-freshness considerations.The review describes retrieval-augmented generation as retrieving information from vector databases for LLM responses.Source: §2.1 · pp. 3–4

2.1.1. Trends in Generative AI

  • GPT-4 was unveiled in March and PaLM2 introduced in May; both had reduced parameter counts versus previous models yet achieved higher performance by training on approximately five times more tokens.Interest in open-source LLMs such as Meta’s LLaMA and Falcon focused on training volume rather than model size (Jeong C.S., 2023e).Source: §2.1.1 · p. 6

2.1.2. Foundation Model and LLM Pre-training

  • Foundation models can train on multimodal data and be adapted to downstream tasks; LLM pre-training commonly uses general corpora, with specialized corpora also studied.The review notes that training from scratch requires substantial computational power, making fine-tuning existing models a more economical alternative.Source: §2.1.2 · pp. 6–7

2.1.3. Domain-Specific LLM Pre-training

  • Domain-specific pre-training selects a target domain, gathers relevant data, injects it into a general LLM, and trains a conversational model for that domain.The review lists domain uniqueness, at least 10,000 characters of descriptive text, and checking existing learning status among selection criteria.Source: §2.1.3 · pp. 7–8

2.2. LLM Fine-Tuning

  • Fine-tuning adapts broadly trained LLMs to specific tasks, while PEFT updates added parameters rather than the full pre-trained model.The review presents this as a lower-cost approach for large models whose full fine-tuning is computationally challenging.Source: §2.2 · p. 8

2.2.1. Recent Advances in Fine-Tuning

  • LoRA adapts selected weight matrices through low-rank decomposition, while adapter methods add modular parameters and keep the pre-trained LLM frozen.Source: §2.2 · p. 9, §2.2.1 · p. 10
  • QLoRA quantizes 16-bit network nodes to 4 bits and uses paging to test large models with limited memory, accepting some information loss.Source: §2.2.1 · p. 10
  • Instruction tuning trains LLMs to follow natural-language task instructions, with Alpaca given as an example based on LLaMA 7B.Source: §2.2.1 · p. 11

3. Methods

The methods section presents a systematic workflow for finance-specialized LLM creation, from data preparation and model selection through fine-tuning and evaluation.

3. Methods

  • The proposed workflow selects finance-specific datasets, preprocesses them, chooses a pre-trained model, and tunes hyperparameters for fine-tuning.Finance-specific considerations include financial data characteristics, domain vocabulary, and fine-tuning algorithms.Source: §3 · p. 11
  • The methods also cover training models from scratch and tuning existing models, with quantitative and qualitative criteria for evaluation.Source: §3 · p. 11

3.1. Data Collection and Preprocessing

Finance-specific dataset selection considers data form, quantity, and quality, using existing sources or custom collections. Preprocessing methods address text, code, and image data.

3.1.1. Selection of Finance-Specific Datasets

  • Finance datasets may include text, code, images, or audio; selection weighs intended use, data quantity, quality, and use of existing or custom datasets.Sources include financial news, documents, and code; custom collection may use web scraping or database queries and should remove errors or biases.Source: §3.1.1 · pp. 12–13

3.1.2. Data Preprocessing Methods

  • Preprocessing covers text normalization, tokenization, stop-word removal, and vocabulary building, alongside code cleanup and structure analysis and image normalization and feature extraction.The paper states that these steps help finance models better comprehend financial-product nuances.Source: §3.1.2 · pp. 13–14

3.2. Model Selection and LLM Fine-Tuning Process

The section outlines selecting a pre-trained model and fine-tuning it for finance, then describes hyperparameter and execution-environment considerations for training.

3.2.1. Selection of Pre-trained LLM Model

  • Model choice should fit financial terminology, training-data characteristics, performance needs, intended tasks, and availability.The section names GPT-4, BERT, LLaMA2, Falcon, BloombergGPT, and FinBERT as options, including finance-specialized models and open-source alternatives.Source: §3.2.1 · pp. 14–16

3.2.2. Hyperparameter Tuning for LLM

  • Hyperparameter tuning iteratively tests settings and refines them based on performance changes to find an effective learning configuration, including choices of initial learning rate, batch size, and number of epochs.Examples given are an initial learning rate of 0.0001, batch size 32 or 64, and 10 or 20 epochs; too many epochs could increase overfitting risk.Source: §3.2.2 · pp. 16–17

3.2.3. Fine-Tuning Execution Environment Setup

  • Execution setup combines suitable computing hardware, GPU or TPU acceleration, distributed training, and performance monitoring.The section also recommends augmentation and hyperparameter-search tools, with regular optimization based on experiment results.Source: §3.2.3 · pp. 17–18

3.3. Considerations for Fine-Tuning Financial Specialized LLM

The section describes finance-specific fine-tuning considerations spanning financial data characteristics, algorithm choices, and security and regulatory compliance.

3.3.1. Building Domain-Specific Vocabulary Considering Financial Data Characteristics

  • Financial vocabulary and processing should account for terminology, numerical values, and complex rules and patterns in financial data.Examples include stock-price and exchange-rate language, numerical indices and rates, and statements such as “KOSPI index at 2,300.”Source: §3.3.1 · pp. 18–19

3.3.2. Applying Fine-Tuning Algorithms

  • The section identifies LSTM for time-series data, attention for focusing on input portions, and specialized financial algorithms for task adaptation.It connects LSTM with predictions based on historical data, attention with emphasizing events or news, and examples of specialized methods with risk management and option valuation.Source: §3.3.2 · p. 19

3.3.3. Security and Regulatory Compliance

  • Fine-tuning should account for data security, personal-data protection, and compliance with applicable financial regulations.The section names encryption, access controls, and backup measures, and cites the Electronic Financial Transactions Act and Foreign Exchange Transactions Act.Source: §3.3.3 · pp. 19–20
  • The section states that addressing these considerations can support accuracy and utility for financial tasks, including prediction, research, and report generation.It qualifies this use as secure and compliant.Source: §3.3.3 · p. 20

3.4. Configuration of LLM for the Financial Specific Domain

The section reviews finance-domain LLMs created through pre-training from scratch or fine-tuning, and describes their reported uses and performance.

3.4.1. LLM Pre-trained for Finance from Scratch

  • Finance-pre-trained models discussed include Fin-T5, BloombergGPT, and FinBERT, with reported applications in financial tasks.The passage reports Fin-T5 was trained on 80 billion finance tokens; BloombergGPT is described as using finance and public tokens and targeting NER and sentiment analysis.Source: §3.4.1 · pp. 20–21

3.4.2. LLM Fine-Tuned for Financial Specific Domain

  • The section presents FinGPT and Fin-LLaMA as finance-specific fine-tuned models and describes their bases, training approaches, and reported task performance.FinGPT is described as using 50,000 samples with LoRA; Fin-LLaMA as instruction-fine-tuned on 16,900 samples.Source: §3.4.2 · p. 21

3.5. Evaluation Criteria and Metrics

The section identifies quantitative and qualitative criteria for assessing financial-specialized LLM performance.

3.5. Evaluation Criteria and Metrics

  • Quantitative assessment uses accuracy, precision, recall, and F1 score to measure performance on specific financial tasks.The section also notes that evaluation criteria and metrics are important for qualitative assessment.Source: §3.5 · p. 21

<Table 3> Evaluation Criteria and Metrics for Financial-Specialized Language Models

Financial-specialized language models are assessed with quantitative measures, task-specific criteria, and expert judgment. The criteria cover predictive and text-generation performance as well as financial context, terminology, and unusual scenarios.

Financial-task criteria

  • Financial prediction accuracy and sentiment analysis accuracy assess predictions and sentiment classifications in financial text.The criteria include stock-price or financial-event forecasting and positive-versus-negative sentiment classification.Source: <Table 3> Evaluation Criteria and… · p. 22

Quantitative metrics

  • Recall measures detection of actual positive instances, while F1 Score balances precision and recall.These quantitative measures are among the metrics used to assess task performance.Source: <Table 3> Evaluation Criteria and… · p. 22

Domain-specific criteria

  • Context Understanding and Domain-specific Terminology Usage assess comprehension of financial context and correct use of specialized terms.Terminology use indicates how well the model has learned domain nuances.Source: <Table 3> Evaluation Criteria and… · p. 22

Text and scenario criteria

  • Text Coherence and Adaptability to Unusual Scenarios assess generated-text consistency and responses to unexpected financial situations.The paper notes that financial markets are dynamic and unpredictable.Source: <Table 3> Evaluation Criteria and… · p. 22

Generation and qualitative evaluation

  • BLEU and ROUGE assess text generation, while expert assessments and domain-specific metrics evaluate practicality and fit to financial requirements.The paper also lists sentence-generation accuracy and domain-specific evaluation among its criteria.Source: <Table 3> Evaluation Criteria and… · p. 22

Evaluation approach

  • The paper proposes combining quantitative and qualitative measures to identify strengths and weaknesses and guide model improvement.Table 3 presents example criteria and metrics for assessing financial-specialized language models.Source: <Table 3> Evaluation Criteria and… · p. 23

4. Fine-tuning Implementation and Utilization Research

The study demonstrates a finance-focused fine-tuning workflow, from preparing a question-answer dataset and selecting a pretrained model through training and testing. Its verification example contrasts a generic pretrained answer with a stock-related answer from the fine-tuned model.

4. Fine-tuning Implementation and Utilization Research

  • The study presents implementation and application of fine-tuning as a way to explore financial LLMs' potential to support decision-making and operational efficiency.The chapter builds on the techniques introduced for creating domain-specific models.Source: §4 · p. 23

4.1.1. Data Collection and Preprocessing

  • FinancialStockTerms_Eng is a preprocessed CSV dataset of financial question-answer pairs used for fine-tuning.The study says either a proprietary dataset or open datasets can be used; Figures 9 and 10 show dataset preparation and loading.Source: §4.1.1 · pp. 23–24

4.1.2. Selection of Pretrained Language Model (PLM)

  • The implementation selects the open-source Falcon 7B pretrained language model based on its availability for research and commercialization.Quantization information is stored with BitsAndBytesConfig during model loading.Source: §4.1.2 · p. 24

4.1.3. Hyperparameter Configuration and Fine-Tuning Training

  • The training workflow configures QLoRA with LoraConfig to obtain a PEFT model, then trains the pretrained model on additional datasets to produce a fine-tuned language model.Figures 12 and 13 show hyperparameter configuration and training execution.Source: §4.1.3 · pp. 25–26

4.1.4. FLM Verification

  • For the Index question, the pretrained model gives a website-related answer, whereas the PEFT fine-tuned model gives a stock-related answer.The study uses this contrast to validate domain-specific fine-tuning and notes that models can be tailored to specific tasks.Source: §4.1.4 · p. 27

4.2. Application Fields and Cases of Financial LLM

The paper describes financial LLM applications spanning prediction and trading, document processing, research and information extraction, and customer service. It presents these uses as ways to automate tasks and support decision-making in finance.

4.2.1. Financial Prediction and Trading

  • LLMs can analyze financial news, corporate reports, and market trends for stock-movement forecasts, while news sentiment can inform strategic trading decisions.The cited example is a ChatGPT service summarizing stock-market conditions.Source: §4.2.1 · pp. 27–28

4.2.2. Automated Financial Document Processing

  • LLMs can analyze contracts and assist with financial-report generation by extracting essential information and summarizing material for experts.The paper cites AI-based insurance-claim processing and JPMorgan's COiN contract analysis as examples.Source: §4.2.2 · p. 28

4.2.3. Financial Research and Information Extraction

  • LLMs can collect and synthesize financial data for research and extract information used in financial research or customer-aligned product recommendations.Examples include an AI-based research service and AI analysis of relational data to detect insurance fraud.Source: §4.2.3 · p. 28

4.2.4. Customer Interaction and Service Enhancement

  • LLM-based response systems and personalized recommendations are described as improving customer-service quality, while financial applications can automate tasks and support decisions.Examples include conversational event information, in-app GPT interactions, and automated customer-satisfaction survey analysis.Source: §4.2.4 · pp. 28–29

5. Discussion and Conclusion

The study presents a stepwise finance-focused fine-tuning workflow and discusses applications across financial tasks. It identifies dataset diversity and financial-domain knowledge as limitations, while calling for broader ethical consideration and future applications.

Discussion and Conclusion

  • The study provides step-by-step validation of finance-specific dataset selection, preprocessing, model selection, tuning, execution setup, evaluation, and model generation.It also explores applications in prediction, automation, research, and customer interaction.Source: §5 · p. 29
  • The study discusses prediction accuracy, workflow efficiency, research support, and customer service as areas of potential benefit from financial LLMs.Examples include faster contract analysis and report generation and information extraction for research reports.Source: §5 · p. 29
  • The study focuses primarily on fine-tuning methodology, and limited dataset diversity may bias the model toward specific domains.The authors call for more extensive and representative datasets and further tuning or network-structure optimization to address generalization limitations.Source: §5 · p. 29
  • The authors identify improved ways to convey financial-domain knowledge as a direction for addressing its absence in the model.They also propose exploring broader financial tasks and other domains, including manufacturing and public services.Source: §5 · p. 30
  • The study says ethical considerations were not covered and calls for attention to personal-data protection and fair decision-making in financial research involving sensitive information.The conclusion presents the work as a foundation for specialized domain research and further financial-services applications.Source: §5 · p. 30
Loading 2401.02981v2…