DEV Community

Cover image for LatePay β€” know which invoices will ghost you, before they do πŸ’Έ
Arin Dewangan
Arin Dewangan

Posted on

LatePay β€” know which invoices will ghost you, before they do πŸ’Έ

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission πŸ’Έ

LatePay β€” know which invoices will ghost you, before they do πŸ’Έ

DEV Hacktoberfest AI Challenge β€” Week 2: Side Hustle.


Every freelancer knows the feeling: the work is delivered, the invoice is sent, and then… silence. Cash flow is the oxygen of a side hustle, and one late payer can choke it for a month.

So I built LatePay β€” a late-payment risk predictor that scores every outstanding invoice with TabPFN, the open-source tabular foundation model, and tells you what to do about it: chase now, ask for partial upfront, send a reminder, or relax.

πŸ”— Live demo: https://arindewangan.github.io/latepay/demo/ (precomputed TabPFN outputs, clearly labeled simulated)
πŸ’» Repo: https://github.com/arindewangan/latepay

What it does

  • Score an invoice β€” enter the amount, client history (tenure, prior late rate, average days to pay), contract strength, and payment terms. TabPFN returns P(paid > 30 days past terms) as a risk band: HIGH / MEDIUM / ELEVATED / LOW.
  • Get one clear action β€” HIGH β†’ chase now and pause further billable work; MEDIUM β†’ require 50% upfront before the next milestone; ELEVATED β†’ send a polite nudge on the due date; LOW β†’ normal terms.
  • Batch-score a CSV β€” upload your invoice list and download a scored risk report with a recommendation per row. Missing history columns fall back to an honest new-client baseline.
  • Explore offline β€” the static demo ships 4 real client profiles plus a what-if grid (late rate Γ— contract Γ— amount), every cell a real precomputed TabPFN prediction, build-dated and labeled simulated.

How it's built

A Python/Flask backend with a vanilla HTML/CSS/JS frontend. The pipeline:

  1. data/build_dataset.py generates a SIMULATED invoice-history dataset (4,000 invoices, seeded RNG) with 12 features per invoice β€” amount, client tenure, prior invoice count, prior late rate, average days to pay, contract strength, payment terms, client size, international flag, invoice month.
  2. At request time, TabPFNClassifier(device="cpu") β€” fitted in-context on that dataset in risk.py β€” predicts the late-payment probability for the new invoice. No gradient training, no API key, no proprietary models.
  3. The GitHub Pages demo bakes real precomputed TabPFN outputs via demo/build_demo.py (build date stamped on the page) so it works with zero backend.

The honest hard parts

TabPFN's license gate. The latest tabpfn releases (β‰₯2.1) demand interactive license acceptance at install time β€” a non-starter for a fully automated pipeline. So requirements.txt pins tabpfn==2.0.6 β€” the same version that proved itself in our Week 1 build (Frostwise). Same proven path, zero new surprises.

Attention is O(nΒ²) on CPU. Our dataset has 4,000 simulated invoices, but fitting TabPFN in-context on all 4,000 rows made per-request inference painfully slow on CPU. The trade-off, documented in risk.py: a seeded, label-stratified 1,000-row subsample as the inference context β€” per-request scoring stays in the seconds range. The full 4,000-row CSV still ships as the data artifact; the demo's precomputed grid used the same setup.

Synthetic data means synthetic confidence. The model learned real, sensible patterns β€” a clean client scores 5.0% late risk, a serial late-payer 63.4% β€” but it has never seen a real invoice. That's why every demo screenshot, every CSV row, every UI badge says SIMULATED, and the README states plainly: these are risk estimates for prioritising follow-ups, not financial advice, not a credit score.

What I'm proud of

  • Real open-source-AI core: local TabPFN inference on real (simulated) tabular data, reproducible end-to-end from the repo β€” no API keys, no proprietary models, no fake "AI" labels.
  • An honest demo: every number on the static page is a real precomputed TabPFN prediction, build-dated and labeled SIMULATED.
  • CSV batch scoring that degrades gracefully β€” missing history columns fall back to a new-client baseline instead of erroring.
  • A UI a non-technical freelancer can actually use: one form, one gauge, one action.

What I learned

Technical: TabPFN genuinely collapses tabular ML to a one-liner β€” fit in-context, no training loop, no feature engineering β€” and the risk separation it produced was immediately sensible (5.0% LOW vs 63.4% HIGH). For a prioritisation tool like this, calibration across bands matters far more than any single accuracy number.

Process: honesty is a feature, not a tax. My first banner render shipped with an invented "94.2% accuracy" line in the artwork β€” I threw it out and regenerated it clean. Labeling simulated data visibly, pinning versions honestly, documenting the 1000-row trade-off: the write-up is stronger for every one of those, and this challenge weights writing most heavily.

What's next

  • Let freelancers import real invoice history (Stripe/Invoicely exports) so the context set is their own data, not simulated.
  • Per-client portfolio view: total at-risk revenue across all outstanding invoices.
  • Email reminder templates wired to the ELEVATED band's nudge schedule.

How it uses open-source AI

LatePay's risk core is TabPFN v2 (tabpfn, an open-source tabular foundation model). We generate a simulated invoice-history dataset locally, and TabPFN fits in-context on it and predicts P(payment > 30 days past terms) per invoice at inference time β€” all on local CPU. No proprietary models or API keys are involved anywhere in the pipeline.


Built with: Python, Flask, TabPFN (open-source), JavaScript. License: MIT.

Top comments (0)