← Back to projects
2026AILLMPythonReact

An Untrustworthy Wikipedia

As we trust AI more and more for our information, this version of Wikipedia demonstrates the risks of AI-generated content by blending truth with fiction.

I would argue that Wikipedia, now more than ever, is a critical resource for society. Its reliability, at a time when we are increasingly trusting of and reliant on AI, is a beacon of hope. This project isn't meant to diminish the value of Wikipedia in any way. Instead, it highlights the fragility of trust when every article is generated by AI. On WikipedAI, some of what you'll see is trustworthy, based on fact. The rest...

A page that falls in the 70% of AI-generated articles
A page that falls in the 70% of AI-generated articles

The Prompt Strategy

The core of WikipedAI is a weighted prompt selection system. When you request any article, the backend randomly selects from five different prompt templates, each with its own probability weight:

python
PROMPT_WEIGHTS = [ (REALISTIC_PROMPT, 30), # Factual Wikipedia article (PAGE_PROMPT_SCIFI, 15), # "Mundane Vertigo" — plausible but absurd (PAGE_PROMPT_UNCANNY, 25), # Uncanny valley — questions what's real (PAGE_PROMPT_UNCANNIER, 20), # Deep uncanny — mundane expert details (REALISTIC_BUT_OFF_PROMPT, 10), # Factual, but one detail is wrong ]

So roughly 30% of articles are genuinely factual Wikipedia entries. 10% are almost right but have one subtle error (wrong date, wrong height, wrong location). The remaining 60% fall on a spectrum of fabrication, from the "Mundane Vertigo" style that invents boring regulatory histories for real things, to the "Uncannier" mode that fabricates with such mundane expert-level detail that you second-guess whether it's real.

Each fabricated prompt also gets a random thematic lens (industrial manufacturing, medical research, financial markets, telecommunications, etc.) that grounds the invented institutions, historical incidents, and incidental details in a specific domain. The Wikipedia voice is always maintained: neutral, academic, detached, with specific dates and precise quantities.

Streaming Generation

Articles are generated on-demand using Gemini's streaming API. The frontend uses partial-json to parse the incomplete JSON as it arrives, progressively rendering sections, infobox data, and wiki-style links while the model is still writing. This gives the experience of watching an article materialize in real time.

One thing I discovered early on: using Gemini's responseSchema with the streaming endpoint causes their constrained-decoding path to buffer the entire response before flushing, completely defeating progressive rendering. Without the schema constraint, tokens stream in real time at roughly 100-200ms chunks. The prompt itself instructs the exact JSON structure, so the schema isn't needed for correctness.

When the stream completes, the server parses the full JSON, normalizes the infobox, injects archive URLs into news citations, validates the page structure, and persists it. A __FINAL__ sentinel is appended after the raw stream so the client can swap in the post-processed version (with archive URLs and normalized wiki links) without a second round-trip.

The Page Schema

Every article is structured JSON with a consistent schema that the frontend parser renders into the familiar Wikipedia layout:

json
{ "title": "...", "slug": "...", "pageType": "person|place|thing|event|media|general", "subtitle": "...", "infobox": { "title": "...", "image": {...}, "rows": [...] }, "sections": [ { "id": "...", "title": "...", "level": 2, "paragraphs": [{ "content": "..." }], "subsections": [...] } ], "references": [ { "id": 1, "text": "Author (Year). Title. Publisher." } ] }

Wiki links use the format [[Display Text|slug]] and the frontend parses these into navigable links. Clicking a link generates a new article on the fly. References use inline [N] markers that link to a fabricated (but plausible) citations section. The LLM is prompted to make 2-3 citations from major news outlets (Reuters, BBC, The Guardian), and those get special treatment with archive URLs.

Storage and Caching

The storage layer abstracts between local filesystem (for development) and GCS (for production). Slugs are normalized into safe filesystem keys with a two-character prefix directory structure for long keys. If the same URL slug is requested again, the stored JSON is served instantly without hitting Gemini. This keeps costs down and makes frequently visited pages fast.

The site runs on GCP: the wiki frontend and the FastAPI backend are both standalone Cloud Run services. The frontend (React + Vite) proxies /api requests to the backend in development, and in production the routing handles it via nginx.

A page that falls in the 30% of factual articles
A page that falls in the 30% of factual articles

The Aesthetic Choices

Images are all randomly generated colored blobs. This is partly to keep costs low (no image generation API calls), but also to reinforce that this is not a serious source of truth. The blobs are visually distinct enough to give each article a unique feel without ever suggesting real imagery.

The frontend is a faithful recreation of the Wikipedia UI: table of contents, infobox, section headers, reference footnotes, wiki-style internal links, even the appearance menu for light/dark mode and font preferences. The closer the experience is to real Wikipedia, the more effective the commentary about trust and AI-generated information.

A demo of the site in action