- GPT Analyst Newsletter
- Posts
- From RAGs to Riches
From RAGs to Riches
Improving LLM Performance on Financial Analysis

It takes more than a GPT
At GPT Analyst, we’ve long argued that using LLMs for financial analysis is the logical step to take. They can analyze data at scale, their output is (more or less) deterministic and they can be tuned to meet your individual strategy.
But you can’t “just ask”, and here’s an example why (querying gpt-4o):
You are an experienced financial analyst.
Give me your rating for MSFT (anything between strong buy to strong sell).
As of my last update in October 2023, I don't have real-time data access to provide a current rating for Microsoft (MSFT) […]
In this case, gpt-4o is actually being honest1 . It doesn’t know because the data cut-off is in October 2023. That is typical: LLMs are trained with data up to a certain moment in time, and then their state is frozen as they are released to the public. But even if it weren’t the case, we have shown previously that their recollection of financial values is at best spotty.
So… what now? The answer, is Retrieval Augmented Generation (or RAG for short).
A brief intro to RAG
Although LLMs like ChatGPT can seem very knowledgeable, they are in fact merely regurgitating statistical relationships between words which they have learnt from their (admittedly enormous) training dataset. Enough has been written about that elsewhere, we won’t go into it in details here.
What they are definitely not is a database. An LLM on its own has no way of looking up factual information, and sometimes the information you are interested in (e.g. internal documents) was never used for training the LLM in the first place (at least we hope so!).
To address such shortcomings, the classic approach is to provide the LLM with relevant data (a.k.a. context) within the prompt itself. This can be done manually or - more typically - by fetching the data from a database.
If you’d like to learn more about RAG, Weights & Biases has a good intro. For now, let’s get back to our rating for Microsoft.
Call in the data
Let’s update the prompt above to include some basic market data about Microsoft:
You are an experienced financial analyst.
Give me your rating for MSFT (anything between strong buy to strong sell) based on the current data below.
EPS: 12.1
Quarterly Revenue Growth YOY: 0.16
Profit Margin: 0.356
P/E Ratio: 35.41
P/S Ratio TTM: 13.05
P/B Ratio: 11.53
Based on the provided financial metrics for Microsoft (MSFT), here's an analysis:
1. Earnings Per Share (EPS): An EPS of 12.1 is strong, indicating that the company is generating significant profit per share.
2. Quarterly Revenue Growth Year-Over-Year (YOY): A growth rate of 16% is robust, suggesting that the company is expanding its revenue at a healthy pace.
3. Profit Margin: A profit margin of 35.6% is very high, indicating efficient management and strong profitability.
4. Price-to-Earnings (P/E) Ratio: A P/E ratio of 35.41 is relatively high, which could suggest that the stock is overvalued compared to its earnings. However, high P/E ratios are common in tech companies with strong growth prospects.
5. Price-to-Sales (P/S) Ratio TTM: A P/S ratio of 13.05 is also on the higher side, which might indicate that the market expects significant future growth.
6. Price-to-Book (P/B) Ratio: A P/B ratio of 11.53 is high, suggesting that the stock is trading at a premium compared to its book value.
Overall Assessment:
Microsoft is demonstrating strong profitability and growth, which are positive indicators. However, the high valuation ratios (P/E, P/S, P/B) suggest that the stock is priced for growth, and investors are paying a premium for its future potential. This is typical for a leading tech company with a strong market position and growth prospects.
Rating: Buy
While the stock is not cheap, the company's strong financial performance and growth potential justify a "Buy" rating. Investors should be aware of the premium valuation and consider their risk tolerance and investment horizon.
This analysis is for educational purposes only and does not represent a recommendation to buy or sell stocks or other financial products.
Not bad, right? Sure, you might disagree with the conclusion, you might think that it requires more data than we provided here. Nevertheless, there is now a framework for the LLM to reason about an asset with more than just what it was trained on.
Conclusion
Large language models can be a valuable tool for automating and scaling financial analysis, but they lack access to up-to-date data and have less than perfect recall for historical values. Using retrieval augmented generation, this gap can be closed.
If you’d like to try out RAG for financial analysis yourself without having to copy-paste values from other sources, head over to GPT Analyst to try it out for yourself!
1 That’s not always the case. We’ve definitely seen it make up ratings by basing decisions on well publicized (but sorely outdated) events such as the Blizzard acquisition.
Hands Down Some Of The Best Credit Cards Of 2025
Pay No Interest Until Nearly 2027 AND Earn 5% Cash Back
Reply