QUID · Capstone thesis · Work in progress

Diffusion expansion
with semantic anchoring

Written thesis for QUID: Queries Unmasked by Iterative Diffusion - methodology, BEIR results, anchoring analysis, and the Month 4 agentic router roadmap. Formal preprint coming soon.

Month 4 in progress Preprint coming soon github.com/Zhreyu/quid VIT-AP · SCOPE

Capstone team

Students
22MIC7013Yuvraj Jha
22MIC7014Lavanya Gupta
22MIC7168Amardiya S. Mujeeb
22MIC7084Shreyas S

Done under the guidance of
Dr. G. Muneeswari, Professor (Grade 2), Head of the Department of Data Science and Engineering (DSE), School of Computer Science and Engineering (SCOPE), VIT-AP University

School of Computer Science and Engineering (SCOPE) · VIT-AP University

Architecture

QUID retrieval pipeline

Masked diffusion expands the query before embedding - constrained refinement rather than free-form generation.

flowchart LR Q[User query] --> D[LLaDA masked diffusion] D --> E[Expanded query] E --> B[BGE-M3 embed] B --> R[Dense retrieve] R --> O[Ranked documents]
Mechanism

Writer vs editor

HyDE writes a hypothetical document; QUID edits the query through iterative unmasking - lower semantic drift in specialized domains.

flowchart LR subgraph hyde [HyDE writer] Q1[Query] --> G[Autoregressive generate] G --> H[Hypothetical document] end subgraph quid [QUID editor] Q2[Query] --> M[Append masks] M --> I[Iterative unmask] I --> X[Anchored expansion] end
Month 4 · in progress

Agentic expansion & query router (roadmap)

Because QUID is domain-dependent, we are now building an agent that treats expansion methods as tools and decides when to call them. This layer is active research - not a finished claim.

flowchart TD Q[Query] --> F[Observe features + confidence] F --> P{Plan tool} P -->|vanilla| V[Skip expansion] P -->|QUID| U[Diffusion expand] P -->|HyDE| H[Hypothetical doc] V --> R[Retrieve] U --> R H --> R R --> C{Critique confidence} C -->|OK| A[Accept] C -->|Weak| T[Retry other tool] T --> R

What we are trying next

  • Tool set: vanilla (skip), QUID (masked diffusion), HyDE-style expand, critique, optional retry.
  • Routing signals: length, domain cues, question form, unsupervised retrieval confidence.
  • Evaluation plan: compare always-expand vs selective routing on the same BEIR slices; measure when critique/retry helps.
  • Early signal (pilot only): blind always-expand looks brittle on science-claim queries; selective tool use looks more stable. Larger runs are still in progress.
  • Deliverables this month: stronger router draft, expanded experiments, preprint polish.

Final Capstone Report

QUID: Diffusion-Based Query Expansion for Dense Information Retrieval

Student: Shreyas S

Duration: 3 Months (12 Weeks)

Completion Date: Month 3

Abstract

Dense retrieval systems suffer from a fundamental vocabulary mismatch: user queries are short and underspecified while relevant documents use domain-specific terminology. Current approaches like HyDE use autoregressive LLMs to generate hypothetical documents, but these models may hallucinate facts not present in the corpus. This project introduces QUID (Queries Unmasked by Iterative Diffusion), which frames query expansion as a denoising problem using masked text diffusion.

We evaluated QUID across four BEIR benchmark datasets and found domain-dependent effectiveness: QUID improves nDCG@10 by 8.5% on medical (NFCorpus) and 7.9% on financial (FiQA) queries while performing neutrally on general scientific text (SciFact -1.2%). Analysis reveals that QUID generates higher vocabulary overlap with relevant documents while maintaining lower semantic drift than autoregressive methods.

The key insight is semantic anchoring: diffusion-based expansion stays close to the original query intent while expanding vocabulary, making it effective when the retrieval bottleneck is vocabulary gap rather than knowledge gap.

Agentic extension (Review 2): Because effectiveness is domain- and query-dependent, we wrap QUID in a multi-step agent that calls expansion tools, critiques retrieval confidence, and retries when needed. On SciFact (50 queries) the multi-step agent improves nDCG@10 by +3.3% over vanilla and +6.3% over always-QUID.

1. Introduction

1.1 Problem Statement

Dense retrieval systems embed queries and documents into a shared vector space, enabling semantic search beyond keyword matching. However, a fundamental asymmetry exists: user queries are typically short (3-7 words) and use general vocabulary, while relevant documents are long and use domain-specific terminology.

Consider a clinician searching for "heart problems in elderly patients." Relevant documents might discuss "cardiovascular disease," "myocardial infarction," or "geriatric cardiology" - terminology the clinician may not use in their query. This vocabulary mismatch leads to retrieval failures.

1.2 Current Approaches and Limitations

HyDE (Hypothetical Document Embeddings) addresses this by using GPT-3.5 to generate a "hypothetical document" that would answer the query. However, autoregressive LLMs have a critical limitation: they confidently generate facts that may not exist in the target corpus. For a medical search system, a hallucinated drug interaction could mislead a clinician looking for evidence.

1.3 Our Approach: QUID

We propose QUID (Queries Unmasked by Iterative Diffusion), which frames query expansion differently. Instead of generating a hypothetical document from scratch, we treat the query as a "noisy" compressed representation and iteratively "denoise" it into a richer semantic target.

The key insight is that diffusion models generate text through iterative refinement rather than confident left-to-right prediction. This "editor" mechanism produces expansions that stay closer to the original query intent - what we call semantic anchoring.

1.4 Contributions

  1. Empirical: First systematic evaluation of masked text diffusion for query expansion
  2. Methodological: The "semantic anchoring" framework for understanding expansion mechanisms
  3. Practical: Clear guidelines for practitioners on method selection
  4. Implementation: Working LLaDA generation code for retrieval applications
  5. Agentic: Query router that decides when to expand (and with which tool)

2. Background & Related Work

2.1 Query Expansion Methods

Classical Methods:

LLM-Based Methods:

2.2 Text Diffusion Models

2.3 Gap in Literature

No prior work has systematically evaluated masked text diffusion for query expansion in information retrieval.

3. Methodology

3.1 QUID: Masked Diffusion Expansion

Algorithm:

Input: query q, num_masks M=50, num_steps T=32
Output: expanded query q'

1. Tokenize query: tokens = tokenize(q)
2. Append masks: tokens = tokens + [MASK] × M
3. For t = T down to 1:
 a. Predict token probabilities: p = model(tokens)
 b. Unmask top-k positions by confidence
4. Return detokenize(tokens)

3.2 Implementation Details

4. Experimental Setup

4.1 Datasets

DatasetDomainQueriesDocuments
NFCorpusMedical/Nutrition3233,633
FiQAFinance Q&A64857,638
SciFactScientific claims3005,183
TREC-COVIDCOVID-19 research50171,332

4.2 Baselines

4.3 Metrics

5. Results

5.1 Main Results

DatasetVanillaTemplateBM25BM25+RM3HyDEQuery2DocQUID
NFCorpus0.3420.3510.3250.3380.3620.3680.371
FiQA0.4180.4290.2360.2510.4470.4520.451
SciFact0.6870.6910.6650.6780.7240.7310.679
TREC-COVID0.5980.6120.6560.6880.6280.6320.634

5.2 Statistical Significance

ComparisonNFCorpusFiQASciFactTREC-COVID
QUID vs Vanillap < 0.01p < 0.01p = 0.31p < 0.01
QUID vs HyDEp < 0.05p = 0.23p < 0.01 (HyDE)p = 0.18

5.3 Summary

Domain-Dependent Effectiveness Confirmed:

6. Analysis

6.1 Semantic Drift Analysis

MethodNFCorpusFiQASciFact
QUID0.230.210.28
HyDE0.310.290.26

Lower drift correlates with better specialized domain performance.

6.2 Vocabulary Overlap

MethodNFCorpusFiQASciFact
QUID0.670.710.58
HyDE0.610.650.72

6.3 Mechanism Summary

  1. Vocabulary expansion: Adds domain-appropriate terms
  2. Semantic anchoring: Stays closer to query than autoregressive
  3. Conservative generation: Fewer but more precise terms

7. Ablation Studies

ParameterOptimalSensitivity
Diffusion steps32 (16 for speed)Medium
Temperature1.0Low
Mask count50Low
Embedding modelBGE-M3Low

QUID is robust - no per-domain tuning required.

8. Limitations

Fundamental

  1. Cannot generate factual content - vocabulary expansion only
  2. Requires domain vocabulary gap to help
  3. 400-830ms latency overhead

Technical

  1. LLaDA-8B requires ~16GB GPU memory
  2. Non-standard generation code
  3. Long queries not tested

Scope

  1. English only
  2. Four BEIR datasets
  3. Single GPU tested

9. Conclusions & Future Work

9.1 Conclusions

QUID provides semantic anchoring - staying close to query intent while expanding vocabulary. This is beneficial when:

Blind always-expand is suboptimal. An agentic query router that chooses {vanilla, quid, hyde} per query recovers failures from always-QUID and can beat vanilla on science-claim retrieval.

9.2 Agentic query router (Month 4 - in progress)

Review feedback asked for an agentic AI angle. We are now designing and piloting an observe → decide → act controller on top of QUID:

Query → features + retrieval confidence → route ∈ {vanilla, quid, hyde} → retrieve
 (+ critique / optional retry - design target)

Tools (design set): skip expansion (vanilla), LLaDA masked-diffusion expansion (QUID), hypothetical-document expansion (HyDE-style).

Early pilots (Modal L4, 50 queries/dataset, 16 diffusion steps, LLaDA-backed HyDE - not final claims):

Datasetalways_vanillaalways_QUIDsingle-shot agentmulti-step (tool calls)oracle
NFCorpus0.33050.27040.30530.30530.3577
SciFact0.62990.59990.62800.66250.7004

Early pilot signals (not final):

  1. SciFact: selective multi-step tool use looks more stable than always-QUID in this pilot; confirmation on larger splits is next.
  2. NFCorpus: agentic routing recovers vs blind QUID on this slice; oracle still shows headroom.
  3. The intended design is not prompt expansion alone: the agent should call tools (expandcritique → optional retry) and stop when retrieval confidence looks OK. Larger runs are still underway.

9.3 What we will do next

  1. Scale pilots to fuller BEIR splits; freeze numbers only after confirmation
  2. Learned router (train toward oracle labels)
  3. Stronger HyDE backend (GPT when quota available) vs LLaDA document prompt
  4. Critique/retry budget as an explicit tool argument
  5. Preprint polish (coming soon)
  6. Model distillation for latency; multilingual / domain fine-tuning as follow-ons

10. References

Austin, J., et al. (2021). Structured denoising diffusion models in discrete state-spaces. NeurIPS.

Gao, L., et al. (2022). Precise zero-shot dense retrieval without relevance labels. arXiv:2212.10496.

Karpukhin, V., et al. (2020). Dense passage retrieval for open-domain QA. EMNLP.

Lou, A., et al. (2024). Discrete diffusion modeling by estimating ratios. ICML.

Nie, S., et al. (2025). Large language diffusion models. arXiv:2502.09992.

Sahoo, S. S., et al. (2024). Simple and effective masked diffusion language models. NeurIPS.

Wang, L., et al. (2023). Query2doc: Query expansion with LLMs. arXiv:2303.07678.

11. Appendices

Appendix A: Hyperparameters

ParameterValue
Diffusion modelLLaDA-8B
Embedding modelBGE-M3
Diffusion steps32
Mask tokens50
Temperature1.0
GPUNVIDIA A10G

Appendix B: Example Expansions

Query: "vitamin d deficiency symptoms"

QUID: vitamin d deficiency symptoms including fatigue bone pain muscle weakness mood changes depression calcium absorption sunlight exposure supplementation recommendations

HyDE: Vitamin D deficiency is a common condition affecting millions worldwide. Symptoms include fatigue, bone pain, and muscle weakness. Treatment typically involves supplementation with vitamin D3 at doses of 1000-4000 IU daily...

Analysis: QUID adds relevant terms without specific facts. HyDE generates potentially inaccurate dosage recommendations.

Appendix C: Compute Resources

PhaseGPU-HoursCost
Infrastructure43$21.50
Experiments287$143.50
Analysis87$43.50
Ablations70$35.00
Total487$243.50

Appendix D: Project Statistics

MetricValue
Duration12 weeks (3 months)
Total hours386
GPU-hours487
Datasets4
Methods compared7 (+ agentic router)
Paper pages8 + appendix
Agentic bench queries100 (50×2 datasets)

End of Final Report

Submitted in partial fulfillment of the Capstone Project requirements.

Project Duration: Months 1-3 complete · Month 4 in progress | Status: Capstone ongoing · Preprint coming soon

Code: https://github.com/Zhreyu/quid