Recent advances in Large Language Models (LLMs) and Retrieval-Augmented Generation (RAG) have enabled diverse retrieval methods. However, existing retrieval methods often fail to accurately retrieve results for negation and exclusion queries. To address this limitation, prior approaches rely on embedding adaptation or fine-tuning, which introduce additional computational cost and deployment complexity. We propose Direct Embedding Optimization (DEO), a training-free method for negation-aware text and multimodal retrieval. DEO decomposes queries into positive and negative components and optimizes the query embedding with a contrastive objective. Without additional training data or model updates, DEO outperforms baselines on NegConstraint, with gains of +0.0738 nDCG@10 and +0.1028 MAP@100, while improving Recall@5 by +6% over OpenAI CLIP in multimodal retrieval. These results demonstrate the practicality of DEO for negation- and exclusion-aware retrieval in real-world settings.
Figures & tables
Figure 1: Overview of the proposed Direct Embedding Optimization (DEO). (a) Given an input query containing negation, we use an LLM to decompose it into positive and negative sub-queries. (b) The input query embedding is then optimized with a contrastive loss by pulling it closer to positive query embeddings and pushing it farther from negative query embeddings, enabling negation- and exclusion-aware retrieval.
NegConstraint
NevIR
MAP
nDCG
Pairwise
BGE-small-en-v1.5
0.6702
0.7372
0.1569
w/ DEO
0.7302
0.7795
0.1894
BGE-large-en-v1.5
0.6299
0.7139
0.2552
w/ DEO
0.7327
0.7877
0.2776
BGE-M3
0.6374
0.7250
0.2668
Table 1: Performance on the NegConstraint Xu et al. (2025) benchmark for negation retrieval. “w/ DEO” represents the performance after applying our proposed method. All nDCG scores correspond to nDCG@10.
Recall@5
OpenAI CLIP
0.4792
w/ DEO
0.5392
CLIP-laion400m
0.5248
w/ DEO
0.5737
CLIP-datacomp
0.4984
w/ DEO
0.5513
Table 2: Performance on the COCO-Neg benchmark for text-to-image negation retrieval Alhamoud et al. (2025) . “w/ DEO” represents the performance after applying our proposed method.
NegConstraint
Method
MAP
nDCG@10
BGE-S w/ Qwen
0.7144
0.7705
BGE-S w/ GPT
0.7302
0.7795
BGE-L w/ Qwen
0.6859
0.7553
BGE-L w/ GPT
0.7327
0.7877
BGE-M3 w/ Qwen
0.7280
0.7871
Table 3: Performance comparison on the NegConstraint dataset using different LLM backbones for query decomposition. Qwen refers to Qwen2.5-1.5B-Instruct, and GPT refers to GPT-4.1-nano. BGE-S, BGE-L denote BGE-small-en-v1.5, BGE-large-en-v1.5, respectively.
COCO-Neg
Method
Recall@5
CLIP-laion400m w/ Qwen
0.5656
CLIP-laion400m w/ GPT
0.5737
NegCLIP w/ Qwen
0.6872
NegCLIP w/ GPT
0.6980
Table 4: Performance comparison on COCO-Neg using different LLM backbones for query decomposition.
NegConstraint
COCO-Neg
Parameters
MAP
nDCG@10
Recall@5
Baseline
0.6374
0.7250
0.4792
0.2, 1.0, 1.0
0.7379
0.7946
0.5349
0.2, 1.0, 2.0
0.7366
0.7942
0.5275
0.2, 2.0, 1.0
0.7160
0.7769
0.5237
1.0, 1.0, 1.0
0.6713
0.7510
0.5392
Table 5: Effect of varying the weight balancing parameters λo , λp , and λn on the NegConstraint and COCO-Neg. NegConstraint results use BGE-M3, and COCO-Neg results use OpenAI CLIP. Optimization step is 20.
NegConstraint
Method
MAP
nDCG@10
BGE-M3
0.6374
0.7250
Ours (only decompose, AVG)
0.6451
0.7312
Ours (only decompose, RRF)
0.6641
0.7417
Ours (full)
0.7379
0.7946
Table 6: Ablation results on NegConstraint with BGE-M3. Query decomposition alone yields limited gains, while most performance improvements arise from embedding optimization rather than decomposition itself.
Figure 2: Retrieval performance with respect to the number of optimization steps on NegConstraint .
Figure 3: Retrieval performance with respect to the number of optimization steps on COCO-Neg .
Figure 4: Examples of query decomposition. In NegConstraint (a) and COCO-Neg (b), the LLM decomposes queries into positive sub-queries capturing desired elements and negative sub-queries targeting excluded concepts.
Figure 5: Trajectory of optimized query embedding eu in PCA-projected space. The initial embedding (black ∙ ) moves toward the final state (blue ∙ ). Positive examples (green △ ) and the ground-truth (yellow ⋆ ) act as attractors, while negative examples (red × ) exert repelling forces. Other corpus embeddings are shown in light gray.
Figure 6: Optimization trajectory of eu in PCA-projected CLIP space. Initial (black ∙ ) embedding evolves toward final state (blue ∙ ), attracted by positives (green △ ) and ground-truth (yellow ⋆ ) while repelled by negatives (red × ). Gray points denote the corpus.
Retrieval-augmented language models can fail to respect negative constraints when the retriever supplies evidence about concepts the user explicitly excluded. Beyond explicit negation, queries may ask for answers that include one concept while excluding another, or for entities that belong to a category but differ from a closely related instance. Because the excluded concept still appears in the query text, dense retrievers may assign high similarity to documents about that concept even when the user asks to avoid it. We introduce E-SENS, a training-free reranking method for negation-sensitive retrieval. E-SENS extracts a compact trap query for the excluded side and subtracts trap-query similarity from the original-query retrieval score. On ExcluIR, E-SENS shows a clear recall-violation trade-off across four embedding models and reduces trap retrieval at recall-preserving settings.
Dense retrieval models are typically trained with contrastive objectives that learn effective representations but do not directly optimize retrieval metrics or downstream task performance. To address this problem, we introduce RELER (REinforcement LEarning for Retrieval), a reinforcement learning framework that enables existing embedding models to learn to retrieve directly in embedding space and align to task-specific rewards. We train RELER by sampling unit-length query and document embedding actions from von Mises-Fisher (vMF) distributions centered on normalized encoder outputs, scoring the resulting retrieval or downstream outcomes as rewards, and updating the encoder with REINFORCE using a leave-one-out baseline (RLOO). As exploration in the high-dimensional embedding space is prone to sampling noise, we further propose conditional-mean projection (CMP), which projects each sampled embedding onto the low-dimensional subspace spanned by its encoder output and the candidate embeddings it is compared against, reducing noise in the policy gradient while preserving its expectation. We evaluate RELER on BRIGHT, a benchmark with reasoning-intensive queries that remain challenging for existing embedding models. RELER consistently outperforms InfoNCE and LambdaLoss in average nDCG@10 when post-training BGE-M3 and Qwen3-Embedding backbones. We further evaluate downstream utility through retrieval-augmented generation (RAG), where we adapt only the query encoder while keeping the document index and generator fixed. Across seven QA datasets, jointly optimizing retrieval and answer rewards improves both average retrieval performance and answer quality in RAG.
Large language models (LLMs) can both expand underspecified queries and encode text as dense representations, suggesting a unified model for query expansion and retrieval. Existing systems usually rely on prompted expansions, independently trained modules, or staged optimization, leaving generated expansions only indirectly aligned with the retrieval loss that judges them. We train a single decoder-only LLM end to end, where the same model generates the expansion and encodes both the expanded query and candidate documents. This unified setting creates a moving-target problem: retrieval supervision should improve query-side expansion, but the same update also shifts the document embeddings that serve as retrieval targets. We introduce Document Embedding Preservation Tuning (DEPT), which keeps tuned document embeddings close to cached initial embeddings while allowing retrieval gradients to pass through straight-through decoding into the generator. DEPT converts joint query--document movement into query-side adaptation against approximately stable, whitened document embeddings that support index reuse and online hard-negative mining. Experiments with Qwen3-4B-Instruct-2507 and LLaMA-3.2-3B-Instruct on five datasets in BEIR benchmark show that DEPT improves average retrieval quality over training-free, independently trained, and staged unified baselines, while ablations isolate the effects of preservation, whitening, end-to-end expansion training, and online negatives. Code is available at https://github.com/ILSparkle/DEPT.