Back to Projects
Applied AI & Financial Intelligence • 2026The Vision & Architecture
An answer an equity analyst can
defend, line by line.
Loom is an internal research assistant for an equity research firm whose core product is accuracy. It answers complex questions about a curated corpus of 10-K filings and binds every factual claim to a retrieved passage with filing, page, and excerpt, backed by hybrid search and fail-closed grounding validation.
Core Capabilities
Hybrid Retrieval With Rank Fusion
Dense pgvector search and Postgres full-text search run as dual bounded queries, fused in Python via Reciprocal Rank Fusion (RRF at k=60) for lexical precision and semantic recall.
Structure-Aware Chunking
Passages are cut at 512 tokens with 12% overlap, keeping financial tables atomic up to 1500 tokens with ±1 neighbor context stitching so numbers never lose their headers.
Fail-Closed Grounding
A two-phase validator confirms citations map to passages retrieved for that request, with an LLM-as-a-judge pass behind it. Unsupported answers trigger explicit errors rather than hallucinations.
Typed Agent Boundary
Pydantic AI drives generation with explicit dependencies and typed grounded-answer schemas, keeping retrieval and validation testable without invoking live models.
Streamed Retrieval Stages
Answers stream to the React 19 UI over SSE in the AI SDK part format, surfacing real-time retrieval progress and citations while text is generated.
Technology Stack
Architectural Decisions
Hybrid over pure vector search
Filings turn on exact tokens — segment names, statute references, and line items. Combining lexical search with vector retrieval ensures precise matching.
Fail closed over best effort
In equity research, a confident wrong answer costs more than an explicit refusal. Validation failure surfaces as a clean system error.