DEV Community

Cover image for Bill & Document Sloth: A Local-First AI Paperwork Manager with Gemma & TabPFN
Ayush Gupta
Ayush Gupta

Posted on

Bill & Document Sloth: A Local-First AI Paperwork Manager with Gemma & TabPFN

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Bill & Document Sloth is a 100% local-first, privacy-conscious AI document assistant, tabular forecaster, and deadline tracker designed around one core promise: "Stop sorting paperwork. Start living."

Every adult and student dreads the paperwork shuffle: opening randomly named files like IMG_20261021_124532.pdf, hunting through fine print for payment due dates, losing track of appliance warranty periods, and maintaining brittle manual spreadsheets.

Bill & Document Sloth does the heavy lifting so you can be as lazy as a sloth:

  • Drop Paperwork Once: Drag and drop PDFs, receipts, or phone bills.
  • Intelligent Local Extraction: Local open-source AI extracts the issuer, category, total amount, due date, document date, and invoice number.
  • Smart Standardized Filenames: Automatically generates clean filenames (e.g., 2026-10_Electricity_Bill_BESCOM.pdf).
  • Human-in-the-Loop Review: Split-screen side-by-side verification with confidence scores before any file is moved.
  • Safe Organization & Undo: Files are organized into structured directories (documents/organized/{Category}/{Year}/) with 1-click reversible undo.
  • Proactive Deadlines: Monitors overdue bills, payments due in 3 days, and expiring warranties before penalties strike.

Demo

  • Direct YouTube Link: Watch Video Demo on YouTube
  • GitHub Repository: https://github.com/Ayushgupta1715/bill-and-document-sloth
  • Local Interactive Dashboard: Runs locally on http://127.0.0.1:8000 with Swagger API docs at http://127.0.0.1:8000/docs.
  • 1-Click Built-in Demo Pack: Synthesizes realistic BESCOM Electricity Bills, Airtel Fiber Invoices, AppleCare Warranty Certificates, Star Health Insurance Policies, and Coffee Receipts on the fly so evaluators can test immediately with one click!

Code

🦥 Bill & Document Sloth

“Stop sorting paperwork. Start living.”
A 100% Local-First AI Document Assistant & Deadline Tracker for Hacktoberfest 2026 Week 3: Slow and Steady (#hf26challenge).

Bill & Document Sloth CI Deploy to Render

🎥 Watch 1-Minute Demo Video on YouTube | Download Local MP4


🌟 The "Slow and Steady" Philosophy

In celebration of International Sloth Day and Hacktoberfest Week 3, Bill & Document Sloth is built around a simple truth: AI should do the tedious, repetitive paperwork so you don't have to.

Instead of spending precious hours deciphering confusing PDF bills, calculating payment deadlines, renaming cryptic camera scans, and maintaining brittle spreadsheets:

  1. Drop your documents once.
  2. Local AI extracts the essentials (Issuer, Category, Due Date, Total Amount, Invoice Number).
  3. Approve with 1 click.
  4. Relax. Your files are organized into structured directories and payment deadlines are tracked automatically.

🏆 Hacktoberfest 2026 Sponsor Track Integrations

To maximize utility and showcase open innovation, Bill & Document…


How I Built It

The application combines local-first inference, open-weight reasoning models, and tabular foundation models:

  1. Local-First Processing Engine:
    • Backend: FastAPI, Python 3.14, SQLite3, PyPDF for embedded text extraction, and ReportLab for synthetic sample generation.
    • Frontend: Clean, responsive single-page application built with Tailwind CSS, Lucide icons, and Canvas Confetti.
  2. Google Gemma Open-Weight Model (gemma-2-2b-it):
    • Integrated in app/gemma_service.py to provide deep structured JSON parsing and field reasoning traces for complex or ambiguous bills.
  3. Prior Labs TabPFN-3.5 Foundation Model:
    • Integrated in app/tabpfn_analyzer.py to perform in-context tabular regression and outlier detection over historical billing cycles (forecasting next month's utility spend and alerting on anomalous spikes).
  4. ElevenLabs Voice Integration:
    • Integrated in app/voice_service.py to give the sloth agent a calm, spoken audio briefing of pending bills and deadlines.
  5. Safe File Operations:
    • Keeps original uploads pristine in documents/uploads/ while organizing approved files in documents/organized/{Category}/{Year}/. Full audit trail in actions_history table for 1-click safe undo.

Why Does Open Innovation Matter?

When building an assistant for bills, leases, and receipts, sending files to closed cloud LLM APIs poses major privacy and cost concerns:

  1. Absolute Data Privacy: Utility bills and tax invoices contain home addresses, bank details, and personal identifiers. With open-source local inference and SQLite, zero bytes of private data leave the device.
  2. Zero Recurring Cloud Token Costs: Users shouldn't pay monthly API subscriptions or per-token charges just to organize their receipts. Open-weight models like Gemma and tabular foundation models like TabPFN run locally on consumer hardware for free.
  3. Total Offline Resilience: Works on a train, in airplane mode, or during internet blackouts.
  4. User Sovereignty & Control: Unlike opaque cloud systems that silently alter data, our pipeline enforces human verification and reversible undo actions.

The Lazy Payoff

  • Time Saved: Manually opening, reading, renaming, and filing 10 bills takes roughly 20–25 minutes. With Bill & Document Sloth, dropping them into the app and clicking "Approve" takes under 45 seconds — a 95% reduction in manual effort.
  • Zero Spreadsheet Maintenance: Upcoming deadlines (due in 3 days, due today, overdue) are monitored automatically, preventing costly late-payment surcharges.
  • Peace of Mind: You can be as lazy as a sloth, knowing every warranty, receipt, and utility bill is categorized and safely filed on your machine.

Prize Categories

Featured Categories:

  • Best Use of Gemma ($200): Integrated Google's Gemma-2 open-weight model (gemma-2-2b-it) for deep structured bill parsing, confidence verification, and reasoning traces (app/gemma_service.py).
  • Best Use of TabPFN ($200): Integrated Prior Labs' TabPFN-3.5 tabular foundation model (app/tabpfn_analyzer.py) to forecast next month's utility spending and detect billing cost anomalies (+40% outliers).
  • Best Use of Render ($200): Included production render.yaml (Render Blueprint) and multi-stage Dockerfile for 1-click cloud deployment.

Partner Categories:

  • Best Use of ElevenLabs ($100): Sloth Voice Briefings (app/voice_service.py) delivering spoken audio briefings of upcoming bills and paperwork deadlines.
  • Best Use of Sentry Agent Tracing ($100): Instrumented with sentry-sdk in app/main.py for tracking document ingestion latency, OCR performance, and extraction errors.
  • Best Use of a .tech Domain ($100): Production DNS and routing ready for slothdocs.tech.
  • Best Use of GitHub Copilot & Actions ($100): Comprehensive automated CI pipeline (.github/workflows/ci.yml) validating 20 unit and integration tests on every push.

Top comments (7)

Collapse
 
alexcodebytes profile image
Oleksandr •

"Human-in-the-loop review: split-screen side-by-side verification with confidence scores before any file is moved" is the right design for a document organizer.

Most AI tools just move files and hope the extraction was correct. If it gets the due date wrong, you miss a payment. If it gets the amount wrong, you overpay. The review step is what makes this safe to use on real bills.

Curious how the confidence scores are calculated. Is it based on the model's own confidence (which can be wrong), or do you have a separate validation step?

Collapse
 
ayush_gupta_17 profile image
Ayush Gupta •

"Spot on! An LLM’s self-reported confidence is often miscalibrated, so we don't rely on it alone.

We use a separate deterministic validation layer:

Anchor Matching: High confidence for strict semantic phrases ('Amount Due', 'Due Date') vs lower confidence for generic fallbacks.
Sanity & Logic Checks: Dates must pass strict format parsing and calendar range checks (due_date >= bill_date). Amounts are scrubbed to prevent year numbers (2025/2026) or invoice codes from being picked as currency.
Entity Whitelisting: Known issuers get matched against an entity list (0.95), while fallback text gets discounted.

If any field or the composite score drops below 0.75, the split-screen UI flags it for manual review. Thanks for asking this — deterministic validation before file-move is essential for financial peace of mind!"

Collapse
 
alexcodebytes profile image
Oleksandr •

This is a masterclass in practical document extraction. The amount scrubbing to prevent year numbers (like 2025) from being picked up as currency is such a specific, brilliant catch—LLMs definitely get confused by that without strict constraints. And the due_date >= bill_date check is exactly why deterministic logic layers are non-negotiable for financial data.

One follow-up question: when a field drops below the 0.75 threshold and gets flagged for manual review, does the human's correction automatically update the whitelist/anchors for future runs? Or is it just a one-time fix for that specific document?

I'm really curious how you handle that feedback loop to stop the system from making the same mistake twice!

Thread Thread
 
ayush_gupta_17 profile image
Ayush Gupta •

"That's a fantastic observation!

Currently, human corrections mark the document as is_verified = 1 in SQLite and log the audit trail. This immediately improves TabPFN’s tabular forecasting and anomaly detection, which trains directly on verified past bills.

However, for text extraction itself, the regex anchors and issuer lists are currently static to ensure deterministic stability. We didn't want auto-mutating regexes to accidentally break other templates in the MVP!

On our immediate roadmap is an active-learning feedback loop:

Auto-saving corrected issuers into a dynamic custom_issuers SQLite table with 0.95 confidence for future runs.
Using previous verified documents as few-shot prompts for Gemma when encountering ambiguous layouts from the same vendor.

Awesome question — closing that local learning loop is definitely the next big milestone!"

Thread Thread
 
alexcodebytes profile image
Oleksandr •

Keeping the regex static for the MVP was definitely the right call—auto-mutating regexes are an absolute debugging nightmare. But using past verified documents as few-shot prompts for Gemma is a brilliant way to handle ambiguous layouts without the overhead of fine-tuning."

"Quick question on the roadmap: when you inject those few-shot examples, are you just grabbing the most recent verified docs from that vendor, or are you using a vector search to find the most semantically similar layout? Really looking forward to seeing how the active-learning loop performs!

Collapse
 
mininglamp profile image
Mininglamp •

The split-screen human-in-the-loop review before moving files is a nice touch. Most doc organizers just auto-sort and hope for the best, but showing confidence scores and letting you fix mistakes before commit is way more practical for real bills where one wrong due date means a late fee. The 1-click demo pack is also great for anyone evaluating it without uploading their own docs.

Collapse
 
ayush_gupta_17 profile image
Ayush Gupta •

"Thank you so much! That was exactly the core philosophy while building this. With financial documents and utility bills, 95% accuracy isn't good enough if that 5% mistake ends up causing a late penalty or missed warranty deadline. We wanted the AI to do the tedious extraction and renaming, but keep the user firmly in the driver’s seat with full transparency through confidence scores and reversible undo.

And the 1-click demo pack was built precisely so anyone can test drive the full intelligence pipeline without risking their own sensitive paperwork. Really appreciate you taking the time to check it out and share such thoughtful feedback!