Manuscript Offprint
arXiv:2611.12097Calibrating Document-Local Boundaries for Contextual Chunk Retrieval
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Yuanxiang Wang
Hui Jiang
Da Zhu
Zhihua Chang
Qwen Business Unit, Alibaba Group
Abstract. Late Chunking encodes an entire document before pooling at chunk boundaries, preserving document context in local retrieval units. Chunk-level post-training improves context-dependent retrieval, but shared context can make semantically similar same-document negatives difficult to distinguish. We study the local decision boundary between a gold chunk and its hardest sibling. Starting from InSeNT, we analyze InSeNT's within-document gradients and show that the entropy of the conditional negative allocation decreases monotonically with the scaling factor at fixed logits. We propose a two-part framework for calibrating document-local chunk boundaries. The first component adapts the discriminative scale from within-document margins, while the second exposes chunk partitions to attention during document encoding. Experiments on ConTEB and NanoBEIR show that the resulting model improves contextual chunk retrieval across the evaluated encoder settings while retaining competitive passage-level retrieval quality; ablations further characterize the distinct roles of adaptive scaling and chunk-aware routing.
Keywords: Contextual embeddings · Dense retrieval · Contrastive learning · Document representation · Late Chunking
1 Introduction
Long-document retrieval usually returns local evidence that answers a query, rather than the whole document [1]. Its meaning often depends on context: pronouns refer to things mentioned earlier, numbers belong to particular years, and similar expressions may describe different facts [2]. Independent chunk encoding loses these cues, whereas a single document vector cannot localize evidence. Prior work improves contextual retrieval through input enrichment, long-context encoding, and chunk-level post-training [3, 4, 2]. These approaches preserve more document context, but retrieval still requires a model to separate locally similar chunks that share that context.
Because multiple chunks in a document share the same context, retrieval must distinguish the answer-bearing chunk from its same-document siblings; chunk boundaries therefore directly shape the retrieval objective. A useful training signal must preserve global context while distinguishing chunks that share entities, topics, or surface form. Therefore, we treat the gold chunk and its strongest same-document sibling as the basic unit of analysis, and evaluate both contextual and passage-level retrieval. We focus on contrastive post-training with same-document negative chunks. Of 19,974 InSeNT evaluation queries, 6,976 fail to rank gold first. Among these 6,976 queries, the highest-scoring sibling exceeds the gold score in 82.21% of cases, illustrating unresolved local factual confusion. Figure 1 asks for goals in 2019–20: both passages discuss the same player, European competitions, and scoring records, but the hard negative concerns another season.
Query How many goals did Gonçalo Ramos score in the 2019–20 UEFA Youth League?
Gold chunk During the 2019–20 UEFA Youth League, [he] helped Benfica reach the final, scoring a brace in the final and finishing as joint-top scorer with eight goals.
Same-document hard negative In 2022–23, [he] scored two goals in the Lisbon derby and two goals in a Champions League knockout match; [he] finished the season with 27 goals.
| InSeNT | DcLBC | |
|---|---|---|
| Gold global rank | 80 | 1 |
| Fixed negative global rank | 16 | 11 |
| Fixed-pair cosine margin | -0.05 | +0.04 |
Figure 1: Season confusion in Football: the same gold–negative pair under InSeNT and DcLBC.
We identify two complementary gaps at this local boundary. First, InSeNT's fixed inverse temperature jointly controls row-wise total effort and its allocation among siblings, despite heterogeneous query–document margins. AMS instead computes a detached scale from each pair's gold–hardest-sibling margin and applies it only to the InSeNT within-document loss. Second, distinguishing sibling chunks requires contextual representations that preserve each chunk's local evidence while incorporating shared document context. Although InSeNT supervises chunks, standard Late Chunking uses partitions only during post-encoder pooling; final-layer attention does not explicitly observe retrieval-unit boundaries.
We propose Document-Chunk Local Boundary Calibration (DcLBC), combining Adaptive Margin Scaling (AMS) and Chunk-Aware Key Routing (CKR). AMS adapts the discrimin-native scale to focus conditional effort on difficult negatives. CKR injects the chunk partition into post-RoPE Keys, allowing chunk-wise context routing during encoding. Figure 2 summarizes the pipeline from CKR-enabled encoding through chunk pooling and scoring to the AMS loss. Our contributions are:
-
We analyze InSeNT at the query–document row level by separating total score-space effort from its conditional allocation among same-document negatives, and derive how competitor entropy changes with the scale.
-
We introduce DcLBC, combining AMS, which derives a detached instance-level scale from the gold–hardest-sibling margin, with CKR, which injects chunk routing into post-RoPE Keys.
-
We evaluate DcLBC on ConTEB and NanoBEIR with ModernBERT and ModernColBERT backbones, and use component ablations and CKR design tests to measure the contribution of each mechanism.
Long-Context and Retrieval-Oriented Encoders.. Contextualized retrieval also depends on encoder architectures that can represent long inputs while preserving fine-grained matching signals. Longformer established an efficient bidirectional design based on sparse local and global attention for processing long sequences [9], while ModernBERT revisits bidirectional encoder pretraining with modern architectural and training choices [10]. In dense retrieval, DPR represents queries and passages with dual encoders and scores them by vector similarity, and Contriever demonstrates that retrieval representations
can also be learned through unsupervised contrastive pretraining [1, 11]. Late-interaction models retain token-level vectors: ColBERT performs efficient fine-grained matching with a MaxSim operator, and ColBERTv2 improves its quality and storage efficiency through denoised supervision and residual compression [12, 13]. A parallel line adapts decoder-only language models into embedding encoders. Echo Embedding repeats the input to expose token representations to preceding context, LLM2Vec combines bidirectional attention with unsupervised and supervised adaptation, and NV-Embed introduces latent attention pooling together with retrieval-oriented training [14, 15, 16]. These families provide different trade-offs among context length, representation granularity, scoring expressiveness, and retrieval efficiency.
Contrastive Learning, Hard Negatives, and Temperature.. Modern embedding models are commonly optimized with contrastive objectives that raise the similarity of matched query–passage pairs relative to negative candidates. SimCSE shows how contrastive learning can produce strong sentence representations using either dropout-based positive pairs or supervised entailment data [17]. For retrieval, negative selection is especially important because randomly sampled passages may become uninformative early in training. ANCE addresses this issue by periodically mining difficult candidates from an approximate nearest-neighbor index, thereby coupling representation learning with the evolving retrieval space [18]. Temperature provides a second control over contrastive optimization: smaller temperatures sharpen the softmax distribution and concentrate gradients on harder negatives [19]. Dual Temperature separates scaling effects associated with different components of contrastive learning to reduce sensitivity to negative-sample quality [20]. MACL further adjusts contrastive training according to model-dependent alignment and uniformity signals rather than using a single fixed optimization regime [21]. This body of research establishes negative construction and logit scaling as central factors governing the strength and distribution of contrastive learning signals.
3 Analysis and Method
3.1 Within-document chunk competition
We first recall InSeNT's in-sequence loss [2]. Index query–document pairs by and chunks within pair by . The normalized query has normalized document chunks , collected as , with gold index . Let be the similarity scale and the within-document temperature. Holding the cross-document term fixed,
Here is the scaled query–chunk logit. The hardest same-document negative and its margin from gold are
DCLBC Document-Chunk Local Boundary Calibration
Gold Hard negative Other

Figure 2: Overview of DcLBC. CKR redistributes attention across chunks, while AMS adaptively scales within-document scores.
Smaller means stronger competition. Let be the within-document softmax probability and the indicator function:
Thus is the gold–hard-negative posterior log-odds around which within-document optimization operates.
3.2 Document-Chunk Local Boundary Calibration
Local margins vary across query-document pairs. DcLBC addresses this heterogeneity through AMS and CKR.
3.2.1 Adaptive Margin Scaling (AMS)
AMS applies a detached instance-level multiplier to within-document scores, with . The local log-odds become
At training step , let be the detached EMA reference margin and the floored margin. Minimizing over yields
Here , caps the scale, and prevents divergence for small or negative margins. Appendix B specifies the EMA update.
Relation to temperature adjustment. For untempered scores , fixed and instance-level temperatures give and . AMS is also instance-level temperature
adjustment, specifically controlled by local same-document competition:
where in Eq. (5) adapts the temperature to each query-document pair's gold-hardest-sibling margin. This adjustment applies only to the sequence loss; cross-document scores retain their original scale. Since , AMS yields whenever and .
Optimization pressure. Define the total weight and conditional allocation over sibling negatives as
Let be the rescaled row loss, and let differentiate with respect to trainable parameters while treating as constant. Its negative gradient is
controls total effort and its allocation over sibling negatives. At fixed logits, replace in by a generic continuous scale and denote the resulting allocation by . Let be its entropy. The sibling-only log-partition has second derivative , giving
At fixed logits, increasing concentrates negative gradients on higher-scoring competitors, providing a more focused update direction for high-competition documents.
3.2.2 Chunk-Aware Key Routing (CKR)
CKR introduces chunk boundaries into attention by adding a shared offset to the keys of each chunk. Consider one attention
Table 1: ConTEB and NanoBEIR NDCG@10 (%). Parentheses give base-model parameters in millions (M); bold/underline: best/second best. “-” indicates no additional post-training in this study.
| Model | Post-training | MLDR | SQuAD | NQA | COVID | Rest. | Foot. | Cities | EIOPA | ConTEB Avg | NanoBEIR |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Retrieval baselines without additional post-training | |||||||||||
| BM25 [22] | - | 69.43 | 56.18 | 74.68 | 53.75 | 19.91 | 12.20 | 45.61 | 0.00 | 41.47 | 43.41 |
| Contrier-MSMARCO (109M) [11] | - | 75.12 | 70.65 | 77.00 | 53.79 | 42.79 | 24.41 | 67.42 | 14.77 | 53.24 | 59.54 |
| Anthropic Contextual | - | 85.40 | 77.10 | 77.70 | 60.70 | 34.80 | 53.90 | 89.40 | 100.00 | 72.40 | 63.20 |
| Encoder models with additional post-training | |||||||||||
| ModernBERT-base(149M) [10] | InfoNCE | 80.09 | 72.62 | 76.84 | 48.54 | 35.48 | 45.84 | 76.47 | 99.69 | 66.95 | 58.70 |
| InSeNT | 85.81 | 80.11 | 80.33 | 55.81 | 44.66 | 58.25 | 82.92 | 100.00 | 73.49 | 58.97 | |
| DcLBC | 85.28 | 80.67 | 81.00 | 54.59 | 44.53 | 66.19 | 86.83 | 100.00 | 74.89 | 59.41 | |
| ModernBERT-large(395M) [10] | InfoNCE | 81.89 | 72.89 | 78.70 | 51.46 | 44.14 | 63.07 | 85.23 | 100.00 | 72.17 | 59.69 |
| InSeNT | 88.92 | 80.80 | 83.51 | 59.53 | 48.25 | 65.49 | 87.10 | 100.00 | 76.70 | 59.75 | |
| DcLBC | 89.20 | 82.92 | 84.66 | 57.80 | 51.19 | 71.51 | 91.63 | 100.00 | 78.61 | 60.56 | |
| ModernColBERT(149M) [23] | InfoNCE | 74.88 | 63.49 | 78.81 | 47.05 | 27.99 | 48.18 | 82.52 | 21.53 | 55.56 | 54.25 |
| InSeNT | 89.32 | 77.24 | 83.32 | 64.78 | 49.00 | 64.55 | 89.66 | 51.42 | 71.16 | 57.96 | |
| DcLBC | 89.70 | 74.31 | 82.61 | 65.54 | 46.58 | 68.02 | 91.37 | 70.73 | 73.61 | 56.79 | |
| LLM-based embedding models (causal attention) | |||||||||||
| Qwen3-Embedding (596M) [24] | - | 57.12 | 63.98 | 58.66 | 19.52 | 11.75 | 53.08 | 82.15 | 62.97 | 51.15 | 64.91 |
| Harrier (268M) [25] | - | 65.77 | 62.30 | 64.36 | 16.83 | 7.71 | 39.30 | 81.74 | 40.20 | 47.28 | 62.64 |
| ML-Embed (596M) [26] | - | 52.25 | 56.21 | 60.19 | 16.15 | 11.14 | 27.91 | 71.54 | 22.00 | 39.67 | 63.18 |
| LLM-based embedding models (bidirectional attention) | |||||||||||
| pplx-embed-v1 (596M) [27] | - | 84.68 | 74.61 | 81.69 | 53.76 | 26.57 | 62.78 | 82.88 | 86.56 | 69.19 | 56.07 |
| BidirLM (596M) [28] | - | 58.29 | 68.90 | 66.40 | 36.07 | 28.87 | 60.68 | 92.76 | 23.79 | 54.47 | 57.45 |
| Nano-Em1-0.6B-v2 (596M) [29] | - | 49.87 | 41.98 | 60.90 | 26.67 | 22.22 | 20.37 | 74.63 | 33.57 | 41.28 | 49.18 |
head (index omitted), with post-RoPE token queries , keys , and head dimension ; and index source and target tokens. From hidden states in chunk , we compute a routing vector and update its keys:
Here LN denotes layer normalization, Mean averages token states, and GELU is the activation. The learned projections and map through routing dimension , so . Adding the offset after RoPE keeps it identical across positions within a chunk. Thus, for source token , every token in receives the same additive bias to its attention logit :
Let be the original attention weight and the total attention mass assigned to chunk . Applying softmax with the same mask gives
Here is the original mass of special or unassigned tokens, whose keys remain unchanged; all sums respect the attention mask. CKR therefore multiplies each chunk's mass by before renormalization, while preserving its internal attention proportions for fixed queries, token states, and routing vectors.
3.3 Joint training objective
For a batch of query-document pairs, DcLBC retains InSeNT's cross-document loss and rescales the within-document loss:
With denoting the within-document loss weight, the full objective is
The detached only controls within-document competition. CKR adds no loss: its representations enter both terms, and its parameters are jointly optimized with the encoder. Complete mathematical proofs of all propositions and identities in this section are provided in Appendix A.
4 Experiments
We evaluate the overall retrieval performance of DcLBC and several baseline methods on ConTEB and NanoBEIR, and examine the contributions of AMS and CKR through component ablations and CKR design analyses.
Table 2: Component ablation on ModernBERT-large: ConTEB NDCG@10, mean ± standard deviation (SD, %); Δ in percentage points (pp).
| AMS | CKR | ConTEB Avg | Δ vs. InSeNT |
|---|---|---|---|
| × | × | 76.12 ± 0.59 | – |
| × | ✓ | 76.68 ± 0.43 | +0.56 |
| ✓ | × | 77.59 ± 0.33 | +1.47 |
| ✓ | ✓ | 78.38 ± 0.23 | +2.26 |
4.1 Experimental setup
Following the training data and two-epoch schedule of Context Is Gold [2], all post-training methods use the MLDR, NarrativeQA, and SQuAD corpora. Our runs use 8*A800 GPUs with BF16 and a learning rate of , and all methods are evaluated at their final checkpoint. Our primary metric is ConTEB eight-task macro normalized discounted cumulative gain at rank 10 (NDCG@10, abbreviated 8DS); NanoBEIR passage retrieval assesses performance without document context. ModernBERT models use normalized 1024-dimensional cosine scores and ModernColBERT uses MaxSim [12, 13].
4.2 Main results
Table 1 compares retrieval models on 8DS and NanoBEIR. DcLBC consistently outperforms InSeNT on 8DS across the evaluated encoder and multi-vector backbones. The gains reach 1.40 and 1.91 points on ModernBERT-base and ModernBERT-large, respectively, and peak at 2.45 points on ModernColBERT. For ModernBERT-large, the largest task-level improvements occur on Football by 6.02 points and Cities by 4.53 points, while COVID is the only contextual task that declines. This contrast reflects ConTEB's construction: Football and Cities suppress explicit mentions of the document subject to require coreference resolution, whereas COVID-QA often provides strong local matches through extractive medical terminology [2]. This concentration suggests that DcLBC is particularly effective when retrieval depends on distinguishing related chunks within a shared document.
For the two ModernBERT encoders, the NanoBEIR results further show that DcLBC does not trade away retrieval quality when document context is absent. The base and large models retain advantages of 0.44 and 0.81 points over InSeNT, reaching 59.41 and 60.56, respectively. Their concurrent gains on context-dependent ConTEB and passage-level NanoBEIR suggest that local boundary calibration is not merely exploiting extra document context.
4.3 Ablation and design analysis
We analyze DcLBC components and CKR design, reporting ConTEB eight-task macro NDCG@10 (%). Table 2 first isolates the contributions of AMS and CKR, while Table 3 examines how the routing configuration affects CKR. Because the two studies use separate controlled comparisons, we interpret each
Table 3: CKR design analysis on ModernBERT-large: ConTEB NDCG@10, mean ± standard deviation (SD, %). Alignment tests use Last 2.
| Configuration | ConTEB Avg |
|---|---|
| Layer coverage | |
| None | 77.60 ± 0.32 |
| Last 1 (27) | 77.92 ± 0.42 |
| Last 2 (24, 27) | 78.05 ± 0.52 |
| Last 3 (21, 24, 27) | 77.76 ± 0.37 |
| Last 4 (18, 21, 24, 27) | 78.05 ± 0.39 |
| Chunk alignment | |
| Correct alignment (Last 2) | 78.05 ± 0.52 |
| Cyclic permutation | 77.62 ± 0.44 |
None disables CKR; other settings share the rank-32 router.
configuration relative to the corresponding baseline in its own table.
4.3.1 Component ablation
Table 2 shows that AMS raises the mean by 1.47 points to 77.59, while CKR alone reaches 76.68, improving over InSeNT by 0.56 points. When added to AMS, CKR contributes a further 0.79-point gain and brings the combined model to 78.38. The joint improvement of 2.26 points is 0.23 points larger than the sum of the two isolated gains, indicating a modest positive interaction rather than simple redundancy. The combined configuration also has the smallest reported standard deviation (0.23) among the four settings. Thus, both components improve retrieval individually, and their combination performs best without increasing the observed across-run variability.
These results are consistent with the distinct roles suggested by our analysis: AMS controls total optimization effort and, at fixed logits, concentrates negative gradient weight on harder siblings, whereas CKR redistributes attention across chunks during encoding. In the population-wide training diagnostics reported in Appendix C.2, AMS raises the query-row mean calibration effort over the recorded training rows from 0.374 to 0.535, a 43.1% increase, further supporting its optimization-side role.
4.3.2 CKR design analysis
Table 3 compares layer coverage and chunk alignment within the AMS-enabled design sweep. Relative to the no-CKR reference at 77.60, routing the last one, two, three, and four selected layers changes the mean to 77.92, 78.05, 77.76, and 78.05, respectively. The non-monotonic pattern shows that increasing the number of routed layers alone does not guarantee a better result. Last 2 and Last 4 attain the same mean, but Last 2 uses fewer routing layers; neither Last 1 nor Last 3 surpasses it. We therefore use Last 2 as the compact default.
Normally, the representation aggregated from chunk routes the Keys of that same chunk. Cyclically permitting chunk representations within a document breaks this correspondence

(a) Margin

(b) Adaptive scale
Figure 3: Query margins and adaptive scales during DcLBC training. Solid: example queries; dashed: training means.
while retaining the model parameters and other settings. This controlled mismatch reduces the mean from 78.05 to 77.62, a 0.43-point drop. The result indicates that the gain depends not only on adding a routing module, but also on preserving the correspondence between each chunk representation and the chunk whose Keys it modifies.
4.4 AMS training dynamics
We track the gold-hardest-sibling margin and adaptive scale during two epochs of DcLBC training with ModernBERT-large. Figure 3 compares four example queries, measured every ten updates in evaluation mode using the current training EMA, with query-weighted training-batch means.
Q1 and Q2 retain smaller margins and scales above one, whereas Q3's scale settles at one and Q4's fluctuates near this lower bound. This behavior is consistent with Eq. (5): AMS assigns stronger scaling to queries with smaller margins relative to the evolving reference . Meanwhile, the mean margin increases, suggesting improved average gold-negative separation, and the mean scale stabilizes near 1.44. These trends are compatible because the reference evolves with training: overall separation can improve while relatively difficult queries retain stronger scaling. These trajectories illustrate AMS's adaptive response; at fixed logits, stronger scaling concentrates negative gradient weight on harder siblings.
5 Conclusion
We proposed DcLBC for chunk-level retrieval by combining adaptive margin scaling with chunk-aware context routing. On ConTEB, DcLBC consistently outperforms InSeNT across the evaluated encoder and multi-vector backbones, with gains of up to 2.45 NDCG@10 points. Both ModernBERT variants also improve on NanoBEIR, indicating that stronger contextual retrieval need not compromise passage-level performance. Component ablations and CKR design analyses further support the complementary roles of AMS and CKR in calibrating local chunk boundaries.
References
[1] Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih, "Dense passage retrieval for open-domain question answering," in Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). 2020, pp. 6769–6781, Association for Computational Linguistics.
[2] Max Conti, Manuel Faysse, Gautier Viaud, Antoine Bosselut, Céline Hudelot, and Pierre Colombo, “Context is gold to find the gold passage: Evaluating and training contextual document embeddings,” in Proc. EMNLP. 2025, pp. 22594–22608, Association for Computational Linguistics.
[3] Anthropic, “Contextual retrieval in AI systems,” Anthropic Engineering, September 2024.
[4] Michael Günther, Isabelle Mohr, Daniel James Williams, Bo Wang, and Han Xiao, “Late chunking: Contextual chunk embeddings using long-context embedding models,” arXiv preprint arXiv:2409.04701, 2024.
[5] Parth Sarthi, Salman Abdullah, Aditi Tuli, Shubh Khanna, Anna Goldie, and Christopher D. Manning, “RAPTOR: Recursive abstractive processing for tree-organized retrieval,” in Proc. ICLR. 2024, OpenReview.net.
[6] Kun Luo, Zheng Liu, Shitao Xiao, Tong Zhou, Yubo Chen, Jun Zhao, and Kang Liu, “Landmark embedding: A chunking-free embedding method for retrieval augmented long-context large language models,” in Proc. ACL (Long Papers). 2024, pp. 3268–3281, Association for Computational Linguistics.
[7] John Xavier Morris and Alexander M. Rush, “Contextual document embeddings,” in Proc. ICLR. 2025, OpenReview.net.
[8] Junjie Wu, Jiangnan Li, Yuqing Li, Lemao Liu, Liyan Xu, Jiwei Li, Dit-Yan Yeung, Jie Zhou, and Mo Yu, “Situated embedding models for context-aware dense retrieval,” in Proc. ACL (Short Papers). 2026, pp. 37–49, Association for Computational Linguistics.
[9] Iz Beltagy, Matthew E. Peters, and Arman Cohan, “Longformer: The long-document transformer,” arXiv preprint arXiv:2004.05150, 2020.
[10] Benjamin Warner, Antoine Chaffin, Benjamin Clavié, Orion Weller, Oskar Hallström, Said Taghadouini, Alexis Gallagher, Raja Biswas, Faisal Ladhak, Tom Aarsen, Nathan Cooper, Griffin Adams, Jeremy Howard, and Iacopo Poli, “Smarter, better, faster, longer: A modern bidirectional encoder for fast, memory efficient, and long context finetuning and inference,” arXiv preprint arXiv:2412.13663, 2024.
[11] Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave, “Unsupervised dense information retrieval with contrastive learning,” CoRR, vol. abs/2112.09118, 2021.
[12] Omar Khattab and Matei Zaharia, “ColBERT: Efficient and effective passage search via contextualized late interaction over BERT,” in Proc. ACM SIGIR, 2020, pp. 39–48.
[13] Keshav Santhanam, Omar Khattab, Jon Saad-Falcon, Christopher Potts, and Matei Zaharia, “ColBERTv2: Effective and efficient retrieval via lightweight late interaction,” in Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2022, pp. 3715–3734, Association for Computational Linguistics.
[14] Jacob Mitchell Springer, Suhas Kotha, Daniel Fried, Graham Neubig, and Aditi Raghunathan, “Repetition improves language model embeddings,” in Proc. ICLR. 2025, OpenReview.net.
[15] Parishad BehnamGhader, Vaibhav Adlakha, Marius Mosbach, Dzmitry Bahdanau, Nicolas Chapados, and Siva Reddy, “LLM2Vec: Large language models are secretly powerful text encoders,” CoRR, vol. abs/2404.05961, 2024.
[16] Chankyu Lee, Rajarshi Roy, Mengyao Xu, Jonathan Raiman, Mohammad Shoeybi, Bryan Catanzaro, and Wei Ping, “NV-Embed: Improved techniques for training LLMs as generalist embedding models,” in Proc. ICLR. 2025, OpenReview.net.
[17] Tianyu Gao, Xingcheng Yao, and Danqi Chen, “SimCSE: Simple contrastive learning of sentence embeddings,” in Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing. 2021, pp. 6894–6910, Association for Computational Linguistics.
[18] Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul N. Bennett, Junaid Ahmed, and Arnold Overwijk, “Approximate nearest neighbor negative contrastive learning for dense text retrieval,” in International Conference on Learning Representations, 2021.
[19] Feng Wang and Huaping Liu, “Understanding the behaviour of contrastive loss,” in Proc. IEEE/CVF CVPR, 2021, pp. 2495–2504.
[20] Chaoning Zhang, Kang Zhang, Trung X. Pham, Axi Niu, Zhinan Qiao, Chang D. Yoo, and In So Kweon, “Dual temperature helps contrastive learning without many negative samples: Towards understanding and simplifying MoCo,” in Proc. IEEE/CVF CVPR, 2022, pp. 14441–14450.
[21] Zizheng Huang, Haoxing Chen, Ziqi Wen, Chao Zhang, Huaxiong Li, Bo Wang, and Chunlin Chen, “Model-aware contrastive learning: Towards escaping the dilemmas,” in Proc. ICML. 2023, vol. 202 of Proceedings of Machine Learning Research, pp. 13774–13790, PMLR.
[22] Stephen E. Robertson, Steve Walker, Susan Jones, Micheline Hancock-Beaulieu, and Mike Gafford, “Okapi at TREC-3,” in Proc. TREC-3, 1994, pp. 109–126.
[23] Antoine Chaffin, “GTE-ModernColBERT-v1 model card,” Hugging Face model repository, 2025.
[24] Yanzhao Zhang, Mingxin Li, Dingkun Long, Xin Zhang, Huan Lin, Baosong Yang, Pengjun Xie, An Yang, Dayiheng Liu, Junyang Lin, Fei Huang, and Jingren Zhou, “Qwen3 Embedding: Advancing text embedding and reranking through foundation models,” arXiv preprint arXiv:2506.05176, 2025.
[25] Microsoft, “Harrier OSS v1 270M model card,” Hugging Face model repository, 2026.
[26] CodeFuse AI, “ML-Embed-0.6B model card,” Hugging Face model repository, 2026.
[27] Sedigheh Eslami, Maksim Gaiduk, Markus Krimmel, Louis Milliken, Bo Wang, and Denis Bykov, “Diffusion-pretrained dense and contextual embeddings,” arXiv preprint arXiv:2602.11151, 2026.
[28] Nicolas Boizard, Théo Deschamps-Berger, Hippolyte Gisserot-Boukhlef, Céline Hudelot, and Pierre Colombo, “BidirLM: From text to omnimodal bidirectional encoders by adapting and composing causal LLMs,” arXiv preprint arXiv:2604.02045, 2026.
[29] KiteFish AI, “Nano-Em1-0.6B-v2 model card,” Hugging Face model repository, 2026.
[30] AI Sage, “Giga Embeddings Instruct 480M model card,” Hugging Face model repository, 2026.
Appendix
Proofs, implementation details, and supporting analyses
Appendix Contents
A Supplementary Proofs ..... 8 A.1 Row-Level Properties of In-Sequence Negative Training. ..... 8 A.2 Adaptive Margin Scaling: Scale Calibration, Effort Decomposition, and Entropy Monotonicity. ..... 8 A.3 Chunk-Aware Key Routing: Exact Attention Factorization. ..... 9 A.4 Boundary-Aligned Geometric Work. ..... 10 B Implementation Details ..... 10
C Boundary and Optimization Diagnostics ..... 10 C.1 Competition-Stratified Retrieval Analysis. ..... 10 C.2 Optimization Dynamics ..... 11 D Robustness and Baseline Comparisons ..... 11 D.1 Temperature Baseline Comparisons ..... 11 E Additional Encoder Evidence ..... 11 E.1 Controlled-3 Context-Necessity Subset and Sub-1B LLM Encoders ..... 11
A Supplementary Proofs
This section provides supplementary proofs for Section 3.
A.1 Row-Level Properties of In-Sequence Negative Training
Proposition A.1 (Posterior Log-Odds and Score-Space Gradient of InSeNT; Eq. (3)). For normalized query with document chunks , gold index , similarity scale , and temperature , let and . Define and . Then:
Proof. Let denote the within-document partition function, so that . Forming the ratio between the gold probability and the hardest-sibling probability , the shared normalizer cancels:
Next, write the sequence loss in Eq. (1) as . Differentiating with respect to each scaled logit yields
Because , a smaller margin directly corresponds to weaker posterior discrimination between the gold chunk and its strongest same-document competitor.
Proposition A.2 (Row Shift Invariance and Zero-Sum Relative Operator). For a single query , let , and let be the length- all-ones vector.
For any scalar shift , , and the score-space gradient satisfies
Consequently, the sequence loss acts purely on relative differences among same-document chunks and is invariant to document-wide score translations.
Proof. Replacing with multiplies both numerator and denominator inside the logarithm by , leaving unchanged. Summing Proposition A.1 over gives .
A.2 Adaptive Margin Scaling: Scale Calibration, Effort Decomposition, and Entropy Monotonicity
Proposition A.3 (Constrained Margin-Scale Calibration; Eqs. (4)–(5)). Given reference scale , margin floor , and truncated margin , the box-constrained quadratic calibration problem
admits the unique closed-form solution . Furthermore, whenever and , the calibrated posterior log-odds between the gold chunk and the hardest sibling satisfies .
Proof. Because , the objective is strictly convex in with unconstrained minimizer . Projecting onto the closed interval yields . Under scaled logits , the posterior log-odds is
If and , then and , so and . For easy instances , preserves the baseline scale; for unresolved or inverted margins , caps the maximum sharpening multiplier.
Proposition A.4 (Optimization Effort and Conditional Negative Allocation; Eq. (8)). For a detached row multiplier , let , , and for . Define and with respect to trainable parameters , holding fixed. Then is a probability distribution over sibling negatives, and
Proof. Every is positive, and the probabilities sum to one. Hence , which gives and . Because is detached in the computation graph, applying the chain rule to yields
(A.8)
Thus governs the total magnitude of the score-space update, while governs how repulsive effort is distributed across same-document negative chunks.
Proposition A.5 (Monotonic Decrease of Conditional Competitor Entropy; Eq. (9)). At fixed logits , let be the Shannon entropy of the conditional negative allocation . Then
with strict inequality whenever the sibling negative logits are not all identical. Moreover, for any pair of sibling negatives with , the relative weight ratio grows strictly with .
Proof. Define the negative-only log-partition function . Because the gold term cancels when conditioning on , the conditional distribution is an exponential family in canonical parameter :
Standard cumulant-generating properties of exponential families give the first and second derivatives of :
(A.11)
Substituting into the Shannon entropy definition yields the Legendre relation
Differentiating with respect to via the product rule cancels the terms:
For , whenever the non-gold scores are not identical, establishing strict monotonicity.
A.3 Chunk-Aware Key Routing: Exact Attention Factorization
Proposition A.6 (Post-RoPE Chunk-Mass Factorization and Within-Chunk Ratio Invariance; Eqs. (11)–(12)). Consider a single attention head with post-RoPE query at source token and post-RoPE keys at target tokens . Suppose CKR shifts keys inside each routed chunk by a chunk-shared offset ( ), while leaving special or unassigned tokens ( ) unrouted ( ). Let , , and . Then under CKR:
- The routed chunk attention mass satisfies
- For any chunk with and any token , the conditional within-chunk token weight is invariant:
Proof. For any target token , linearity of the inner product after RoPE gives
Let be the original row normalizer, where ranges over valid target tokens. Then
and . Under the routed logits , the unnormalized chunk sum factors as
while . Dividing by the new total normalizer and canceling the common positive factor yields the chunk-mass formula in Claim 1. Finally, for any with ,
which establishes Claim 2. Note that applying the translation after rotary position embedding is essential: if were added before position-dependent rotation , the effective bias would vary with token position , breaking within-chunk ratio invariance.
A.4 Boundary-Aligned Geometric Work
Proposition A.7 (Boundary-Aligned Work Identity and Magnitude Bound). Let contain the normalized chunk embeddings of document , let satisfy , and let denote the th standard basis vector. Define . For updated embeddings and displacement at fixed , the cosine-margin change satisfies
(A.19)
Proof. Writing the cosine margin as , linearity yields . Applying the Frobenius Cauchy–Schwarz inequality gives
(A.20)
since for and . Moreover, because , any common shift applied as contributes zero to . Thus retrieval improvement depends on signed alignment with the rank-one boundary operator rather than raw representation movement or global cluster expansion.
B Implementation Details
All ModernBERT-large variants use the same pre-tokenized training documents, data order, and evaluation pipeline. Documents are capped at 8,192 tokens and encoded once before Late
Table C.1: NDCG@10 gains in percentage points (pp) by baseline InSeNT margin quartile. denotes the highest-competition queries.
| Comparison | Q1 | Q2 | Q3 | Q4 |
|---|---|---|---|---|
| AMS – InSeNT | +4.14 | +2.01 | -1.00 | -0.09 |
| CKR increment | +1.32 | +0.56 | +0.33 | +0.32 |
| DeLBC – InSeNT | +5.46 | +2.57 | -0.67 | +0.23 |
Chunking mean pooling. Post-training runs for two epochs with a global batch of 64 in BF16. We use AdamW with a peak learning rate of , cosine decay, a short warmup, and no weight decay. The inter-document and within-document objectives are combined with ; the similarity scale is a = 20, and the within-document temperature is 1.0 for InSeNT and 0.8 for AMS-based variants.
AMS uses , margin floor , and EMA decay . Let be the query rows local to the device at the th within-document loss call and
The first call sets ; subsequent calls update
This EMA is not synchronized across devices, and both and are detached from gradient computation. CKR is applied to the final two global-attention layers through one shared rank-32 bottleneck. Its bias-free Key up-projection is zero-initialized, so post-training begins from the pretrained attention distribution.
The resulting chunk vectors are L2-normalized and retrieved with a single cosine score. AMS changes only the training loss and therefore introduces no inference-time operation. CKR adds only the shared bottleneck while leaving the embedding dimension and retrieval procedure unchanged.
C Boundary and Optimization Diagnostics
C.1 Competition-Stratified Retrieval Analysis
We partition queries within each ConTEB dataset into quartiles ordered by the baseline InSeNT gold–hardest-sibling margin. The first quartile contains the most difficult local competitions. Table C.1 gives the compact numerical summary, while Figure C.1 shows both the concentration of gains in this regime and the query-level association between boundary-margin changes and retrieval changes.
AMS contributes most strongly in and , where the baseline gold-sibling margin is smallest, rather than uniformly shifting all retrieval scores. CKR adds a positive increment in every quartile, including those for which the AMS-only change is small or negative. Their profiles are therefore complementary: AMS supplies the largest difficult-regime correction, whereas CKR provides a smaller but broader refinement. Figure C.1 also


Figure C.1: Boundary diagnostics. (a) AMS and full DcLBC gains by baseline margin quartile; connectors show the CKR increment and error bars show the dataset-level standard error of the mean (SEM). (b) Within-dataset centered margin and NDCG@10 changes, aggregated into equal-frequency bins.
shows dataset-level uncertainty and the centered association between changes in boundary margin and retrieval quality.
C.2 Optimization Dynamics
Figure C.2 shows that, relative to fixed-scale InSeNT, AMS keeps the adaptive scale above one, increases calibration effort, and reduces conditional sibling-allocation entropy. This is consistent with Proposition A.5: difficult rows receive stronger, more concentrated updates. Routed-layer reconstructions further indicate that CKR redistributes attention across chunks and sharpens final-layer target selection.

Figure C.2: Population training dynamics: adaptive scale, calibration effort, and conditional negative-allocation entropy.
D Robustness and Baseline Comparisons
D.1 Temperature Baseline Comparisons
Table D.1 compares AMS and DcLBC with fixed and adaptive temperature baselines under the same protocol [20, 21]. Controlled-3 is not a separate dataset: it is the macro average over Football, Cities, and EIOPA, the three ConTEB tasks that most directly require document context to resolve a chunk. The comparison shows that global temperature schedules do not match AMS's query-specific document-local calibration.
E Additional Encoder Evidence
E.1 Controlled-3 Context-Necessity Subset and Sub-1B LLM Encoders
Controlled-3 is not a standalone dataset but the unweighted macro average of NDCG@10 on Football, Cities, and EIOPA [2]. Football and Cities require document-level entity resolution, whereas EIOPA requires disambiguation among structurally similar regulatory sections. This subset focuses on retrieval that requires document context. DcLBC
Table D.1: Temperature baselines on ModernBERT-large (NDCG@10, %). Controlled-3 is the macro average over the Football, Cities, and EIOPA datasets in ConTEB.
| Method | ConTEB Avg | Controlled-3 |
|---|---|---|
| InSeNT (τ = 1.0) | 76.70 | 84.20 |
| Fixed τ = 0.8 | 77.15 | 85.08 |
| Dual Temperature [20] | 62.44 | 64.28 |
| MACL (temp.-only) [21] | 76.15 | 82.71 |
| MACL (full) [21] | 63.96 | 65.84 |
| AMS (Ours) | 77.96 | 87.05 |
| DcLBC (AMS + CKR, Ours) | 78.61 | 87.71 |
Table E.1: Aggregate zero-shot comparison of Direct and Late Chunking (LC) modes (NDCG@10, %). Each score pair is reported as Direct/LC.
| Model | ConTEB | Controlled-3 |
|---|---|---|
| Causal encoders | ||
| Qwen3-Embedding [24] | 51.37 / 51.15 | 30.85 / 66.07 |
| Harrier OSS [25] | 51.54 / 47.28 | 35.66 / 53.75 |
| ML-Embed [26] | 45.91 / 39.67 | 25.10 / 40.48 |
| Bidirectional encoders | ||
| Giga Embeddings [30] | 55.75 / 63.58 | 35.22 / 68.43 |
| pplx-embed-v1 [27] | 46.79 / 69.19 | 26.08 / 77.41 |
| BidirLM [28] | 43.02 / 54.47 | 23.30 / 59.08 |
| Nano-Em1-v2 [29] | 39.17 / 41.28 | 21.81 / 42.86 |
outperforms InSeNT on this subset across all three evaluated backbones.
Table E.1 compares independent chunk encoding (Direct) with Late Chunking (LC) for zero-shot sub-1B LLM encoders. LC is inconsistent for causal last-token encoders but improves all evaluated bidirectional mean-pooling encoders on both aggregate columns, consistent with the directionality of context propagation.