Skip to main content
Home / Portfolio / Pension AI
FinTech

Pension AI

AI-powered retirement planning with Monte Carlo simulations

Built by Rogue AI · Retirement planning with an AI advisor · Production since 2026

Started January 2026 — wanted a retirement calculator that didn't lie about confidence intervals. Monte Carlo engine in February, RAG advisor on top in March. Currently in private beta with two test users, one is me. Latest commit: April 2026.

Pension AI — AI-powered retirement planning with Monte Carlo simulations

The problem

Retirement calculators come in two flavors: oversimplified single-slider toys, or spreadsheets with forty tabs that nobody maintains. Neither explains why your trajectory looks the way it does, and neither answers follow-up questions like 'what happens if I retire three years earlier?'

What I built

A web app combining Monte Carlo portfolio simulation (10,000 market paths) with an LLM advisor that interprets the distribution, stress-tests scenarios, and answers natural-language questions. Users input their current savings, contribution rate, target retirement age, and asset allocation — the engine returns a trajectory with a p10/p50/p90 confidence band and a plain-language narrative.

Architecture

Next.js frontend
App Router, server components, charting via recharts
Simulation engine
Python worker running Monte Carlo with configurable return distributions, inflation, sequence-of-returns risk, spending-shock scenarios
Scenario storage
PostgreSQL persists every user scenario and simulation run for longitudinal comparison
RAG advisor
Ollama-hosted model with injected context (user inputs, simulation results, asset-class priors)
Auth
NextAuth v5 with Prisma adapter

Tech stack

Next.js 16React 19PostgreSQL 16pgvectorRedis 7OllamaDocker

What broke first

  • Running 10,000 paths client-side was a non-starter — page jank was visible. Pushed simulation to a Python worker behind a queue; dropped from 'unusable' to sub-2-second for a 10k-path run.

  • Picked pgvector at 1024 dimensions because more felt smarter. It wasn't. Halved to 768 after measuring retrieval quality; index size dropped, recall didn't budge.

  • Prisma 7 snake_case migration was the biggest yak shave of the project. Burned a day on PrismaPg adapter wiring before schema and queries lined up.

Outcome

Users see their retirement trajectory across 10,000 simulated market paths and can ask 'what if I retire three years earlier' or 'what if markets return 2% below historical' in plain language. All data stays on the owner's infrastructure — no third-party financial APIs.

Honest limits

Returns are modeled log-normal — standard, but understates fat-tail and regime-shift risk. The LLM advisor outputs include a non-fiduciary disclaimer because that's what it is. DE/EN parity in UI, but tax assumptions are German-specific — US users get the math, not the tax shape.

Related reading

← Back to portfolio