mirror of
https://github.com/onestardao/WFGY.git
synced 2026-04-28 11:40:07 +00:00
12 KiB
12 KiB
OpenRouter: Guardrails and Fix Patterns
A practical checklist to keep responses stable while routing through OpenRouter. Use this page when behavior flips across models, routes, or sessions.
Acceptance targets
- ΔS(question, context) ≤ 0.45
- λ stays convergent across 3 paraphrases
- Coverage ≥ 0.70 for citation style QA
- Snippet ↔ citation table present
Quick links
- Visual map and recovery: RAG Architecture & Recovery
- End to end knobs: Retrieval Playbook
- Why this snippet: Retrieval Traceability
- Logic repair: Logic Collapse & Recovery
- Long chain drift: Context Drift
- Entropy melt: Entropy Collapse
- Data schemas: Data Contracts
- Embedding vs meaning: Embedding ≠ Semantic
- Multilingual: Multilingual Guide
- Ops and live triage: Debug Playbook · Live Monitoring
1) Minimal setup checklist
Pin these before debugging model logic.
- Route selection
Use explicit model ids. Disable any auto fallback if you need reproducibility. Log the final route id that served the request. See Retrieval Traceability. - System prompt handling
Ensure the system message is always sent in the payload. Do not rely on UI side memory. If sessions change tabs, stamp amem_revand reload the system block. See patterns: memory desync. - Token limits and truncation
Verify max tokens per route. Truncation that drops headers will spike ΔS. Reorder context with a citation first schema. See Data Contracts. - JSON and tool calling
Fix the exact function schema. Return to plain text if tool calls vary across sub models. If JSON strictness wobbles, clamp with a cite then answer envelope. See Logic Collapse & Recovery. - Temperature and top_p
Keep one of them fixed. If variance climbs during long dialogs, apply BBAM and reduce randomness. See Entropy Collapse. - Streaming flags and timeouts
Disable streaming during audits to capture full text. Set sane timeouts and retries at the client.
2) Quick triage with WFGY instruments
Run this order. Stop as soon as you localize the fault.
-
ΔS(question, retrieved_context)
- ΔS ≥ 0.60 → perception issue. Check chunking and route level truncation.
- Open Retrieval Playbook and Hallucination.
-
λ_observe layer tags
- retrieval convergent, reasoning divergent → interpretation collapse.
- Open Logic Collapse & Recovery.
-
E_resonance vs length
- E rises with length while ΔS stays high → entropy melt, clamp variance.
- Open Entropy Collapse.
3) Common failure patterns on OpenRouter and fixes
A) Silent route change or fallback
Signs
- Same prompt flips tone or format between calls.
- Logs show a different backing model id.
Fix
- Pin a single route id. Record the final served model in traces.
- Recheck ΔS. If still high, audit prompt headers and truncation.
- Read Retrieval Traceability and Debug Playbook.
B) System prompt dropped after tab or session swap
Signs
- First answer follows policy, later turns forget constraints.
- λ flips divergent only after a refresh.
Fix
- Stamp
mem_revandmem_hashper turn. Reload system block when mismatch. - See patterns: memory desync and Data Contracts.
C) JSON or tool schema oscillation
Signs
- Tool outputs valid once, then free text next call.
- Fields appear or vanish across routes.
Fix
- Wrap with citation first schema, then answer.
- Apply BBCR bridge step when λ turns divergent at reasoning.
- Open Logic Collapse & Recovery and Data Contracts.
D) Long chain degradation
Signs
- Capitalization drifts, references smear, later turns contradict earlier ones.
Fix
- Apply semantic chunking on inputs.
- Stabilize with BBAM, then re anchor with section headers.
- Read Context Drift and Entropy Collapse.
E) Multilingual or tokenizer mismatch
Signs
- High vector similarity yet wrong meaning on non English.
- ΔS flat high across k.
Fix
- Switch to multilingual embeddings or normalize analyzer.
- See Embedding ≠ Semantic and Multilingual Guide.
4) Verification and regression gates
Use this short gate before merging changes.
- Retrieval sanity
Coverage ≥ 0.70 on target section. ΔS(question, context) ≤ 0.45. - Reasoning stability
λ remains convergent across three paraphrases. No schema leak. - Traceability
Produce snippet ↔ citation table per answer. See Retrieval Traceability. - Long dialog check
E_resonance stays flat at window joins. See Entropy Collapse.
5) Escalation criteria
Change structure when any holds.
- ΔS remains ≥ 0.60 after prompt and retrieval fixes
Rebuild index or adjust analyzer. See Retrieval Playbook. - λ flips divergent as soon as two sources are mixed
Enforce source fences and SCU. See Data Contracts. - JSON mode cannot hold across routes
Disable tool calls for that path. Return to plain text with citation first. See Logic Collapse & Recovery.
🔗 Quick-Start Downloads (60 sec)
| Tool | Link | 3-Step Setup |
|---|---|---|
| WFGY 1.0 PDF | Engine Paper | 1️⃣ Download · 2️⃣ Upload to your LLM · 3️⃣ Ask “Answer using WFGY + <your question>” |
| TXT OS (plain-text OS) | TXTOS.txt | 1️⃣ Download · 2️⃣ Paste into any LLM chat · 3️⃣ Type “hello world” — OS boots instantly |
🧭 Explore More
| Module | Description | Link |
|---|---|---|
| WFGY Core | WFGY 2.0 engine is live: full symbolic reasoning architecture and math stack | View → |
| Problem Map 1.0 | Initial 16-mode diagnostic and symbolic fix framework | View → |
| Problem Map 2.0 | RAG-focused failure tree, modular fixes, and pipelines | View → |
| Semantic Clinic Index | Expanded failure catalog: prompt injection, memory bugs, logic drift | View → |
| Semantic Blueprint | Layer-based symbolic reasoning & semantic modulations | View → |
| Benchmark vs GPT-5 | Stress test GPT-5 with full WFGY reasoning suite | View → |
| 🧙♂️ Starter Village 🏡 | New here? Lost in symbols? Click here and let the wizard guide you through | Start → |
👑 Early Stargazers: See the Hall of Fame — Engineers, hackers, and open source builders who supported WFGY from day one.
⭐ WFGY Engine 2.0 is already unlocked. ⭐ Star the repo to help others discover it and unlock more on the Unlock Board.