Automating Private Credit Deal Analysis with LLMs and RAG

riskspan · Finance · 2025 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Private credit investment analysis

Riskspan needed to reduce private-credit deal analysis from weeks of document review and Excel modeling to days while handling confidential, non-standard deal documents and waterfall logic.

Constraints:

Architecture

Riskspan built an AWS-based GenAI workflow that extracts deal information from scanned PDFs, emails, handwritten notes, and amendments; uses embeddings and RAG through Bedrock because Claude cannot ingest all source material at once; has Claude dynamically generate code for waterfall investment logic; runs generated code in serverless infrastructure; passes outputs into existing legacy APIs; and keeps a human in the loop for final validation.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  deal-document-ingestion[Deal document ingestion] --> embedding-and-rag-layer[Embedding and RAG layer]
  embedding-and-rag-layer --> claude-code-generator[Claude code generator]
  claude-code-generator --> serverless-code-runner[Serverless code runner]
  serverless-code-runner --> legacy-api-layer[Legacy API layer]
  legacy-api-layer --> human-review[Human review]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Deal document ingestion Collects scanned PDFs, emails, handwritten notes, amendments, and other deal materials. Embedding and RAG layer
Embedding and RAG layer Retrieves relevant context because the full deal corpus exceeds the LLM context window. Deal document ingestion, Claude code generator
Claude code generator Generates code for investment waterfall logic from retrieved deal context. Embedding and RAG layer, Serverless code runner
Serverless code runner Executes generated waterfall-model code cost-effectively. Claude code generator, Legacy API layer
Legacy API layer Integrates generated forecasts into Riskspan's existing customer-facing platform. Serverless code runner, Human review
Human review Validates outputs before deal analysis is finalized. Legacy API layer

Data flow

Deal documents are ingested from PDFs, emails, notes, and amendments. Extraction tools and embeddings make relevant context retrievable through Bedrock RAG. Claude generates waterfall-model code from retrieved facts, serverless infrastructure executes the code, and legacy APIs deliver results inside Riskspan's existing customer experience.

4 supporting quotes
“We use tools to extract data from scanned PDF images, unstructured emails, you know, handwritten notes, et cetera.”transcript, stated
“So there was no way that LLM Claude, which is LLM in this case, was gonna be able to process that. So we needed embeddings,”transcript, stated
“So we needed embeddings, we needed a rack solution, which again, we were able to leverage all of that through Bedrock.”transcript, stated
“Claude, in this case, is generating the dynamically generating code to model the investment, waterfall investment logic”transcript, stated

Why this architecture

RAG is required because deal files exceed a single context window and contain confidential information across many formats. Code generation is necessary because each private-credit waterfall can be bespoke, and serverless execution keeps per-deal cost low. Existing APIs preserve customer workflow continuity instead of replacing the platform.

3 supporting quotes
“We ran, and then that was a lot of data. So there was no way that LLM Claude, which is LLM in this case, was gonna be able to process that.”transcript, stated
“And then, having the information flow through in a form that our legacy APIs could take those forecasts and give clients a seamless experience”transcript, stated
“We use serverless technology for running the final code that was being generated by Claude. So, Claude, in this case, is generating”transcript, stated

Models used: Claude · Bedrock embeddings/RAG

Scale

Alternatives considered (roads not taken)

Manual analyst review and Excel modeling

Rejected because: The baseline took weeks and required extracting data into Excel models.

“Today, analysts build Excel spreadsheets, which, again, as we all know, doesn't scale. And what it does is that it”transcript, stated
“extract the data, put in an Excel, and create an Excel model that you are comfortable with. But (poor audio quality) see here, right,”transcript, stated

Give all documents directly to Claude

Rejected because: The document corpus was too large for Claude to process directly.

“So there was no way that LLM Claude, which is LLM in this case, was gonna be able to process that. So we needed embeddings,”transcript, stated

Replace legacy APIs

Rejected because: Riskspan kept the legacy API layer to deliver a seamless experience across investments.

“that our legacy APIs could take those forecasts and give clients a seamless experience across all their investments”transcript, stated

Patterns

rag-retrieval (retrieval)

Embeddings and RAG retrieve relevant deal context from large, heterogeneous private-credit documents.

“So we needed embeddings, we needed a rack solution”transcript, stated

tool-use-orchestration (workflow)

The workflow coordinates extraction tools, Bedrock retrieval, Claude code generation, serverless execution, and legacy APIs.

“We use tools to extract data from scanned PDF images, unstructured emails”transcript, stated

human-in-the-loop-gate (workflow)

Human review remains included in the per-deal cost and validation path.

“including the human in the loop being involved.”transcript, stated

cost-aware-routing (operations)

Serverless execution and automation reduced per-deal cost to less than $50.

“The AWS services we used were very cost-effective”transcript, stated
“90x reduction in cost”transcript, stated

structured-output-contract (data)

Generated code models waterfall investment logic in a form legacy APIs can execute and present.

“dynamically generating code to model the investment, waterfall investment logic”transcript, stated

Tradeoffs

Use RAG with Claude

Chose retrieval over large deal corpora over single-prompt full-document analysis.

Rationale: The document volume was too large for direct model input.

“there was no way that LLM Claude, which is LLM in this case, was gonna be able to process that.”transcript, stated

Generate executable waterfall code

Chose Claude-generated code run serverlessly over manual Excel model creation.

Rationale: Custom deal logic still needed executable financial modeling, but automation made it faster and cheaper.

“Claude, in this case, is generating the dynamically generating code to model the investment, waterfall investment logic”transcript, stated

Keep legacy APIs

Chose integrate generated forecasts into existing APIs over replace the customer platform.

Rationale: Legacy APIs already delivered the seamless multi-investment customer experience.

“the API layer, which already existed.”transcript, stated

Gotchas (what bit them)

Private credit context exceeds LLM context windows.

Root cause: Deals include many document types and amendments, creating too much data for Claude directly.

Resolution: Riskspan used embeddings and RAG through Bedrock.

“We ran, and then that was a lot of data.”transcript, stated
“So we needed embeddings, we needed a rack solution”transcript, stated

Deal data is confidential and heterogeneous.

Root cause: Inputs include scanned PDFs, unstructured emails, handwritten notes, and amendments.

Resolution: The system extracts from heterogeneous sources while preserving confidentiality requirements.

“confidentiality was key to our clients.”transcript, stated
“scanned PDF images, unstructured emails, you know, handwritten notes, et cetera.”transcript, stated

Evaluation

Riskspan reports business outcome metrics: processing time, customer onboarding speed, scalability, and cost reduction.

Metrics: deal processing time · customer onboarding speed · scalability · per-deal processing cost · market opportunity

3 supporting quotes
“87% faster are, you know, onboarding for customers.”transcript, stated
“10x scalability”transcript, stated
“90x reduction in cost”transcript, stated

Outcomes

Riskspan reports trillions of dollars in assets, 45 million loans, 70 asset classes, and a $9T private-credit opportunity.

“taking the processing time for a deal structure evaluation from three to four weeks to about three to five days”transcript, stated
“on path to unlocking this $9-trillion market.”transcript, stated