Skip to content

CONCEPT Cited by 1 source

LLM icon hallucination

Definition

LLM icon hallucination is a specific code-generation failure mode where a language model references icons from an icon library "that no longer exist or never existed." The hallucination is linguistically plausible (the emitted symbol is a grammatical React component import, spelled like other icon names) but references a symbol the library doesn't actually export — so the generated code fails to compile.

Canonical Vercel framing

"By default, v0 uses the lucide-react icon library. It updates weekly, adding and removing icons. This means the LLM will often reference icons that no longer exist or never existed."

(Source: sources/2026-01-08-vercel-how-we-made-v0-an-effective-coding-agent)

Why icon libraries are the paradigmatic case

Icon hallucination is a sharply-defined instance of a broader class (library-API hallucination) because three properties cluster:

  1. Namespace churn velocity — icon libraries release weekly, far faster than any retrain. (concepts/training-cutoff-dynamism-gap at its most extreme.)
  2. Large symbol space — thousands of icons → high hallucination probability per emitted import.
  3. Semantic neighbourhood — icon names like VercelLogo have close embedding-space neighbours (Triangle) that are often visually acceptable substitutes, so a repair mechanism (not just detection) is feasible.

The Vercel mitigation

v0 treats icon hallucination with a deterministic embedding-resolution pipeline inside LLM Suspense:

  1. Embed every icon name from the live library in a vector DB (re-indexed on library updates).
  2. Analyse actual lucide-react exports at runtime.
  3. If the emitted icon exists → pass through.
  4. If it doesn't exist → embedding-search for the nearest real export.
  5. Rewrite the import line during streaming so the user never sees the broken intermediate.

Completes in <100 ms per substitution with no further model calls — the fix is purely deterministic nearest-neighbour over a pre-embedded corpus.

Worked example: a "Vercel logo icon" generation produces

import { VercelLogo } from 'lucide-react'
which gets rewritten to
import { Triangle as VercelLogo } from 'lucide-react'
— triangle is the nearest real icon; aliased to VercelLogo so the downstream JSX doesn't need to be rewritten.

Generalisation beyond icons

The pattern — "library with churning symbol namespace + large number of symbols + meaningful embedding neighbourhood" — applies to:

  • Emoji libraries — shortcodes churn, semantic neighbours usually acceptable.
  • Component libraries with many similarly-named components (e.g. Material UI, Chakra UI) where the model may emit a non-existent-but-plausible component name.
  • Tailwind class names (at arbitrary-value cutoffs) where the semantic neighbour is often usable.

Seen in

Last updated · 476 distilled / 1,218 read