Embedding Dimension of Contrastive Learning and k-Nearest Neighbors
Dmitrii Avdiukhin, Vaggos Chatziafratis, Orr Fischer, Grigory Yaroslavtsev
Abstract
We study the embedding dimension of distance comparison data in two settings: contrastive learning and k-nearest neighbors (k-NN). Our goal is to find the smallest dimension d of an ℓ p -space in which a given dataset can be represented. We show that the arboricity of the associated graphs plays a key role in designing embeddings. For the most popular ℓ 2 -space, we get tight bounds in both settings. In contrastive learning, we are given m labeled samples (x i , y + i , z - i ) representing the fact that the positive example y i is closer to the anchor x i than the negative example z i (we also give results for t negatives). For representing such dataset in:
• ℓ 2 : d = Θ( √ m) is necessary and sufficient, consistent with our experiments.
• ℓ p for p ≥ 1: d = O(m) is sufficient and d = Ω( √ m) is necessary.
• ℓ ∞ : d = O(m 2/3 ) is sufficient and d = Ω( √ m) is necessary. In k-NN, for each of the n data points we are given an ordered set of the closest k points. We show that for preserving the ordering of the k-NN for every point in:
• ℓ 2 : d = Θ(k) is necessary and sufficient.
• ℓ p for p ≥ 1: d = Õ(k 2 ) is sufficient and d = Ω(k) is necessary.
• ℓ ∞ : d = Ω(k) is necessary. Furthermore, if the goal is to not just preserve the ordering of the k-NN but also keep them as the nearest neighbors, then d = Õ(poly(k)) suffices in ℓ p for p ≥ 1.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext a9b2eb8f-a96a-4b07-8011-3b52a3f590a1Cited by top-tier papers3
- The Complexity of Finding Local Optima in Contrastive LearningJingming Yan, Yiyuan Luo, Vaggos Chatziafratis, Ioannis Panageas et al.NeurIPS 2025 · 2 citations
- Group-aware Multiscale Ensemble Learning for Test-Time Multimodal Sentiment AnalysisKai Tang, Yixuan Tang, Tianyi Chen, Haokai Xu et al.AAAI 2026
- Provable Accuracy Collapse of Embedding-Based Representations under Dimensionality MismatchDionysis Arvanitakis, Vaggos Chatziafratis, Yiyuan LuoICML 2026
Builds on17
- A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 citations
- Understanding Contrastive Representation Learning through Alignment and Uniformity on the HypersphereTongzhou Wang, Phillip IsolaICML 2020 · 2,360 citations
- Debiased Contrastive LearningChing-Yao Chuang, Joshua Robinson, Yen-Chen Lin, Antonio Torralba et al.NeurIPS 2020 · 761 citations
- On Mutual Information Maximization for Representation LearningMichael Tschannen, Josip Djolonga, Paul K. Rubenstein, Sylvain Gelly et al.ICLR 2020 · 559 citations
- Provable Guarantees for Self-Supervised Deep Learning with Spectral Contrastive LossJeff Z. HaoChen, Colin Wei, Adrien Gaidon, Tengyu MaNeurIPS 2021 · 425 citations
Related papers
- Optimal Sample Complexity of Contrastive LearningNoga Alon, Dmitrii Avdiukhin, Dor Elboim, Orr Fischer et al.ICLR 2024 · 15 citations
- Labelings vs. Embeddings: On Distributed Representations of DistancesArnold Filtser, Lee-Ad Gottlieb, Robert KrauthgamerSODA 2020 · 5 citations
- Order-Preserving Dimension Reduction for Multimodal Semantic EmbeddingChengyu Gong, Gefei Shen, Luanzheng Guo, Nathan R. Tallent et al.AAAI 2026 · 2 citations
- Understanding and Mitigating Hyperbolic Dimensional Collapse in Graph Contrastive LearningYifei Zhang, Hao Zhu, Menglin Yang, Jiahong Liu et al.KDD 2025 · 4 citations
- On Efficient Low Distortion Ultrametric EmbeddingVincent Cohen-Addad, Karthik C. S., Guillaume LagardeICML 2020 · 13 citations
