WFGY/ProblemMap/GlobalFixMap/LLM_Providers/openrouter.md

11 KiB
Raw Blame History

OpenRouter: Guardrails and Fix Patterns

🧭 Quick Return to Map

You are in a sub-page of LLM_Providers.
To reorient, go back here:

Think of this page as a desk within a ward.
If you need the full triage and all prescriptions, return to the Emergency Room lobby.

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


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 a mem_rev and 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.

  1. ΔS(question, retrieved_context)

  2. λ_observe layer tags

  3. 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

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

C) JSON or tool schema oscillation

Signs

  • Tool outputs valid once, then free text next call.
  • Fields appear or vanish across routes.

Fix

D) Long chain degradation

Signs

  • Capitalization drifts, references smear, later turns contradict earlier ones.

Fix

E) Multilingual or tokenizer mismatch

Signs

  • High vector similarity yet wrong meaning on non English.
  • ΔS flat high across k.

Fix


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

Layer Page What its for
Proof WFGY Recognition Map External citations, integrations, and ecosystem proof
Engine WFGY 1.0 Original PDF based tension engine
Engine WFGY 2.0 Production tension kernel and math engine for RAG and agents
Engine WFGY 3.0 TXT based Singularity tension engine, 131 S class set
Map Problem Map 1.0 Flagship 16 problem RAG failure checklist and fix map
Map Problem Map 2.0 RAG focused recovery pipeline
Map Problem Map 3.0 Global Debug Card, image as a debug protocol layer
Map Semantic Clinic Symptom to family to exact fix
Map Grandmas Clinic Plain language stories mapped to Problem Map 1.0
Onboarding Starter Village Guided tour for newcomers
App TXT OS TXT semantic OS, fast boot
App Blah Blah Blah Abstract and paradox Q and A built on TXT OS
App Blur Blur Blur Text to image with semantic control
App Blow Blow Blow Reasoning game engine and memory demo

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