Buy Tesla, Sell Ford: Assessing Implicit Stock Market Preference in Pre-trained Language Models (2022)

Abstract: Pretrained language models such as BERT have achieved remarkable success in several NLP tasks. With the wide adoption of BERT in real-world applications, researchers begin to investigate the implicit biases encoded in the BERT. In this paper, we assess the implicit stock market preferences in BERT and its finance domain-specific model FinBERT. We find some interesting patterns. For example, the language models are overall more positive towards the stock market, but there are significant differences in preferences between a pair of industry sectors, or even within a sector. Given the prevalence of NLP models in financial decision making systems, this work raises the awareness of their potential implicit preferences in the stock markets. Awareness of such problems can help practitioners improve robustness and accountability of their financial NLP pipelines .

## introduction pre-trained language models (plm) have achieved superior performance on many nlp tasks @xcite @xcite . they have also been integrated into real-world nlp systems for automated decision-making. recently, a burgeoning body of literature has studied the human-like bias encoded in the plms. for example, in the mask token prediction task, bert fill-in the [mask] in the sentence "he/she works as a [mask]" with "doctor/nurse", reflecting gender stereotype biased associations @xcite . such biases in the plms may further propagate to downstream applications with unintended societal and economic impact. in this work, we investigate and assess the implicit preference encoded in the plms, in the context of the financial market. we examine if the plms prefer one company over the other companies. we also examine if such implicit preference sentence bert tesla stock share is going to float. ford stock share is going to collapse. finbert tesla stock share is going to increase. ford stock share is going to decrease. in individual stocks also manifests at the industry sector level. our core idea is based on the assumption that an nlp system designed to be widely applicable should ideally produce scores that are independent of the identities of name entities mentioned in the text @xcite . we quantitatively assess the implicit preferences in the plms, using a sample of nearly 3,000 major u.s. market stocks. our analysis reveals that the language models are overall more positive towards the stock market, but there are significant differences in preferences between a pair of industry sectors, or even within a sector. given the wide adoption of plms in the financial applications, we hope our work raises awareness of their potential stock market implicit preferences of company names. moreover, care needs to be taken to ensure that the unintended preference does not affect downstream applications. awareness of such matters can help practitioners to build more robust and accountable financial nlp systems. plm: we choose two bert-based pre-trained language models in our analysis: bert and finbert. bert is one of the most widely used plms that is trained on wikipedia and bookcorpus @xcite . in addition to bert, we choose fin-bert, which is a domain-specific bert model that is pre-trained on financial communications text, including annual reports, analyst reports, and earnings conference call transcripts @xcite . the vocabulary of finbert is different from the bert model as it contains finance-domain specific terms, including company names. it has shown to outperform the general-domain bert @xcite on financial downstream tasks. we load both base-uncased bert and finbert from the transformers library @xcite . ## assessing implicit preference in masked token prediction since bert and finbert use a masked language modeling objective, we directly probe the model using the masked token prediction task, using clozestyle prompts. prior work also uses this approach to assess the social biases @xcite , or the knowledge learned by plms @xcite . for each firm, we create a simple tem-plate containing the attribute word for which we want to measure the preference (e.g. buy or sell) and the company name as the target word (e.g., microsoft). we then mask the attribute words and target words accordingly, to get the conditional probability of producing the buy or sell token. specifically, for firm i, we use the template sentence "we should [mask] the {name} stock" and query the probability of masked token: p i,@xmath0, and p i,@xmath1. we then normalize the two conditional probabilities. ## assessing implicit preferences within an industry sector the masked token prediction is only one way of probing the plms. recent nlp literature has proposed the word association tests to measure the human-like biases in the static word embedding @xcite or contextualized word embedding @xcite . the word association test in the contextualized embedding model is called sentence encoder association test (seat). essentially, seat evaluates whether the contextualized representations for words from an attribute word set tend to be more closely associated with the contextualized representations for words from a target word set. templates such as "this is a [word]" are used to obtain the word contextualized representations. in this work, we create a template sentence "{name} is a stock" where {name} is a stock's company name, and we obtain the [cls] embedding as its embedding. for preference words buy and sell, we create a template "we should buy/sell a stock", and we obtain the [cls] embedding as its embedding. let sim i,buy and sim i,sell be the cosine similarity between the embedding of company i's name and the embedding of buy/sell. given an industry sector s containing a set of stocks, we calculate the seat association effect-size as: @xmath2,buy )-mean @xmath3,sell ) ## conclusion in this paper, we study the implicit stock market preference in plms. motivated by recent literature in implicit social bias, we apply the masked token prediction and sentence embedding association test (seat) to the plms. we find that there is a consistent implicit preference of the stock market in the plms, and the preferences exist at the wholemarket, between-industry,and within-industry level. given the wide adoption of plms in real-world financial systems, we hope that this work raises the awareness of potential implicit stock preferences, so that practitioners and researchers can build more robust and accountable financial nlp systems. future work can investigate whether the implicit preferences are driven by some financial factors such as market value or stock returns, and examine how the preferences over stocks/industries in plms affect downstream financial nlp applications, such as sentiment analysis, or stock movement prediction.