FormaFin: Verifiable Financial Analysis with Solver-Guided Reinforcement Learning

Bethel Hall, William EiersarXiv 2026

It’s late, you’ve had a long day of debugging or data wrangling, and the last thing you want to think about is a 500-page corporate loan agreement. But for banks and financial institutions, these documents are the law. They contain "covenants"—rules like "your debt can't be more than 3x your earnings"—that must be checked every single quarter.

If a borrower breaks a rule, it’s a big deal. Currently, humans do this manually, or they try to use Large Language Models (LLMs). The problem? LLMs are notoriously bad at precise numerical reasoning and can "hallucinate" compliance when a company is actually in breach.

This paper introduces FormaFin, a way to make financial analysis verifiable by teaching small, local AI models to translate messy legal prose into rock-solid mathematical formulas.

TL;DR

FormaFin trains small (7B) language models to turn financial rules into computer-verifiable math (SMT formulas). By using a logic solver to "grade" the model during training, it achieves higher accuracy than models ten times its size and can catch nearly every mistake made by other AI analysts.

What Problem Does This Paper Address?

Financial rules are written in natural language, which is ambiguous. When an LLM reads a loan agreement and a financial statement to check for compliance, it’s doing a lot of heavy lifting: interpreting the text, identifying limits, and performing math. If it gets the answer wrong, there’s no easy way to "verify" the logic without a human re-doing the whole thing.

Furthermore, financial data is highly confidential. Banks don't want to send their secret sauce to a giant cloud-based API. They need small models that run locally. However, small models usually aren't smart enough to handle complex legal logic. The authors tackle this "reliability gap" by moving from direct reasoning (asking the LLM for the answer) to autoformalization (asking the LLM to write a reusable formula).

Fig. 1. The quarterly covenant check using a real loan covenant case, and a constructed compliance certificate showing a 1% breach. (a) An analyst checks compliance against loan covenant. (b) A 7B model checking the clause gets the earnings cushion wrong by 94 points. (c) Trained with FormaFin, the same model writes the covenant once as a formula, and the Z3 solver computes all three answers exactly, every quarter.

Methods

The researchers used a "neurosymbolic" approach—combining the linguistic intuition of LLMs with the rigid logic of an SMT (Satisfiability Modulo Theories) solver called Z3.

The training happens in three stages:

  1. Teacher Distillation: They use a powerful "teacher" model to generate initial formulas from 1,000 training clauses, filtering out anything that doesn't parse or make sense.
  2. Solver-Guided Reinforcement Learning (RL): This is the secret sauce. They don't have "correct" formulas to compare against. Instead, they use the numerical thresholds in the text as a signal. If a rule says "Ratio < 2.5," the solver tests the generated formula at 2.4 (should pass), 2.5 (should pass), and 2.6 (should fail). If the formula behaves correctly at these boundaries, the model gets a reward.
  3. Verification: To ensure the formulas are trustworthy, they train two separate models. If both models produce formulas that the solver proves are mathematically equivalent, the result is considered "verified" and can be used without human review.
Fig. 2. How FormaFin works. Stage I. Teacher formulas that pass automatic checks train the small model. Stage II. The solver tests each sampled formula just inside, at and just outside every stated limit, and the reward grows with the share of tests passed. Stage III. Formulas that a second formalizer provably matches are used without review, and the rest go to an analyst.

Datasets

The authors introduced CovenantBench, the first benchmark of its kind. It consists of:

  • 143 real-world loan covenants extracted from SEC filings.
  • 2,527 questions covering compliance status, "earnings cushion" (how much profit can drop before a breach), and "debt capacity" (how much more can be borrowed).
  • 1,064 compliance certificates (the financial figures used to test the rules).

Key Insights and Ideas

  • Rules are their own labels: You don't need a human to label "correct" math formulas if the text itself contains the test cases (the thresholds). This allows for "label-free" reinforcement learning.
  • Formalization beats Scale: A 7B model that writes a formula once is much more accurate than a 70B model that tries to "read" the answer every time. This is because the formula handles the math perfectly, leaving the LLM to only handle the translation.
  • The "Cushion" Gap: LLMs are okay at saying "Yes/No" to compliance, but they are terrible at calculating the margin of error (the cushion). Formalization closes this gap almost entirely.

Key Results

The results are a bit of a "David vs. Goliath" story. Small models trained with FormaFin crushed much larger, off-the-shelf models.

  • Accuracy: A 7B FormaFin model achieved 94.8% accuracy, while the massive Llama-3.3-70B (running in 4-bit mode) only managed 79.1%.
  • Error Detection: When used as a "checker," FormaFin caught 95.6% to 99.7% of the errors made by other LLMs.
  • Consistency: Across different model families (Qwen, Llama, Mistral), the framework consistently pushed accuracy into the 90s.
Table 1. Accuracy on CovenantBench (%), overall and by question (status, earnings cushion, debt capacity). Proven – formulas proven equivalent to the reference. ±: stan- dard deviation over three training runs.

Limitations and Future Work

While impressive, the authors note a few hurdles:

  • Simplified Inputs: The benchmark assumes the financial figures (like "EBITDA") are already extracted. In the real world, finding those numbers in a messy 10-Q filing is a separate, difficult task.
  • Complexity Limits: Rules with complex date schedules or highly specific conditions remain harder for the models to formalize correctly.
  • Scope: The study focused on US public company agreements. Whether this generalizes to international law or private "handshake" deals remains to be seen.

In the future, the authors hope to extend this to regulatory ratios (like those from the Basel Accords) and investment mandates, potentially automating the "boring" part of finance with a level of mathematical certainty that current LLMs simply can't provide.

Summary updated

Abstract

Formally verifying financial analyses generated by large language models (LLMs) remains challenging as financial rules are largely expressed in natural language and rarely have corresponding formal specifications. Training language models to formalize these rules is hindered by the scarcity of labeled data and reliable training signals, while confidential financial data favor small models that run locally. We introduce FormaFin, a framework that trains small open language models to translate financial rules into reusable SMT formulas. FormaFin integrates teacher distillation with reinforcement learning using an SMT solver to compute rewards from numerical thresholds stated in financial rules. We evaluate FormaFin on corporate loan monitoring, in which lenders check borrowers' financial figures against loan agreements. To evaluate our framework, we curate \bench{}, a benchmark containing 143 loan agreements and 2,527 questions covering compliance, earnings cushion, and debt capacity. Our results show that a 7B formalizer achieves 94.8\% accuracy, outperforming open LLMs up to ten times larger. Across three model families, accuracy ranges from 92.6 to 96.8\%. Our framework also detects 95.6 to 99.7\% of errors in other LLMs' financial analyses. We make FormaFin and \bench{} publicly available.
BibTeX
@misc{hall2026formafin,
  author = {Bethel Hall and William Eiers},
  title = {{FormaFin: Verifiable Financial Analysis with Solver-Guided Reinforcement Learning}},
  year = {2026},
  eprint = {2611.28881},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.28881},
}
Figure