WFGY/ProblemMap/GlobalFixMap/PromptAssembly/citation_first.md
2025-09-05 11:38:59 +08:00

9.9 KiB
Raw Blame History

Citation-First Prompting — Guardrails and Fix Pattern

🧭 Quick Return to Map

You are in a sub-page of PromptAssembly.
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.

Stabilize evidence-based answers by requiring citations before explanation. This page gives a minimal contract, validation steps, and fast routes to structural fixes when citations vanish, drift, or point to the wrong text.

Open these first

When to use

  • Answers sound right but show no citations.
  • Citations appear but dont align with the quoted text.
  • Different runs cite different sections for the same question.
  • After reranking, citations drift or vanish.
  • Multi-turn dialogs slowly lose the cite-then-explain order.

Acceptance targets

  • Cite-then-explain compliance ≥ 0.98 over 50 queries.
  • Field completeness ≥ 0.99 for: snippet_id, section_id, source_url, offsets, tokens.
  • ΔS(question, retrieved) ≤ 0.45 and stable across 3 paraphrases.
  • Coverage ≥ 0.70 to the target section.
  • λ convergent across two seeds.

Fix in 60 seconds

  1. Enforce the contract
    The model must cite before any reasoning. Reject outputs that invert the order.

  2. Validate fields
    Require the full snippet schema. Reject partial or fuzzy references.

  3. Pin rerank & order
    If citations change with header tweaks, lock your header order and rerank configuration.

  4. Probe ΔS and λ
    If ΔS stays high while citations look plausible, rebuild chunking or metrics.


Minimal prompt block to paste


System:
You must CITE before you EXPLAIN.
Required fields per snippet: snippet\_id, section\_id, source\_url, offsets, tokens.
Order is strict:

1. "citations": \[...]
2. "answer": "..."

If citations are missing or fields incomplete, STOP and return:
{"citations": \[], "answer": "", "next\_fix": "open data-contracts & retrieval-traceability"}

User:
Question: "\<user\_question>"
Top-k retrieved: <passed from retriever>
Acceptance: ΔS(question,retrieved) ≤ 0.45; coverage ≥ 0.70.


JSON response shape (auditable)

{
  "citations": [
    {
      "snippet_id": "S-28391",
      "section_id": "SEC-3.2",
      "source_url": "https://...",
      "offsets": [2312, 2450],
      "tokens": 172
    }
  ],
  "answer": "…",
  "λ_state": "→|←|<>|×",
  "ΔS": 0.37
}

Typical breakpoints → exact fix

  • Citations missing but answer present Reject and re-emit with the contract. Open: Data Contracts

  • Citation fields incomplete or wrong offsets Enforce the full schema, verify offsets/tokens against the corpus. Open: Retrieval Traceability

  • High similarity but wrong meaning Rerank or rebuild with correct metric/normalization. Open: Retrieval Playbook, Embedding ≠ Semantic

  • Header tweak breaks citations Freeze header order; clamp variance with BBAM. Open: Logic Collapse

  • Long runs lose citation discipline Split plan, bridge with BBCR; add mid-chain citation checks. Open: Context Drift, Entropy Collapse


Validator stub (copy into your pipeline)

Step 1  parse JSON strictly → if fail, stop.
Step 2  require citations[].length ≥ 1 before answer.
Step 3  verify fields & offsets; reject if any missing.
Step 4  compute ΔS and coverage; block if ΔS>0.45 or coverage<0.70.
Step 5  log λ across three paraphrases; alert if non-convergent.

Eval gates before ship

  • Cite-then-explain ≥ 0.98 on 50 queries.
  • Field completeness ≥ 0.99.
  • ΔS ≤ 0.45, coverage ≥ 0.70, λ convergent on two seeds.

🔗 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 FameGitHub stars WFGY Engine 2.0 is already unlocked. Star the repo to help others discover it and unlock more on the Unlock Board.

WFGY Main   TXT OS   Blah   Blot   Bloc   Blur   Blow