Skip to content

LAMB does not emit inline citations in Knowledge Store RAG answers #430

Description

@NoveliaYuki

Problem

The LAMB completion pipeline does not generate inline citations (e.g. [N] references) in its answers, even when retrieved Knowledge Store context is used. The model is never instructed to cite, and the retrieved context is concatenated as raw text with no per-chunk numbering.

Concretely, in the Knowledge Store RAG path:

  • knowledge_store_rag.py and query_rewriting_ks_rag.py build the context string and the sources list in two separate, uncorrelated loops, so there is no stable number linking a context chunk to its source.
  • The kvcache_augment prompt processor injects an ## Available Sources list only when a prompt_template is set, never tells the model to cite, and reads source.get("similarity") while Knowledge Store sources carry score — so the relevance value always renders as 0.000. In the no-prompt_template fallback branch the sources block is dropped entirely.

As a consequence there is no citation signal in answers (and, separately, downstream evaluation has no citation faithfulness to measure).

Expected

When a Knowledge Store RAG assistant answers using retrieved context, the answer should contain inline [N] markers that line up with a numbered sources list whose links resolve via LAMB's permalink proxy.

Scope

Knowledge Store path only (knowledge_store_rag, query_rewriting_ks_rag, shared kvcache_augment PPS). The legacy simple_rag/simple_augment path is left unchanged for backward compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions