
A publicly traded regional bank in the U.S. Northeast, with more than $20 billion in assets, acquired another bank and inherited about 2,000 commercial loans on multifamily properties; a concentration that exceeded internal risk limits. Their plan was to sell the loans, which is a common outcome in this situation.
The challenge was that selling a loan portfolio at a good price requires more than just a loan balance. Buyers need to know what they’re underwriting: the property address, the age of the building, occupancy rates, whether there’s a personal guarantor, and a few other key underwriting attributes that determine asset quality. Without that information, buyers discount heavily to account for the uncertainty or decline to bid.
For the bank, all that information existed somewhere, but “somewhere” meant roughly 250,000 scanned document images accumulated over the life of these loans (origination files, appraisals, rent rolls, legal agreements). About a terabyte of content in total, none of it searchable or structured. Going through it manually would have taken months, and there was no reliable way to search across image-based documents.
“Our client had these critical data points locked inside PDFs they’d inherited from an acquisition. We knew Databricks could handle data at that scale and complexity and give them a governed path from unstructured documents to usable information so that’s the direction we took them.”
— Guillaume Colley, Director of AI, Cavallo Technologies
Building the Pipeline
The bank engaged their Databricks Partner, Cavallo Technologies, to figure out a workable approach. The solution Cavallo built leveraged Databricks Document Intelligence and had three main parts.
The first step was to filter out old documents to reduce volume and potential noise: the year of the document was extracted from the first few pages of each of the 250,000 documents with Databricks SQL functions: ai_parse_document and ai_query, then filtered in or out based on age.
The second step used Databricks’ ai_parse_document function to perform OCR across the remaining 170,000 documents and extract their text, with Spark Structured Streaming handling the parallelism across the full corpus. All the data was stored in Delta Lake under Unity Catalog, so the data stayed governed and auditable throughout.
The third part was a little more complex. Once you have the text, you still need to find specific facts that could be anywhere across dozens of documents of hundreds of pages per loan, written differently depending on who prepared the document and when. A simple query won’t get you there reliably. We built what we call an automated retrieval-augmented generation (RAG) pipeline: a Claude-powered AI agent that we spin up programmatically for each loan, point at that loan’s documents, ask it a set of specific questions, record the answers, and shut it back down before moving on to the next loan. Fully automated, it had no human-in-the-loop required.
The pipeline processed about 1TB of documents over a few days, at a compute cost of just a few thousand dollars.

The Results
The extraction pipeline achieved 90% accuracy against a manually validated sample, which the bank’s team deemed sufficient for loan portfolio pricing decisions.
“Once the attributes were extracted, the bank’s credit team could finally sort the portfolio into the right buckets. Having that visibility allowed the credit team to price the loans higher than they would have without the information.”
— Guillaume Colley, Director of AI, Cavallo Technologies
Why Databricks
One of the reasons this worked as well as it did is that Databricks lets you run the whole pipeline from ingestion and OCR to vector indexing, LLM inference, and output storage, in one governed environment, rather than stitching together external services. Databricks’ open model ecosystem allowed integration with external LLMs without vendor lock-in; Claude was used in this case, but it could have been ChatGPT, Gemini, or Llama.
“This use case was at the intersection of highly advanced AI functionalities and massive data scale. Processing this amount of unstructured data in a unified platform and at such speed could only have been done with Databricks”
— Guillaume Colley, Director of AI, Cavallo Technologies
About Cavallo Technologies
At Cavallo, a Databricks-exclusive firm, we help enterprise teams design and build production AI systems on Databricks. If your team is working on this, we will be happy to dig into the architecture with you.
