Building a safe, consistent story pipeline.
StoryBuddy is powered by a deterministic LangGraph architecture. We strictly use open-weight models and prioritize child safety, PII redaction, and narrative consistency above all else.
From Prompt to Storybook.
Watch how our pipeline orchestrates open-weight models in real-time to convert a raw story input into a fully illustrated, safety-checked picture book.
The Architecture
Our pipeline consists of 11 deterministic nodes. There is no autonomous routing; conditional edges exist only at the moderation checkpoints, the reference reveal, the consistency check and the step that picks the next page. Explore the sequence below.
Input Gate
meta-llama/llama-guard-4-12b text check (gpt-oss-safeguard backstop) + Presidio identifier redaction.
Analyze
Mistral Small 3.2 lists the characters, objects and places.
Segment
Mistral Small 3.2 splits the story into pages and writes each drawing direction.
Character Bible
fal.ai Qwen-Image draws one canonical reference per main character.
Char Ref Mod
Mistral Small 3.2 image safety check + Gemma-3-27B rubric backstop.
Reveal
Pauses until the references are accepted; up to 3 “try again” taps redraw them.
Generate Scene
fal.ai Qwen-Image-Edit draws each page from the references.
Consistency Check
Gemma-3-27B judge compares each page with the references.
Output Mod
Safety pass on each finished page, inside the scene loop.
Compose
Assembles the book and writes it to Supabase.
The science behind the magic.
StoryBuddy is built on rigorous quantitative-developmental research. These are the four core pillars driving our methodology and engineering decisions.
1. Safety & Ethics by Design
"Child safety isn't an afterthought or a cloud filter—it is structural and localized."
When Grade 5–6 children author stories about their real lives, privacy cannot rely on black-box cloud defaults. StoryBuddy implements a localized, non-negotiable multi-stage safety stack.
- Localized PII Redaction: We deploy custom Filipino recognizers via Presidio to intercept localized address structures and Philippine identifier formats (mobile numbers, TIN, SSS, PhilHealth) before storage or export.
- Dual Independent Classifiers: Chained safety gates run on both text (meta-llama/llama-guard-4-12b + gpt-oss-safeguard-20b) and images (Mistral Small 3.2 + Gemma-3-27B rubric).
- Non-Punitive Failure States: System refusals present supportive, age-appropriate UI guidance so children are never penalized.
2. Open-Weight Mandate
"Democratizing AI storytelling without per-seat licensing barriers."
Proprietary model APIs create severe cost barriers and vendor lock-in, placing AI tools out of reach for provincial public schools. StoryBuddy runs entirely on open-weight models to ensure long-term reproducibility.
- 100% Open-Weight Stack: Driven by Mistral Small 3.2, Qwen-Image, Qwen-Image-Edit, and Gemma-3-27B.
- Zero Per-Seat Vendor Fees: Self-hostable architecture designed so any school can deploy the platform on standard infrastructure.
- Architectural Sovereignty: Building with open weights forces safety and identity control into deterministic logic rather than relying on black-box promises.
3. Reason-Then-Score Validation
"Eliminating generative identity drift to preserve the child's authentic story."
Unconditioned image generators drift across pages. StoryBuddy turns character identity from a prompt-hoping gamble into deterministic application state.
- Reason-Then-Score VLM Judge: Evaluates generated scenes against canonical references using field-order discipline, preventing post-hoc rationalization.
- Targeted Regeneration: The extracted failure taxonomy feeds directly into up to two prompt-corrected retries; the best attempt is kept.
- Story Memory: Main characters are rendered once up front. Subsequent scenes are strictly reference-conditioned.
4. Pre-Registered Methodology
"Rigorous academic research, pre-registered plans, and a novel dataset contribution."
StoryBuddy is built on quantitative-developmental research (Boehm's Spiral SDLC) backed by pre-registration. It addresses a critical void in current AI evaluation: identity retention for stylized, non-human characters.
- Addressing the Benchmark Gap: StoryBuddy builds and evaluates human pairwise identity judgments over invented non-human characters.
- Non-Circular Evaluation: The internal VLM judge never grades its own homework. Book acceptability is evaluated independently by an expert validation panel.
- Stage-Gated Risk Resolution: Early throwaway probes test fundamental assumptions against pre-declared kill criteria.