Infinimap

An endless map that visitors and a language model build together, one cell at a time, on a single GPU in my homelab.

A part of the Infinimap world: coloured cells with an emoji and a one-word name each, such as Village, Bridge, Road, Crossroads, Market, Temple, Forest and Tavern, among empty cells still to discover.

checking whether the map is up…

Open the map ↗

How it plays

  • Click an empty cell. The model looks at the eight cells around it and proposes three to five things that could be there, each a one-word name, an emoji and a colour. You pick one; if you don't within 30 seconds, the server picks by the model's weights. The others stay in the cell's details as what it could have been.
  • Double-click (or long-press) to go inside. Every cell opens into a 10×10 map of its own: the world has towns, a town has a market, the market has stalls. Four levels deep.
  • The first visitor inside sets its theme, such as "busy river port", and everything found in there follows it.
  • It's shared and live. Everyone sees new cells appear as they're found, and the queue for the GPU is visible on the map.

Getting a small model to answer fast and on format

  • One consumer GPU. Qwen3.5-4B, quantised to 4 bits, runs in llama.cpp on an 8 GB RTX 2070 SUPER, with all layers in VRAM.
  • Replies on format, and a plan for when they aren't. The reply's JSON Schema is turned into a grammar, so the model can only write the expected shape: three to five options, one capitalised word, an emoji, a colour from a 16-name palette, and a weight from 1 to 10. A grammar doesn't stop a reply from being cut off or timing out, so the server still checks every option and drops the ones that break a rule. If nothing usable is left, or the model fails or takes too long, the click fails cleanly: everyone watching is told, and the cell is free to click again. One bad reply never leaves a cell stuck.
  • Short answers. Compact JSON with one-word names is about 95 tokens, less than half of the first version's.
  • Speculative decoding with the model's own heads. The model's multi-token-prediction (MTP) heads draft the next tokens and the full model checks them in one pass. I tried a separate small draft model first; the built-in heads did much better.
  • Pre-generation. While nobody is waiting, the server asks about empty cells next to the newest ones on maps someone is watching. A click there shows its options at once; in a test with a click every five seconds, more than half were instant. A real click cancels a running pre-generation.

How it runs

The path of a clickA visitor's browser reaches the edge VM over HTTPS. The edge limits POST requests per address and sends the request through the WireGuard tunnel into the cluster. The Infinimap server, in its own public namespace, queues the click and asks the model server in the internal ai namespace, which runs on the GPU. New cells go back to every watching browser as server-sent events.Browser · canvas pageHTTPSEdge VMCrowdSec · POST limit per IPWireGuard tunnelinfinimap · public namespaceGo server: queue, limits, GPU budgetpre-generation · live events (SSE)snapshot every minute → diskonly this path is allowedllama-server · internal ai namespaceQwen3.5-4B · grammar · MTPone GPU, one request at a time
The click goes in through the same edge and tunnel as every public app. The model server isn't public: a NetworkPolicy lets only the game's namespace reach it.
  • One GPU, shared fairly. It does one cell at a time. Each address can have two cells pending and ten clicks a minute, and the edge adds its own limit on top. A budget of 300 model calls an hour keeps the GPU from running flat out; when it's spent, the map says it's resting and when new land comes back, while pre-generated cells still open.
  • Small and boring on purpose. The server is Go with only the standard library; the page is plain HTML, CSS and JavaScript on a canvas, with a strict Content Security Policy and no third-party anything.
  • The world survives restarts. It lives in memory and is written to disk as gzipped JSON every minute when it changed, and on shutdown: a temporary file, synced, then renamed over the old one, so a crash leaves the last good copy.
  • Deploys are merge requests. A merge to main builds the image, and CI opens a merge request that moves the deployed tag to that build. Merging it deploys, through Flux.
  • Typed text is filtered. Themes go through a word filter that sees through case, accents, look-alike digits, repeated and spaced-out letters, in English and Polish.

What the map processes about you (very little: no cookies, no analytics) is on its privacy page. For the platform underneath, see how the homelab is built →. The code is in infinimap/ in the public repository ↗.