PalPage: Anchoring New Words in Your Life

The Spark

Every week, my six-year-old reads a French picture book. Halfway through page three, there would be a word I don't recognize, and the reading session stalls. My first instinct used to be to grab a dictionary app—but opening it meant leaving the beautiful illustrations behind, looking up a dry definition, and returning to a story that felt suddenly foreign. By the next week, the word was gone.

I realized my child wasn't missing a dictionary; they were missing an anchor. Existing flashcard apps taught words in isolation, detached from the scene where they belonged. I wanted something that stayed in the page and gave every new word a place in our real life. So I built PalPage.

The Solution: Staying in the Story

PalPage lets you paste text or photograph a book page. The app rebuilds the layout as tappable words. Tap any unknown word, and instead of just getting a definition, you get a personalized memory hook: a single sentence written around objects and routines from your own household (e.g., "the old fountain pen drew an étoile in the blue mug").

Then comes the closed learning loop: every tapped word goes into a persistent Wordbook, which feeds into a flashcard review system. You don't just look things up; you accumulate them, and review them alongside the story that birthed them.

How I Built It with Nebius & NVIDIA

The entire inference pipeline runs on a single model: nvidia/Nemotron-3.5-Super-VL through Nebius Token Factory.

I chose this approach to keep the voice consistent and simplify the failure paths. One API call (an OpenAI-compatible /v1/chat/completions) handles three distinct jobs in sequence:

  1. Page Transcription: Converting a photographed book page into tappable text.
  2. Multilingual Definition: Generating short, age-appropriate definitions in English, Chinese, or French.
  3. Memory Hook Writing: Stitching the definition with user-supplied "home keywords" into a memorable sentence.

The frontend and API run on Cloudflare Workers, using Cloudflare D1 for per-user persistence. For extra depth, I integrated Tavily to provide background stories and etymologies for curious readers.

Challenges Faced

1. The "Validation Loop" for Memory Hooks

The hardest part wasn't getting the AI to write sentences—it was making sure they actually worked as memory anchors. If a generated hook hallucinated a keyword, spelled the target word wrong, or used it twice, the mnemonic failed. To fix this, I implemented a server-side hard-validator. Every candidate sentence is checked against strict constraints:

  • The target word must appear exactly once in its original spelling.
  • Exactly one anchor keyword must survive verbatim; others can be paraphrased.
  • The sentence cannot start with a keyword. If any check fails, the server retries the model prompt with specific error feedback ("Keyword 'balcony garden' is missing; rewrite ensuring it stays intact"). It turned a probabilistic LLM into a reliable constraint-satisfaction engine.

2. Balancing Latency and Token Budgets

Vision-Language models (VLMs) are heavy. I had to squeeze transcription, definitions, and creative writing out of one model without burning credits or making the UI feel sluggish. I tuned max_tokens aggressively per job (4096 for OCR, 80 for definitions, 140 for hooks). I also discovered that reasoning_effort: "none" is mandatory for this specific Nemotron model variant; without it, the model consumes the entire token budget and returns empty content—a silent failure that looks exactly like a backend outage.

What I Learned

On AI constraints: I learned that an LLM isn't just a generator; it's a draft assistant. When you pair it with deterministic validation logic (the retry loop above), you get reliability without needing massive, specialized training runs. The "boring" engineering—the validators and prompt-rewriting retries—was what actually made the product feel robust.

On Nebius Token Factory: Integrating was frictionless thanks to the OpenAI-compatible endpoint. From a latency perspective, uncached definitions hit in ~0.15s, which feels instant; full-page photo transcription took ~2.2s end-to-end, which is acceptable given the quality of output. I also learned that regional endpoints (us-north1) curate different model catalogs than the global endpoint, so checking availability early saves debugging headaches later.

On Pedagogy: The biggest surprise was how well "home anchoring" works compared to generic example sentences. A definition like "étoile = star" is factual but fragile. A sentence that ties it to the user's own balcony garden creates a vivid cognitive hook. Technology can give us facts; personalization gives us memory.

Built With

  • ai-integration
  • cloudflare-d1
  • cloudflare-workers
  • edgetts
  • edtech
  • family-learning
  • flashcard-system
  • javascript
  • large-language-model
  • multilingual-ai
  • nebius-token-factory
  • nvidia-nemotron
  • ocr-/-computer-vision
  • prompt
  • python
  • rag-(retrieval-augmented-generation)
  • tavily-api
  • vision-language-model
  • web-app
Share this project:

Updates

Submission history