https://github.com/yw4401/FinBot/assets/54665534/8e59fa43-9706-4af5-8bb3-4c6c8998292b
FinBot is an AI driven web application capable of analyzing financially related news articles and providing insights to retail investors. The application can empower the users to make better investment decisions while saving time and money by leveraging the power of LLM retrieval augmented generation.
The modern retail investor faces a dilemma—a scarcity of time to delve into extensive research while needing to stay updated with the dynamic opportunities in the market. The pace of change in investment landscapes demands continuous vigilance, making it challenging for individuals to keep pace with market shifts and opportunities.
Traditional financial advisory services often come with steep costs, sometimes ranging into hundreds of dollars per hour. This financial barrier restricts access to expert guidance and tailored advice, especially for smaller investors or those looking for cost-effective solutions.
The market reflects consistent growth in assets under management, showcasing a compound annual growth rate of around 9%. This expansion indicates an increasing interest and engagement in investing but also amplifies the need for accessible and scalable advisory solutions.
As a retail investor with a diverse set of interests, there are many challenges to overcome in accomplishing investment goals.
While retail investors can be capable of understanding the big picture, they generally do not have the time nor the exposure to conduct comprehensive research to make specific investment decisions. For instance, when COVID hit, it can be apparent that companies related to making remote work possible would be benefited from the situation. However, in addition to the consumer facing products such as Zoom, the products further upstream such as various cloud hosting services, data center properties, and chip manufacturers also experienced a boost in demand. However, for the retail investors, unless the area happens to fall into their expertise, such information may be an unknown unknown to them.
Investment opportunities are time-dependent and require up-to-date information. But, staying up-to-date while life happens require constant effort. Suppose that an investor is interested in pharmaceutical sector, but making informed decision regarding the pharmaceutical industry would potentially entail keeping track of the development and approval process of treatment procedures. But, not everyone has the time or energy to scan through news and documents on medical procedures after a long day at work and taking care of family matters.
Generic ETFs and mutual funds are common solutions employed by retail investors to get a decent return without having expert knowledge. Thus, the asset managers or index tracking algorithms are making decisions on behalf of a large number of retail investors. In recent years, the growth of ESG suggests that investors may have additional interests, such as delivering social impact, by means of their investment. In addition, getting financial advice can be costly, and the interest of the hired advisor may not truly be aligned with the interest of the investor.
The aim of the project is to alleviate those pain-points by reducing the information asymmetry that leads to less efficient investment choices by retail investors compared to a dedicated advisor or asset manager. Utilizing the power of AI, we provide our users the power to quickly digest facts and insights from the vast collection of publically available financial news articles
Given any question about business news or developments in a time frame, FinBot can help user to get the information they need quickly.
For each question, FinBot helps user to expand their view by summarizing key-points from different topics related to their inquiry.
FinBot automatically extracts relevant companies for each query, and present selected KPIs to the users. The users would be able to learn about different companies at a glance.
In order to accomplish the goal of the project, the features can be seen as retrieval augmented generation problems. While LLMs may encode prior knowledge from pre-training, it is difficult to control and to ensure the correctness of the output. In addition, the prior knowledge of the model stops at the date when the pre-training stopped. Thus, for the purpose of assisting the users with market research and advice, the approach taken was to create an envelope around LLMs, feed the LLMs data required to perform tasks pretaining to the features, and make use of the domain knowledge and reasoning ability of the LLMs to create the outputs for the users.
Our work to implement the process can be roughly divided into four main parts:
The data collection pipeline collects and aggregate news articles. Then, it applies a series of NLP techniques including co-reference resolution, topic modeling, text embedding, NER, and Min-Hash to augment the articles. Finally, it prepares the articles for output generation by chunking the article texts and indexing the chunks.
Once the indices are built, the solution is ready to generate informative output for the users.
The final output to the user consists of three main segments:
The algorithms for handling output is located in the summarizer directory.
In addition to creating envelops around LLMs, we customized the pre-trained models for our solution:
In order to fulfill the modeling requirements, we conducted an initial evaluation of pre-trained models to determine the best one to fine-tune (if needed). Next, we fine-tuned the models gathered data to improve the performance and to get the desired output format. Then, we evaluated the fine-tuned models on a separate test dataset to determine if the tuned models meet our ends. Finally, the fine-tuned models are deployed on GCP to serve our clients.
The ember-v1 model is used as a base for creating the embeddings for retrieval. The ember-v1 model is the best non-instructed tuned embedding model for retrieval task on the HuggingFace MTEB Leaderboard. Thus, we have determined that it would achieve a good balance of performance and simplicity to start our fine-tuning.
In order to align the generated embeddings with financially related queries and text, we sourced and augmented the FIQA dataset, which contains questions and answer paragraph pairs on financially related subjects. Since the original FIQA dataset was created by scraping questions asked on forums such as stackexchange and reddit, we augmented the train, eval, and test split of the dataset separately by prompting PaLM2 chat-bison to re-write the answer paragraph in a formal way adhering to the convention of news and/or reports.
The training setup can be described as a way to minimize the distance between the embedding vectors between the question and associated answer candidates without making all the embeddings similar to each other. The loss function used is identical to the Multiple Negatives loss described in Efficient Natural Language Response Suggestion for Smart Reply.
The fine-tuning followed a standard train-eval loop for 10 epochs on the FIQA train/eval splits. The default hyper-parameters from sentence transformers were applied. After running through the 10 epochs, checkpoint with the best max(MAP@2, MAP@3) score was selected. In this case, the first epoch resulted in the best performing model.
Since for our purposes, we would only retrieve the top 2-3 chunks given the constraints on the context window, we evaluated the model performance with K = 2 and K = 2. The following metrics were computed on the test set from FIQA.
| K/Metrics | Accuracy@K | Precision@K | Recall@K | NDCG@K | MRR@K | MAP@K |
|---|---|---|---|---|---|---|
| 2 | 0.76 | 0.67 | 0.36 | 0.68 | 0.73 | 0.66 |
| 3 | 0.81 | 0.58 | 0.44 | 0.66 | 0.74 | 0.62 |
| K/Metrics | Accuracy@K | Precision@K | Recall@K | NDCG@K | MRR@K | MAP@K |
|---|---|---|---|---|---|---|
| 2 | 0.79 | 0.71 | 0.38 | 0.71 | 0.76 | 0.69 |
| 3 | 0.83 | 0.62 | 0.46 | 0.70 | 0.77 | 0.66 |
In general, we were able to improve the embedding model performance by a few percentage points for each metric.
Prior to running the training process on the model, we first augmented the data so that it matches the profile for retrieval augmented generation. During the augmentation process, the GPT-3.5-Turbo model was used to perform generation, classification, and re-writing of the key-points. Specifically, the following steps were taken to ensure that the model behaves as expected during the output generation (augmentations).
The final aggregated news dataset consists of ~40K articles in the training set, and 1000 articles in the test set. We excluded the evaluation set for this model because we did not tune hyper-parameters for the fine-tuning.
After considering the ease of deployment, the advancements in model architecture, and the availability of supportive infrastructure such as VLLM, we arrived at 2 candidate model for targeted summaries. The first candidate was the chat version of the Llama-2 7B model. The second candidate, Open-Orca Mistral-7B was one of the top performer on the HuggingFace LLM leaderboard. We evaluated the base model on our targeted summaries test split by considering the ROUGE-2 Score on instances where both the predicted and actual summaries are not impossible to answer, and the ability of the model to classify the case when it's impossible to create the targeted summary.
From our initial evaluation, we determined that while both models did not meet our expectations on identifying impossible cases via a prompt engineering approach, Mistral is closer to our goal from an output perspective. Furthermore, Mistral has proven itself on the Huggingface Leaderboard. Thus, we decided to move forward with Open-Orca-Mistral7B.


We fine-tuned the Mistral model using the standard language modeling objective on the training split of our article dataset using half-precision LORA with the following hyper-parameters:
After fine-tuning, the ROUGE-2 score increased drastically, and the F1 score improved to 0.95. Thus, the model is unlikely to distract the user by providing irrelevant summaries, or tries to summarize non-existent key-points.
We fine-tuned the Llama-Chat-13B based on 20K Questions and Answering pairs from the followings datasets;
We pre-processed QA dataset to adjust data for RAG settings. For example, when processing TAT-QA, in order to train the model to generate concise response in under one paragraph for text based on Q&A, we took the followings steps:
We fine-tuned the Llama-Chat-13B model using the standard language modeling objective on the training split of our article dataset using half-precision LORA with the following hyper-parameters:
We were able to achieve notable improvement in both ROUGE-2 and F1 score. Even with a single epoch of tuning, the F1 score for classifying impossible questions increased to 0.9 from 0.22.


Jupyter Notebook
79.5%
Python
20.1%
https://github.com/yw4401/FinBot/assets/54665534/8e59fa43-9706-4af5-8bb3-4c6c8998292b
FinBot is an AI driven web application capable of analyzing financially related news articles and providing insights to retail investors. The application can empower the users to make better investment decisions while saving time and money by leveraging the power of LLM retrieval augmented generation.
The modern retail investor faces a dilemma—a scarcity of time to delve into extensive research while needing to stay updated with the dynamic opportunities in the market. The pace of change in investment landscapes demands continuous vigilance, making it challenging for individuals to keep pace with market shifts and opportunities.
Traditional financial advisory services often come with steep costs, sometimes ranging into hundreds of dollars per hour. This financial barrier restricts access to expert guidance and tailored advice, especially for smaller investors or those looking for cost-effective solutions.
The market reflects consistent growth in assets under management, showcasing a compound annual growth rate of around 9%. This expansion indicates an increasing interest and engagement in investing but also amplifies the need for accessible and scalable advisory solutions.
As a retail investor with a diverse set of interests, there are many challenges to overcome in accomplishing investment goals.
While retail investors can be capable of understanding the big picture, they generally do not have the time nor the exposure to conduct comprehensive research to make specific investment decisions. For instance, when COVID hit, it can be apparent that companies related to making remote work possible would be benefited from the situation. However, in addition to the consumer facing products such as Zoom, the products further upstream such as various cloud hosting services, data center properties, and chip manufacturers also experienced a boost in demand. However, for the retail investors, unless the area happens to fall into their expertise, such information may be an unknown unknown to them.
Investment opportunities are time-dependent and require up-to-date information. But, staying up-to-date while life happens require constant effort. Suppose that an investor is interested in pharmaceutical sector, but making informed decision regarding the pharmaceutical industry would potentially entail keeping track of the development and approval process of treatment procedures. But, not everyone has the time or energy to scan through news and documents on medical procedures after a long day at work and taking care of family matters.
Generic ETFs and mutual funds are common solutions employed by retail investors to get a decent return without having expert knowledge. Thus, the asset managers or index tracking algorithms are making decisions on behalf of a large number of retail investors. In recent years, the growth of ESG suggests that investors may have additional interests, such as delivering social impact, by means of their investment. In addition, getting financial advice can be costly, and the interest of the hired advisor may not truly be aligned with the interest of the investor.
The aim of the project is to alleviate those pain-points by reducing the information asymmetry that leads to less efficient investment choices by retail investors compared to a dedicated advisor or asset manager. Utilizing the power of AI, we provide our users the power to quickly digest facts and insights from the vast collection of publically available financial news articles
Given any question about business news or developments in a time frame, FinBot can help user to get the information they need quickly.
For each question, FinBot helps user to expand their view by summarizing key-points from different topics related to their inquiry.
FinBot automatically extracts relevant companies for each query, and present selected KPIs to the users. The users would be able to learn about different companies at a glance.
In order to accomplish the goal of the project, the features can be seen as retrieval augmented generation problems. While LLMs may encode prior knowledge from pre-training, it is difficult to control and to ensure the correctness of the output. In addition, the prior knowledge of the model stops at the date when the pre-training stopped. Thus, for the purpose of assisting the users with market research and advice, the approach taken was to create an envelope around LLMs, feed the LLMs data required to perform tasks pretaining to the features, and make use of the domain knowledge and reasoning ability of the LLMs to create the outputs for the users.
Our work to implement the process can be roughly divided into four main parts:
The data collection pipeline collects and aggregate news articles. Then, it applies a series of NLP techniques including co-reference resolution, topic modeling, text embedding, NER, and Min-Hash to augment the articles. Finally, it prepares the articles for output generation by chunking the article texts and indexing the chunks.
Once the indices are built, the solution is ready to generate informative output for the users.
The final output to the user consists of three main segments:
The algorithms for handling output is located in the summarizer directory.
In addition to creating envelops around LLMs, we customized the pre-trained models for our solution:
In order to fulfill the modeling requirements, we conducted an initial evaluation of pre-trained models to determine the best one to fine-tune (if needed). Next, we fine-tuned the models gathered data to improve the performance and to get the desired output format. Then, we evaluated the fine-tuned models on a separate test dataset to determine if the tuned models meet our ends. Finally, the fine-tuned models are deployed on GCP to serve our clients.
The ember-v1 model is used as a base for creating the embeddings for retrieval. The ember-v1 model is the best non-instructed tuned embedding model for retrieval task on the HuggingFace MTEB Leaderboard. Thus, we have determined that it would achieve a good balance of performance and simplicity to start our fine-tuning.
In order to align the generated embeddings with financially related queries and text, we sourced and augmented the FIQA dataset, which contains questions and answer paragraph pairs on financially related subjects. Since the original FIQA dataset was created by scraping questions asked on forums such as stackexchange and reddit, we augmented the train, eval, and test split of the dataset separately by prompting PaLM2 chat-bison to re-write the answer paragraph in a formal way adhering to the convention of news and/or reports.
The training setup can be described as a way to minimize the distance between the embedding vectors between the question and associated answer candidates without making all the embeddings similar to each other. The loss function used is identical to the Multiple Negatives loss described in Efficient Natural Language Response Suggestion for Smart Reply.
The fine-tuning followed a standard train-eval loop for 10 epochs on the FIQA train/eval splits. The default hyper-parameters from sentence transformers were applied. After running through the 10 epochs, checkpoint with the best max(MAP@2, MAP@3) score was selected. In this case, the first epoch resulted in the best performing model.
Since for our purposes, we would only retrieve the top 2-3 chunks given the constraints on the context window, we evaluated the model performance with K = 2 and K = 2. The following metrics were computed on the test set from FIQA.
| K/Metrics | Accuracy@K | Precision@K | Recall@K | NDCG@K | MRR@K | MAP@K |
|---|---|---|---|---|---|---|
| 2 | 0.76 | 0.67 | 0.36 | 0.68 | 0.73 | 0.66 |
| 3 | 0.81 | 0.58 | 0.44 | 0.66 | 0.74 | 0.62 |
| K/Metrics | Accuracy@K | Precision@K | Recall@K | NDCG@K | MRR@K | MAP@K |
|---|---|---|---|---|---|---|
| 2 | 0.79 | 0.71 | 0.38 | 0.71 | 0.76 | 0.69 |
| 3 | 0.83 | 0.62 | 0.46 | 0.70 | 0.77 | 0.66 |
In general, we were able to improve the embedding model performance by a few percentage points for each metric.
Prior to running the training process on the model, we first augmented the data so that it matches the profile for retrieval augmented generation. During the augmentation process, the GPT-3.5-Turbo model was used to perform generation, classification, and re-writing of the key-points. Specifically, the following steps were taken to ensure that the model behaves as expected during the output generation (augmentations).
The final aggregated news dataset consists of ~40K articles in the training set, and 1000 articles in the test set. We excluded the evaluation set for this model because we did not tune hyper-parameters for the fine-tuning.
After considering the ease of deployment, the advancements in model architecture, and the availability of supportive infrastructure such as VLLM, we arrived at 2 candidate model for targeted summaries. The first candidate was the chat version of the Llama-2 7B model. The second candidate, Open-Orca Mistral-7B was one of the top performer on the HuggingFace LLM leaderboard. We evaluated the base model on our targeted summaries test split by considering the ROUGE-2 Score on instances where both the predicted and actual summaries are not impossible to answer, and the ability of the model to classify the case when it's impossible to create the targeted summary.
From our initial evaluation, we determined that while both models did not meet our expectations on identifying impossible cases via a prompt engineering approach, Mistral is closer to our goal from an output perspective. Furthermore, Mistral has proven itself on the Huggingface Leaderboard. Thus, we decided to move forward with Open-Orca-Mistral7B.


We fine-tuned the Mistral model using the standard language modeling objective on the training split of our article dataset using half-precision LORA with the following hyper-parameters:
After fine-tuning, the ROUGE-2 score increased drastically, and the F1 score improved to 0.95. Thus, the model is unlikely to distract the user by providing irrelevant summaries, or tries to summarize non-existent key-points.
We fine-tuned the Llama-Chat-13B based on 20K Questions and Answering pairs from the followings datasets;
We pre-processed QA dataset to adjust data for RAG settings. For example, when processing TAT-QA, in order to train the model to generate concise response in under one paragraph for text based on Q&A, we took the followings steps:
We fine-tuned the Llama-Chat-13B model using the standard language modeling objective on the training split of our article dataset using half-precision LORA with the following hyper-parameters:
We were able to achieve notable improvement in both ROUGE-2 and F1 score. Even with a single epoch of tuning, the F1 score for classifying impossible questions increased to 0.9 from 0.22.


Jupyter Notebook
79.5%
Python
20.1%