Short questions on a new topic are treated as follow-ups and searched in the old topic's papers

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
search

Research direction

Start with QueryRewriter.classify_mode and should_rewrite in src/chatty/rag/rewriter.py, then trace how LitkitProvider.augment in src/chatty/rag/litkit_provider.py uses the mode and cached paper shortlist. Add tests for the listed HIV-to-CRISPR and shingles topic changes, including whether new-topic queries skip rewriting and refresh the shortlist; done when those cases no longer reuse old-topic context.

Written by the indexing model from the issue text.

Description

area: rag bug wrong-result

QueryRewriter.classify_mode (src/chatty/rag/rewriter.py:227) returns FOLLOWUP for any query under 200 characters (SHORT_QUERY_THRESHOLD), and for any query starting with how, why, what about or and (FOLLOWUP_PATTERNS, line 72). LitkitProvider.augment (src/chatty/rag/litkit_provider.py:919) then reuses the previous turn's paper shortlist for FOLLOWUP queries, skipping stage 1. The reused IDs are cached again (line 948), so the shortlist is never refreshed until a query is classified NEW_TOPIC.

Separately, should_rewrite (line 268) ignores the mode: any query under 200 characters is rewritten with the previous conversation as context, including queries classified NEW_TOPIC.

With a previous turn about HIV latency:

Query mode rewritten
How does CRISPR-Cas9 editing work? FOLLOWUP yes
Which vaccines are approved for shingles in adults over 50? FOLLOWUP yes
Tell me about CRISPR NEW_TOPIC yes

Effect: after the first question, most short questions on a new topic search only the papers shortlisted for the old topic (500 by default), so the answer cites unrelated papers or finds nothing. New-topic queries are also rewritten using the old topic's terms.

Fix: treat a short query as a follow-up only when it has a follow-up signal (pronouns, references to earlier answers), and skip rewriting when the mode is NEW_TOPIC. Tests should cover topic changes like the ones above.

Dominant language
Python
Stars
0
Forks
2
Avg merge
1d 4h
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/chatty

All issues in lanl/chatty

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.