Harnessing LLM s for Temporal Data - A Study on Explainable Financial Time Series Forecasting (2023)

Abstract: Applying machine learning to financial time series has been an active area of industrial research enabling innovation in market insights, risk management, strategic decision-making, and policy formation. This paper explores the novel use of Large Language Models (LLMs) for explainable financial time series forecasting, addressing challenges in cross-sequence reasoning, multi-modal data integration, and result interpretation that are inherent in traditional approaches. Focusing on NASDAQ-100 stocks, we utilize public historical stock data, company metadata, and economic/financial news. Our experiments employ GPT-4 for zero-shot/few-shot inference and Open LLaMA for instruction-based fine-tuning. The study demonstrates LLMs’ ability to generate well-reasoned decisions by leveraging cross-sequence information and extracting insights from text and price time series. We show that our LLM-based approach outperforms classic ARMA-GARCH and gradient-boosting tree models. Furthermore, fine-tuned public LLMs, such as Open-LLaMA, can generate reasonable and explainable forecasts, although they underperform compared to GPT-4.

## introduction the rapid advancements in machine learning (ml) and artificial intelligence (ai) technologies over the past few years have opened up numerous opportunities and challenges across various domains, including the realm of financial markets @xcite @xcite . in particular, the task of financial time series forecasting, a key element in industrial risk management, market insights, strategic decision-making and policy formation, has witnessed significant technological innovations, from statistical/econometric time series techniques @xcite @xcite , to machine learning techniques @xcite @xcite , to deep learning @xcite @xcite @xcite . despite these advancements, there are several inherent challenges associated with the deployment of ml/ai models in finance. one challenge lies in the realm of crosssequence reasoning and inference, a vital aspect for understanding temporal patterns and making accurate predictions. the current approaches include time-series correlation analysis @xcite @xcite and clustering @xcite @xcite . deep learning has recently been leveraged to learn from the complex latent dependencies among time series @xcite @xcite . despite these advancements, existing methods have yet to effectively capture the intricate dependencies characteristic of time series data. the varying design, implementation, and data requirements of these methods further creates a barrier for their widespread application in the field. another notable hurdle involves handling complex multi-modal financial temporal data that extends beyond numeric sequences. the data may encapsulate diverse sources such as historical news, financial knowledge graphs, social media activities, and various other market indicators. there has been recent effort leveraging statistical inference @xcite , rnn/cnn with text embedding @xcite , graph neural networks @xcite , etc. to integrate the complex information. last but of utmost importance, the issue of interpretability and explainability poses significant challenges to the trustworthiness of machine learning and deep learning models. the majority of existing deep learning models operate as black boxes, offering little insight into their decision-making processes. this lack of transparency sometimes raises concerns about the result reliability and impedes user trust. this is particularly relevant in sensitive fields like finance, where substantial investments and assets are at stake. there is recent study trying to understand deep-learning based predictions through attention scores @xcite , but such insight is still not readily human readable and still requires considerable interpretation effort. the recent advancement of large language models (llms) @xcite @xcite potentially lend us a powerful tool to address all above challenges in a unified, flexible way. first, llms can learn complex relations among sequences. llms are the most powerful transformer-based models, and there has been abundant researches showing transformer-based models capable of learning the underlying complex relations among textual sequences @xcite @xcite @xcite and solving quantitative problems @xcite @xcite . it is reasonable to expect the potential of llms understanding complex dependencies among numeric time series augmented by temporal textual sequences. secondly, llms have demonstrated outstanding reasoning and inference capability over multi-modal data. by design, llms are proficient at learning from a broad spectrum of data sources and types. they are trained on a vast amount of texts from the internet, encompassing a wide range of topics, styles, and formats. this equips them to handle diverse input data, such as numerical, textual, structured data @xcite . this multi-modal data handling capability could be particularly useful for financial forecasting, where crucial information often comes from disparate sources, such as numerical market data, textual news articles, and social media posts. lastly, llms are natural explainers that generate human readable explanations providing insight into a decision. one of the key advantages of llms is their ability to generate natural language text that is coherent, contextual, and comprehensive. this allows them to provide human-readable explanations for their decisions @xcite . furthermore, through chain-of-thoughts (cot) or step-by-step thinking @xcite @xcite , beyond a few sentences of explanation, llms can even generate detailed step-by-step reasoning to reveal the decision-making process. ## related works the field of financial time series forecasting has been a subject of extensive research, with various methodologies being proposed over the years. ## methodology for this paper, we study the nasdaq-100 stock price time series, supplemented by metadata about the stock company and relevant financial news data concerning both the specific stock and the broader financial/economic landscape. our primary focus is on forecasting weekly/monthly stock returns (defined as the percentage change in stock price from the beginning to the end of the week/month) with accompanying explanations foot_0 . we demonstrate our structured design of prompts for llms and apply the state-of-the-art gpt-4 model (openai, 2023b) for zero-shot and few-shot inference tasks. for fine-tuning, we utilize the publicly available open llama @xcite . we also incorporate the technique of chain of thoughts (cot) @xcite , which has been found to enhance the effectiveness of llms in other research studies. ## conclusion in this study, we explored using large language models (llms) to tackle inherent challenges like cross-sequence reasoning, multi-modal signals integration, and result interpretability in financial time series forecasting. in particular, we experimented gpt-4 and open llama for the nasdaq-100 stock return predictions. with structured prompts comprising company profile, historical stock price, and financial news data, llms generated human understandable explanations and forecasts. the performance of these llms surpassed traditional models like arma-garch and gradient-boosting trees, especially when integrating a step-by-step reasoning process based on the chain of thought (cot) approach. furthermore, our fine-tuning experiments highlighted the viability of tuning a publicly available llm to also achieve reasonable performance in comparison to gpt-4. the preliminary results of applying llms in explainable financial forecasting are encouraging. this is the first step to develop a llmbased explainable financial forecast system to assist business decision-making. we envision a future where financial forecasting is not only more precise but also more comprehensible and transparent, thus transforming financial and business decisionmaking across the sector.