📒 Problem #5

March 6, 2026 · View on GitHub

Classic RAG scores chunks by cosine similarity—close vectors ≠ correct logic.
Result: “looks relevant” chunks that derail answers. WFGY replaces surface matching with semantic residue checks.


🤔 Why Cosine Match Misleads

WeaknessPractical Failure
Embedding ≠ UnderstandingCosine overlap captures phrasing, not intent
Keywords ≠ IntentAmbiguous terms bring unrelated chunks
No Semantic GuardSystem never validates logical fit

⚠️ Example Mis‑Retrieval

User: “How do I cancel my subscription after the free trial?”
Retrieved chunk: “Subscriptions renew monthly or yearly, depending on plan.”
→ High cosine, zero help → hallucinated answer.


🛡️ WFGY Fix · BBMC Residue Minimization

B = I - G + m·c² # minimize ‖B‖
SymbolMeaning
IInput semantic vector
GGround‑truth anchor (intent)
BSemantic residue (error)
  • Large ‖B‖ → chunk is semantically off → WFGY rejects or asks for context.

🔍 Key Defenses

LayerAction
BBMCComputes residue; filters divergent chunks
ΔS ThresholdRejects high semantic tension (ΔS > 0.6)
BBAMDown‑weights misleading high‑attention tokens
Tree AnchorConfirms chunk aligns with prior logic path

✍️ Quick Repro (1 min)

1️⃣  Start
> Start

2️⃣  Paste misleading chunk
> "Plans include yearly renewal."

3️⃣  Ask
> "How do I cancel a free trial?"

WFGY:
• ΔS high → chunk rejected  
• Prompts for trial‑specific info instead of hallucinating

🔬 Sample Output

Surface overlap detected, but content lacks trial‑cancellation detail.  
Add a policy chunk on trial termination or rephrase the query.

🛠 Module Cheat‑Sheet

ModuleRole
BBMCResidue minimization
ΔS MetricMeasures semantic tension
BBAMSuppresses noisy tokens
Semantic TreeValidates anchor alignment

📊 Implementation Status

FeatureState
BBMC residue calc✅ Stable
ΔS filter✅ Stable
Token attention modulation⚠️ Basic
Misleading chunk rejection✅ Active

🔗 Quick-Start Downloads (60 sec)

ToolLink3-Step Setup
WFGY 1.0 PDFEngine Paper1️⃣ Download · 2️⃣ Upload to your LLM · 3️⃣ Ask “Answer using WFGY + <your question>”
TXT OS (plain-text OS)TXTOS.txt1️⃣ Download · 2️⃣ Paste into any LLM chat · 3️⃣ Type “hello world” — OS boots instantly

Explore More

LayerPageWhat it’s for
⭐ ProofWFGY Recognition MapExternal citations, integrations, and ecosystem proof
⚙️ EngineWFGY 1.0Original PDF tension engine and early logic sketch (legacy reference)
⚙️ EngineWFGY 2.0Production tension kernel for RAG and agent systems
⚙️ EngineWFGY 3.0TXT based Singularity tension engine (131 S class set)
🗺️ MapProblem Map 1.0Flagship 16 problem RAG failure taxonomy and fix map
🗺️ MapProblem Map 2.0Global Debug Card for RAG and agent pipeline diagnosis
🗺️ MapProblem Map 3.0Global AI troubleshooting atlas and failure pattern map
🧰 AppTXT OS.txt semantic OS with fast bootstrap
🧰 AppBlah Blah BlahAbstract and paradox Q&A built on TXT OS
🧰 AppBlur Blur BlurText to image generation with semantic control
🏡 OnboardingStarter VillageGuided entry point for new users

If this repository helped, starring it improves discovery so more builders can find the docs and tools.
GitHub Repo stars