deep-over/FiLM

Exploring the Impact of Corpus Diversity on Financial Pretrained Language Models

Python

10

37 commits

updated Aug 20, 2024

See the code

README

Exploring the Impact of Corpus Diversity on Financial Pretrained Language Models

(EMNLP 2023 findings)

Paper: https://aclanthology.org/2023.findings-emnlp.138/

model repository: https://huggingface.co/HYdsl/FiLM

Abstract

Over the past few years, various domain-specific pretrained language models (PLMs) have been proposed and have outperformed general-domain PLMs in specialized areas such as biomedical, scientific, and clinical domains. In addition, financial PLMs have been studied because of the high economic impact of financial data analysis. However, we found that financial PLMs were not pretrained on sufficiently diverse financial data. This lack of diverse training data leads to a subpar generalization performance, resulting in general-purpose PLMs, including BERT, often outperforming financial PLMs on many downstream tasks. To address this issue, we collected a broad range of financial corpus and trained the Financial Language Model (FiLM) on these diverse datasets. Our experimental results confirm that FiLM outperforms not only existing financial PLMs but also general domain PLMs. Furthermore, we provide empirical evidence that this improvement can be achieved even for unseen corpus groups.

FiLM(Financial Language Model) Models 🌟

FiLM is a Pre-trained Language Model (PLM) optimized for the Financial domain, built upon a diverse range of Financial domain corpora. Initialized with the RoBERTa-base model, FiLM undergoes further training to achieve performance that surpasses RoBERTa-base in financial domain for the first time. Our model can be called Fin-RoBERTa (Financial RoBERTa).

To train FiLM, we have categorized our Financial Corpus into specific groups and gathered a diverse range of corpora to ensure optimal performance.

We offer two versions of the FiLM model, each tailored for specific use-cases in the Financial domain:

FiLM (2.4B): Our Base Model

This is our foundational model, trained on the entire range of corpora as outlined in the above Corpus table. Ideal for a wide array of financial applications. 📊

FiLM (5.5B): Optimized for SEC Filings

This model is specialized for handling SEC filings. We expanded the training set by adding 3.1 billion tokens from the SEC filings corpus dataset. The dataset is sourced from EDGAR-CORPUS: Billions of Tokens Make The World Go Round (Loukas et al., ECONLP 2021)

The method to load a tokenizer and a model. For the FiLM model, you can call 'roberta-base' from the tokenizer.

tokenizer = AutoTokenizer.from_pretrained('roberta-base')
model = AutoModel.from_pretrained('HYdsl/FiLM')

Refer to the following documentation for basic code use.

Basic code.md

Types of Training Corpora 📚

GroupdNameDescription# Tokens
NewsTRC2Collection financial news stories from Reuters 227.39 M 
Investing.comStock, options, commodity etc. News article 130.88 M
NYtimesEconomic articles from the New York Times 75.04 M 
EIACommodity related news articles from EIA 1.12 M 
SEC filingsAnnual reports(10-K) and quarterly reports(10-Q) 307.19 M 
Earnings CallEarnings conference call transcripts 1.66 B 
PapersArXivA collection of abstracts of economic research papers 42.18 M
AIHUBA collection of Korean economics research papers 5.89 M 
MISCInvestopediaEconomic glossary 5.33 M 
FinWEBFinance, loans, and insurance related articles 2.86 M 
A total of 10 corpora 2.4 B

Financial tasks performance

ModelFPBNERHeadlineFiNERFinQAFOMC
MetricAccuracyF-1F-1F-1F-1Prog AccExe AccF-1
BERT [Devlin et al., 2019]83.3081.7375.0989.5479.4051.0953.1063.81
RoBERTa-base [Liu et al., 2019b]85.3083.9378.8191.2981.5856.7659.1169.16
Fin-BERT [Araci D et al., 2019]85.2582.4577.9390.4881.4947.8650.0464.50
Fin-BERT [Yang Y et al., 2020]83.6882.5270.4090.8381.0838.7940.5464.30
FLANG-BERT [Shah et al., 2022] 84.7683.1275.5891.0681.5349.1751.4464.93
FLANG-RoBERTa [Shah et al., 2022]83.8682.1871.3690.4680.7830.6932.1768.02
SEC-BERT-base [Loukas L et al., 2022]84.3782.1878.7490.5282.3553.1855.4565.06
FiLM [ours]86.2584.4879.7891.7982.0258.8561.3869.60
FiLM (5.5B) [ours]86.1484.1178.8291.7482.3959.3761.6469.16

Information from financial tasks

NameTaskTrain sizeValid sizeTest sizeMetric
FPB [1]Sentiment classification3,391 726 726Accuracy & F-1
NER [2]Named entity recognition932232302F-1
Headline [3]News headlines classification7,9891,1412,282F-1
FiNER [4]Numeric entity recognition900,384112,494108,378F-1
FinQA [5]Question answering6,2518831,147Accuracy(Prog & Exe)
FOMC [6]Sentiment classification1,588396496F-1 (Combined-S)

For information on the task, refer to the FLUE benchmark. We follow Benchmark too.

[1] https://huggingface.co/datasets/financial_phrasebank

[2] https://huggingface.co/datasets/tner/fin

[3] https://www.kaggle.com/datasets/ankurzing/sentiment-analysis-in-commodity-market-gold/data

[4] https://github.com/nlpaueb/finer

[5] https://github.com/czyssrs/FinQA

[6] https://github.com/gtfintechlab/fomc-hawkish-dovish

deep-over/FiLM

Exploring the Impact of Corpus Diversity on Financial Pretrained Language Models

Python

10

37 commits

updated Aug 20, 2024

See the code

README

Exploring the Impact of Corpus Diversity on Financial Pretrained Language Models

(EMNLP 2023 findings)

Paper: https://aclanthology.org/2023.findings-emnlp.138/

model repository: https://huggingface.co/HYdsl/FiLM

Abstract

Over the past few years, various domain-specific pretrained language models (PLMs) have been proposed and have outperformed general-domain PLMs in specialized areas such as biomedical, scientific, and clinical domains. In addition, financial PLMs have been studied because of the high economic impact of financial data analysis. However, we found that financial PLMs were not pretrained on sufficiently diverse financial data. This lack of diverse training data leads to a subpar generalization performance, resulting in general-purpose PLMs, including BERT, often outperforming financial PLMs on many downstream tasks. To address this issue, we collected a broad range of financial corpus and trained the Financial Language Model (FiLM) on these diverse datasets. Our experimental results confirm that FiLM outperforms not only existing financial PLMs but also general domain PLMs. Furthermore, we provide empirical evidence that this improvement can be achieved even for unseen corpus groups.

FiLM(Financial Language Model) Models 🌟

FiLM is a Pre-trained Language Model (PLM) optimized for the Financial domain, built upon a diverse range of Financial domain corpora. Initialized with the RoBERTa-base model, FiLM undergoes further training to achieve performance that surpasses RoBERTa-base in financial domain for the first time. Our model can be called Fin-RoBERTa (Financial RoBERTa).

To train FiLM, we have categorized our Financial Corpus into specific groups and gathered a diverse range of corpora to ensure optimal performance.

We offer two versions of the FiLM model, each tailored for specific use-cases in the Financial domain:

FiLM (2.4B): Our Base Model

This is our foundational model, trained on the entire range of corpora as outlined in the above Corpus table. Ideal for a wide array of financial applications. 📊

FiLM (5.5B): Optimized for SEC Filings

This model is specialized for handling SEC filings. We expanded the training set by adding 3.1 billion tokens from the SEC filings corpus dataset. The dataset is sourced from EDGAR-CORPUS: Billions of Tokens Make The World Go Round (Loukas et al., ECONLP 2021)

The method to load a tokenizer and a model. For the FiLM model, you can call 'roberta-base' from the tokenizer.

tokenizer = AutoTokenizer.from_pretrained('roberta-base')
model = AutoModel.from_pretrained('HYdsl/FiLM')

Refer to the following documentation for basic code use.

Basic code.md

Types of Training Corpora 📚

GroupdNameDescription# Tokens
NewsTRC2Collection financial news stories from Reuters 227.39 M 
Investing.comStock, options, commodity etc. News article 130.88 M
NYtimesEconomic articles from the New York Times 75.04 M 
EIACommodity related news articles from EIA 1.12 M 
SEC filingsAnnual reports(10-K) and quarterly reports(10-Q) 307.19 M 
Earnings CallEarnings conference call transcripts 1.66 B 
PapersArXivA collection of abstracts of economic research papers 42.18 M
AIHUBA collection of Korean economics research papers 5.89 M 
MISCInvestopediaEconomic glossary 5.33 M 
FinWEBFinance, loans, and insurance related articles 2.86 M 
A total of 10 corpora 2.4 B

Financial tasks performance

ModelFPBNERHeadlineFiNERFinQAFOMC
MetricAccuracyF-1F-1F-1F-1Prog AccExe AccF-1
BERT [Devlin et al., 2019]83.3081.7375.0989.5479.4051.0953.1063.81
RoBERTa-base [Liu et al., 2019b]85.3083.9378.8191.2981.5856.7659.1169.16
Fin-BERT [Araci D et al., 2019]85.2582.4577.9390.4881.4947.8650.0464.50
Fin-BERT [Yang Y et al., 2020]83.6882.5270.4090.8381.0838.7940.5464.30
FLANG-BERT [Shah et al., 2022] 84.7683.1275.5891.0681.5349.1751.4464.93
FLANG-RoBERTa [Shah et al., 2022]83.8682.1871.3690.4680.7830.6932.1768.02
SEC-BERT-base [Loukas L et al., 2022]84.3782.1878.7490.5282.3553.1855.4565.06
FiLM [ours]86.2584.4879.7891.7982.0258.8561.3869.60
FiLM (5.5B) [ours]86.1484.1178.8291.7482.3959.3761.6469.16

Information from financial tasks

NameTaskTrain sizeValid sizeTest sizeMetric
FPB [1]Sentiment classification3,391 726 726Accuracy & F-1
NER [2]Named entity recognition932232302F-1
Headline [3]News headlines classification7,9891,1412,282F-1
FiNER [4]Numeric entity recognition900,384112,494108,378F-1
FinQA [5]Question answering6,2518831,147Accuracy(Prog & Exe)
FOMC [6]Sentiment classification1,588396496F-1 (Combined-S)

For information on the task, refer to the FLUE benchmark. We follow Benchmark too.

[1] https://huggingface.co/datasets/financial_phrasebank

[2] https://huggingface.co/datasets/tner/fin

[3] https://www.kaggle.com/datasets/ankurzing/sentiment-analysis-in-commodity-market-gold/data

[4] https://github.com/nlpaueb/finer

[5] https://github.com/czyssrs/FinQA

[6] https://github.com/gtfintechlab/fomc-hawkish-dovish