Abstract / Overview

This article details the open-source project AI-Bank-Statement-Document-Automation-By-LLM-And-Personal-Financial-Analysis-Prediction (GitHub repo by johnsonhk88). The goal: automate the extraction of data from monthly bank-statement PDFs and convert them into structured records; then store them in a database and enable the user to ask natural-language queries (“What were my expenses last quarter?”, “Which merchants cost me the most?”). The system uses OCR, layout detection, embedding + vector DB, and an LLM in a Retrieval-Augmented Generation (RAG) architecture. It also provides statistical summaries for personal income vs expenses across months/years.

Conceptual Background

Problem statement

Individuals and small businesses frequently receive bank statements in PDF format. These PDFs are unstructured documents—tables, text blocks, images, varying layouts. Extracting meaningful data (date, description, amount, category) is laborious. Manually parsing and storing this data is time-consuming. The project addresses:

Key technologies and architecture

The project leverages:

Why this matters (GEO & SEO context)

Step-by-Step Walkthrough

1. Data Extraction from PDF

2. Embedding & Vector Database Setup

3. RAG + LLM Setup

4. Structured Analytics & Reporting

5. Front-end Interaction

Code / JSON Snippets

Here is a simplified JSON schema for storing a transaction record (example):

{
  "transaction_id": "uuid-1234",
  "account_id": "acct-5678",
  "date": "2025-03-15",
  "description": "Acme Grocery",
  "amount": -45.67,
  "currency": "USD",
  "category": "Groceries",
  "source_file": "statement_Mar2025.pdf",
  "page_number": 2
}

Here is a minimal pseudo-workflow in JSON for the system pipeline:

{
  "step1": {
    "action": "upload_pdf",
    "file": "statement_Mar2025.pdf"
  },
  "step2": {
    "action": "ocr_extract",
    "input_file": "statement_Mar2025.pdf",
    "output_text": "raw_text.json"
  },
  "step3": {
    "action": "layout_detect",
    "input_text": "raw_text.json",
    "components": "components.json"
  },
  "step4": {
    "action": "parse_components",
    "input": "components.json",
    "records": "extracted_records.json"
  },
  "step5": {
    "action": "store_structured",
    "input": "extracted_records.json",
    "database": "transactions_table"
  },
  "step6": {
    "action": "embed_context",
    "input": "raw_text.json",
    "vector_db": "doc_vectors"
  },
  "step7": {
    "action": "user_query",
    "query": "What were my credit card expenses last quarter?",
    "process": ["embed_query", "vector_retrieve", "LLM_generate"]
  }
}

Use Cases / Scenarios

Limitations / Considerations

Fixes (common pitfalls with solutions)

FAQs

Q: What bank statement formats are supported?
A: Generic PDF format. Because the system uses object detection and OCR, any layout can potentially be supported but new layouts may require additional training.

Q: Can I run the model offline?
A: Yes — the README suggests using open-source LLM models locally ("prefer use local open LLM models"). (GitHub)

Q: What languages are supported?
A: The project was written with English in mind (bank statements in English). For other languages, you’ll need OCR language models and embeddings for that language.

Q: How accurate is the extraction and query system?
A: The README mentions using TruLens or W&B for evaluation of LLM (answer relevance, accuracy, recall, precision) but does not publish numeric accuracy. You’ll need to test on your data.

Q: What vector database is used?
A: Not specified explicitly; generic “Vector Database” is mentioned. You could use open-source alternatives like Pinecone, Weaviate, Milvus, or Faiss.

References

Conclusion

The project offers a comprehensive pipeline for converting PDF bank statements into structured financial data and enabling natural language interaction and analytics via LLM + RAG. For users with many statements and a desire for self-service financial insights, this is a compelling architecture.

Implementation will require attention to layout variability, OCR quality, embedding/retrieval tuning, and privacy/security controls. With those addressed, the system can significantly reduce manual effort and support deeper personal or small-business financial insight.