WFGY/ProblemMap/hallucination.md
2025-07-28 10:25:16 +08:00

105 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🧠 Problem: Hallucination from Irrelevant Chunks
### 📍Context
In traditional RAG pipelines, even with high-quality vector retrieval, LLMs often hallucinate — generating confident but untrue answers.
This usually happens when:
- The retrieved chunk is semantically nearby but **not logically relevant**
- The model proceeds to answer anyway, without awareness of uncertainty
---
## 🚨 Why It Fails in Standard RAG
| Failure Mode | Explanation |
|--------------|-------------|
| Cosine similarity overestimates semantic relevance | A chunk may be close in embedding space but not conceptually useful |
| No detection of logical tension | LLMs dont measure how far the answer drifts from the prompt |
| No fallback when unstable | The system doesn't pause or recover — it just keeps going |
---
## ✅ WFGY Solution
WFGY solves this using a 3-layer protocol:
1. **ΔS Measurement**
- Measures semantic jump between current intent and retrieved content
- If ΔS > 0.6, it triggers a memory checkpoint or logic inspection
2. **λ_observe Vector**
- Monitors if the logic flow is convergent (→), divergent (←), recursive (<>), or chaotic (×)
- Divergence + high ΔS = red flag
3. **BBCR Activation (CollapseRebirth Correction)**
- Instead of bluffing, the system tries to:
- Re-anchor with a nearby Tree node
- Ask for clarification
- Or gracefully stop reasoning
---
## 🛠 How to Trigger This in TXT OS
```txt
Step 1 — Start the console
> Start
Step 2 — Paste a misleading or vaguely relevant chunk
> "The company handbook mentions refunds for products purchased through retail affiliates..."
Step 3 — Ask an unrelated question
> "What is the international warranty policy for direct purchases?"
WFGY will:
- Measure ΔS between question and chunk
- Detect logic instability
- Prevent confident hallucination
````
---
## 🔬 Example Behavior
Instead of:
> "Yes, we offer a 5-year international warranty on all items."
Youll get something like:
> "The content you provided doesnt seem to address international warranty directly.
> Would you like to clarify the source or expand the question?"
This is **semantic integrity**, not just better prompting.
---
## 🔗 Related Modules
* `BBMC` — Residue Minimization to match logical anchors
* `BBCR` — CollapseRebirth Correction
* `λ_observe` — Logic vector monitoring
* `ΔS` — Semantic jump detection
* `Semantic Tree` — To record and backtrack logic
---
## 📌 Status
| Item | Status |
| ------------------------------ | --------------------------------- |
| ΔS detection | ✅ working |
| λ\_observe | ✅ working |
| BBCR | ✅ stable |
| Auto fallback to user | ✅ basic version |
| External retriever integration | 🛠 planned (manual input for now) |
---
Let us know if you want to try hallucination stress-testing — we have sample prompts.