Skip to content

Doc-search answers are ungrounded when KB index is empty / sparse — model hallucinates plausibly wrong facts #211

Description

@pluginslab

Context

After landing #209 Fix 1 (PR #210), the doc-search path correctly bypasses tool selection. But on an empty / unindexed knowledge base, the model answers from training data alone and confidently fabricates specifics.

Repro

  1. Book button on
  2. Knowledge base not indexed (or query has no hits)
  3. Ask: "Whats the hook that allows me to inject content in the footer?"
  4. Model answers: "The hook that allows you to inject content in the footer is `footer_init`…"

`footer_init` is not a real WordPress hook. The correct answer is `wp_footer`.

Root cause

  • Default model is Qwen 3 1.7B — knowledge gaps on specifics.
  • Doc-search path's no-hits system prompt currently says "answer from general WordPress knowledge and tell them no local docs were found." That permits free-form answering, doesn't strongly enforce "say you're unsure when uncertain."
  • No factual grounding mechanism when the KB is empty.

Proposed fixes (any subset)

  • Tighter prompt when no hits. Push the model to "only answer if you are confident; otherwise, ask the user to index docs or rephrase."
  • Surface KB state in the UI. If the KB index is empty when the user toggles the book button, show a one-time warning: "Knowledge base is empty — answers will fall back to general model knowledge."
  • Encourage indexing in onboarding. Currently you have to opt in to KB indexing manually; with the book button being prominent, a first-run nudge to index would close the loop.
  • Citations. When RAG context is used, include `path:lines` citations in the answer so users can verify (and the model is forced to ground statements in context).

Out of scope

  • Improving model accuracy on small Qwen — that's an external-provider migration concern, separate from this UX gap.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions