🎉 Seed RoundWe've raised 2.5M from Swift, YC, & Chapter One. Read more

Learning - 2023-09-07

Making Financial Analysis Easier with Attribute Extraction

by Pablo Rios

Renaissance metalhead crafting a hit

Renaissance metalhead crafting a hit

If you're in the finance industry, you know that spreadsheets are your bread and butter. They're packed with invaluable data that guides your every move. But what if you could supercharge this data with the capabilities of Large Language Models (LLMs)? Well, there's a catch. While LLMs excel at understanding natural language text, they stumble when it comes to understanding the relationships and connections within structured data.

With Metal’s Attribute Extraction, we can improve an LLM’s capabilities by grounding their answers to quantitative data found in spreadsheets. In this blog post, we'll discuss the specific challenges LLMs face when analyzing structured financial data and walk you through a demo of how to use this freshly released feature by Metal.

Challenges with LLMs in Financial Services

Key Limitations:

1. Lack of Native Support for Structured Data: LLMs are not inherently designed to interpret tabular or spreadsheet data, leading to a loss of critical contextual information.

2. Missing Contextual Cues: Financial statements are complex, involving relationships between cells and rows that are not readily apparent when converted to plain text. This makes accurate interpretation by LLMs problematic.

3. Semantic Understanding: Numbers and ratios in financial documents carry specific meanings that are often lost on LLMs. For instance, Earnings Before Interest and Taxes (EBIT) isn't just a number; it's a financial metric that requires contextual understanding.

What is Attribute Extraction?

Attribute Extraction makes LLMs more effective with structured data, like financial metrics. It can extract specific numbers and details from spreadsheets, and then use these figures to inform an LLM's answers. This way, the LLM isn't guessing; it's using actual figures from your data. The feature also helps the LLM understand the relationship between different financial numbers and what each one actually means.

A Real-World Use Case: Analyzing Apple's Financial Statement

Let’s use Apple Inc.'s latest financial statement as an example. We’ll use attribute extraction to find key metrics, such as their most profitable business segments, last quarter's revenue, and the company's liabilities for a given year.

The process starts by defining what you want to know—in technical terms, setting up your 'metadata fields' for extraction.

Setting Up Attribute Extraction

Let's dig into some code to understand how to configure this programmatically using Metal's Python SDK:

from metal_sdk.metal import Metal
# Create payload for the data source
payload = {
"name": "Apple Financials",
"metadataFields": [
{
"name": "Best Categories",
"type": "string",
"description": "What are the top three most profitable categories for the company so far this year?"
},
{
"name": "Revenue last quarter",
"type": "number",
"description": "What is the company's revenue for the most recent quarter?"
},
{
"name": "Liabilities",
"type": "number",
"description": "Could you provide the total amount for the company's liabilities in 2023?"
},
{
"name": "Cash Behaviour",
"type": "string",
"description": "Did the cash generated by operating activities increase or decrease year over year?"
}
],
"sourcetype": "File",
"autoExtract": True
}
# Create the data source
metal.create_datasource(payload)

Uploading Files and Verifying Extracted Data

Once your data source is in place, you can upload any number of financial documents. These will automatically adhere to the extraction parameters you've defined. After the extraction is done, you'll get to review and validate the extracted data, ensuring its accuracy.

Attribute extraction UI

Attribute extraction UI

And there you have it! With everything set up, querying your LLM for specific financial insights becomes as easy as asking a question to a well-informed colleague. Metal's Attribute Extraction takes the grunt work out of financial data analysis, making it more accessible and less of a hassle.

Attribute extraction UI

Attribute extraction UI

Ready to Power Your Applications

Once you've configured the extracted attributes, they're ready to be used in your Metal applications. For example, you could integrate them into a chatbot that uses retrieval-augmented generation to provide accurate and contextually relevant answers based on real financial data for financial analysts. This app could in turn help analysts perform due diligence, industry or company analysis, or create investor memos at unprecedented speeds.

Conclusion

With Attribute Extraction, financial data analysis is more efficient, accurate, and user-friendly. It bridges the gap between LLMs and tabular data, allowing you to extract the most value from both. Forget the complex SQL queries and endless data scrubbing; with Attribute Extraction, you can get the answers you need as easily as asking a question.

Ready to make your financial data work smarter for you? Let's connect today!