SYS // MITTENS

Mittens

offline•PROTOTYPE•2026•Hackathon Sprint (2026)

Multi-stage narrative verification pipeline validating character backstory consistency across 100k+ word novels with 80% accuracy.

Stack

PythonGemini FlashBM25Pathway

01 // THE CHALLENGE

Verifying Narrative Truth Across 100,000+ Word Classic Novels

Who hurts:AI Researchers & Narrative Consistency Systems

Checking whether hypothetical character backstories align with full-length classic novels breaks standard retrieval pipelines. Full books exceed practical context windows, and key contradictory details are often scattered across non-adjacent chapters.

Core Bottlenecks

Zero tolerance for temporal and causal hallucinations across 100k+ word literary texts
Crucial contradictory evidence is often distributed across non-adjacent narrative arcs
Standard RAG models confuse absence of explicit mention with active factual contradiction

02 // WHAT IT DOES

Atomic Claim Extraction & Character-Aware Novel Verification

Mittens validates complex character backstories against full-length classic novels (100k+ words) without blowing context windows or hallucinating contradictions.

01Atomic Parsing

Atomic Claim Extraction

Breaks multi-sentence backstory paragraphs into single-fact atomic claims using rule-based boundary detection and conjunction splitting.

020.5s Index

Character-Boosted BM25 Search

Indexes 2,740 novel excerpts in memory with character-name frequency boosting to pull relevant narrative evidence in under 0.5s.

03Zero Hallucination

Asymmetric Decision Scoring

Evaluates claims against retrieved passages with Gemini Flash, scoring neutral or ambiguous facts without triggering false contradictions.

03 // SYSTEM BLUEPRINT

Multi-Stage Constraint Decomposition & Verification Pipeline

Decomposes unstructured backstories into atomic factual constraints, queries a 2,740-chunk book index using character-decorated BM25 search, verifies claims in parallel via Google Gemini Flash, and applies calibrated asymmetric aggregation.

Execution Flow Sequence

1.Backstory Ingestion
2.Clause Decomposition (claims.py)
3.Character-Decorated BM25 Retrieval
4.Zero-Temp Gemini Batch Inference
5.Resilient JSON Truncation Repair
6.Asymmetric Decision Aggregation

Claim Decomposer

claims.py

Regex sentence boundary & coordinator splitting extracting atomic claims

BM25 Retriever

0.5s Index

Pre-chunked 2,740 passages (280 words, 40 overlap) with character name boosting

Batch Verifier & Aggregator

Gemini Flash

Single-call zero-temp Gemini Flash verification with asymmetric uncertainty resolution

03 // THE HARD PROBLEM

Escaping the 'Neutral Trap': The 25% → 80% Breakthrough

Retrieval Uncertainty Collapsed Initial System Accuracy to 25%

Because classic novels distribute narrative facts subtly across hundreds of pages, sparse BM25 retrieval frequently missed non-explicit passages. In response, Gemini appropriately returned 'neutral' verdicts. Naive aggregation heuristics interpreted absence of evidence as contradiction ('if all_neutral -> return 0'), dropping accuracy to 25%, below random guessing.

What Was Tried & Failed
  • ✕Rule-based keyword matching (v1.0) failed completely on temporal order and negation, achieving ~35% accuracy
  • ✕Local DeBERTa-v3 NLI on CPU (v2.0) took 30s per claim (240s-720s per example) while misinterpreting narrative metaphors
  • ✕Strict aggregation (all neutral = fail) caused massive false-rejections for plausible, non-contradictory backstories
What Worked & Shipped

Formalized an asymmetric uncertainty aggregation heuristic in decision.py: when no explicit contradictions exist and evidence is neutral, the system grants the benefit of the doubt ('all_neutral and no_contradictions -> 1'). Contradictory backstories almost always surface at least one explicit conflict, while consistent ones often suffer from sparse retrieval silence. Combined this with single-call batch verification and JSON truncation auto-repair.

04 // ARCHITECTURAL TRADEOFFS

Deliberate Engineering Choices & Pragmatic Sacrifices

Key technical tradeoffs balancing inference latency, cross-platform portability on Windows/Linux, and deterministic verifiability under hackathon constraints.

Chose: Google Gemini Flash Zero-Temp Batch APIoverLocal HuggingFace DeBERTa-v3 NLI on CPU

Rationale: DeBERTa took 30s per claim on CPU (240s-720s per example) and struggled with literary discourse. Gemini Flash processed all claims in parallel in 15s with zero GPU requirement.

Resulting Impact: Reduced per-example latency from 720s to 15s (48x speedup) while boosting classification accuracy from 55% to 80%.

Chose: BM25Okapi with Character Decoration & Disk CachingoverDense Vector Database (Pathway / MiniLM)

Rationale: Literary character names, locations, and ship titles are distinct lexical entities. Dense embeddings added 5-10s embedding overhead, broke on Windows without WSL, and provided <5% accuracy gain.

Resulting Impact: Achieved 0.5s indexing time for 2,740 chunks with <10ms query latency across all operating systems without GPU dependencies.

Chose: Calibrated Deterministic Rule LogicoverSecondary LLM-as-a-Judge Prompt

Rationale: Using a second LLM to make the final binary verdict introduced stochastic hallucinations, doubled API latency/cost, and obscured why a specific claim was rejected.

Resulting Impact: Guaranteed 100% reproducible test runs and exact audit trails linking back to specific claim-passage contradictions.

05 // MEASURED BENCHMARKS

Quantitative Performance & Verification Efficiency

Profiled across 81 training backstories and 60 blind test evaluations over 2,740 novel passages.

Verification Accuracy

80%

+47pp over majority/random baseline

Inference Latency

15-20s

35x-48x speedup over CPU DeBERTa

Corpus Index Time

0.5s

2,740 chunks (280 words, 40 overlap)

Accuracy Evolution (v1.0 -> v3.1)

Continuous Benchmarking

* Audited using Python 3.13 on standard CPU hardware with Google Gemini 3 Flash Preview.

06 // SPRINT REALITY

Hackathon Constraints, Scope Cuts & Sprint Lessons

Shipped in Window

Complete end-to-end Python pipeline with atomic claim decomposition, BM25 indexing over 2,740 chunks, Gemini Flash batch verification, and asymmetric decision aggregation.

Scope Cut Under Crunch

  • ·Dense Pathway vector server: cut due to Windows compatibility issues and high latency, using pure Python BM25 with equal accuracy
  • ·Local DeBERTa-v3 NLI workers: cut after profiling showed 240s-720s inference times per example on CPU
  • ·Cross-document co-reference graphs: replaced with lexical character query decoration to stay within sprint boundaries

With 48 More Hours

Construct explicit temporal constraint graphs to track chronological character states and relationship evolutions across chapter boundaries.

Crucial Takeaway

“In long-context narrative reasoning, handling retrieval silence with calibrated asymmetric domain logic produces far higher accuracy gains (+55pp) than adding heavier neural embedding layers.”

07 // VERIFIED ARTIFACTS

Source Code, Documentation & Research Deliverables

Open-source codebase, comprehensive architectural documentation, and hackathon technical report.