Financial text analysis demands precision. A misread EBITDA adjustment or an overlooked risk factor in a 10-K can distort a valuation model. Yet off-the-shelf LLMs often hallucinate percentages, invert sentiment, or miss nuanced forward-looking statements. Improving accuracy requires more than selecting a larger model. It demands deliberate optimization across prompting, context management, and output structure.
Prompt Engineering for Financial Extraction
Generic prompts fail in finance because language is dense, regulatory, and intentionally qualified. The most reliable approach combines role definition, schema constraints, and chain-of-thought reasoning.
Start by assigning a specific role and output format. Then provide a few examples of the target extraction inside the prompt context. For complex items like adjusted net income or contingent liabilities, ask the model to reason step by step before producing the final JSON.
import openai
client = openai.OpenAI(
base_url="https://api.oxlo.ai/v1",
api_key="YOUR_OXLO_API_KEY"
)
prompt = """You are a senior financial analyst. Extract the following from the earnings call transcript:
- Revenue (numeric, in millions USD)
- YoY growth rate (percentage)
- Primary headwinds (list of strings)
Transcript:
""" + transcript
response = client.chat.completions.create(
model="deepseek-r1-671b", # Deep reasoning for complex filings
messages=[{"role": "user", "content": prompt}],
response_format={"type": "json_object"}
)
Using a reasoning model like DeepSeek R1 671B MoE on Oxlo.ai helps disambiguate qualified statements, such as "revenue grew excluding the impact of currency," which simpler models often misclassify.
Model Selection and Reasoning Depth
Not every financial task needs the same capacity. High-frequency sentiment scanning of news headlines requires speed. Parsing a credit agreement or reconciling non-GAAP disclosures requires depth.
Oxlo.ai offers a range of models suited to these tiers. For deep reasoning over complex regulatory text, DeepSeek R1 671B MoE and Kimi K2.6 provide advanced chain-of-thought reasoning. For general-purpose extraction and summarization, Llama 3.3 70B is a reliable flagship. If your workflow processes multilingual filings, for example from European or Asian markets, Qwen 3 32B handles multilingual reasoning with strong agentic support.
Because Oxlo.ai uses request-based pricing rather than token-based billing, the cost of sending a long filing to a reasoning model is predictable. You do not pay a premium proportional to document length, which makes it practical to route full documents to the most capable model rather than forcing a tradeoff between accuracy and token budget. See https://oxlo.ai/pricing for details.
Handling Long Context Documents
Annual reports, prospectuses, and regulatory commentaries routinely exceed the context limits of standard endpoints. Chunking is a common workaround, but it introduces boundary errors where a sentence split across chunks loses its modifier.
Whenever possible, ingest the full document. Models such as DeepSeek V4 Flash on Oxlo.ai support 1M context windows, and Kimi K2.6 supports 131K tokens. Passing the entire 10-K eliminates chunking ambiguity and lets the model resolve cross-references between risk factors and financial statements.
Oxlo.ai also serves popular models with no cold starts, which matters when you are batch processing hundreds of filings. You avoid the latency spikes that disrupt ETL pipelines.
# Example: sending a full 10-K to a long-context model
with open("10k_filing.txt", "r") as f:
filing_text = f.read()
response = client.chat.completions.create(
model="kimi-k2-6",
messages=[
{"role": "system", "content": "Extract all material litigation items with associated dollar amounts."},
{"role": "user", "content": filing_text}
]
)
Structured Output and Tool Use
Free-form text is difficult to validate and risky to feed into downstream quantitative systems. JSON mode and function calling enforce schemas that prevent structural hallucinations.
Oxlo.ai supports both features across its chat models. You can define a JSON schema for an earnings extraction and require the model to populate it, or you can register a tool that pushes the extracted data directly into an internal database.
tools = [{
"type": "function",
"function": {
"name": "record_extraction",
"parameters": {
"type": "object",
"properties": {
"ticker": {"type": "string"},
"metric": {"type": "string"},
"value": {"type": "number"},
"unit": {"type": "string", "enum": ["USD", "percent"]}
},
"required": ["ticker", "metric", "value", "unit"]
}
}
}]
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": prompt}],
tools=tools,
tool_choice={"type": "function", "function": {"name": "record_extraction"}}
)
This pattern guarantees that downstream systems receive typed fields rather than prose, reducing integration bugs.
Grounding and Evaluation
Even optimized LLMs can confabulate. The final layer of accuracy is grounding. Always ask the model to cite specific sentences or section numbers from the source text. If you are using RAG, restrict the context to primary sources such as EDGAR filings or issuer disclosures rather than secondary summaries.
Evaluation should be continuous. Maintain a golden dataset of manually annotated filings and measure precision, recall, and F1 for each extracted field. Because Oxlo.ai is fully OpenAI SDK compatible, you can point existing evaluation frameworks to https://api.oxlo.ai/v1 without rewriting your test harness.
Cost Efficiency at Scale
Production financial pipelines often process thousands of documents nightly. Under token-based pricing, the cost of analyzing a 50-page 10-K can be orders of magnitude higher than a short news article. Teams often respond by truncating context or downgrading to smaller models, both of which hurt accuracy.
Oxlo.ai flips this dynamic with flat per-request pricing. A request costs the same whether it contains one paragraph or a full annual report. That predictability lets engineering teams prioritize accuracy over token math, using the best available model and the full document context for every job. For teams moving from token-based providers, this can yield substantial savings on long-context and agentic workloads. Details are available at https://oxlo.ai/pricing.
Conclusion
Better accuracy in financial text analysis comes from a stack of deliberate choices: targeted prompting, reasoning-capable models, full-context ingestion, structured outputs, and rigorous evaluation. Infrastructure should support these choices rather than forcing compromises.
Oxlo.ai provides the models, the API compatibility, and the request-based pricing structure to run this stack in production. Replace your base URL with https://api.oxlo.ai/v1, select the model that matches your reasoning depth, and pass the full document. The result is a pipeline that is both more accurate and more predictable to operate.
Top comments (0)