{"url":"/method/nt-xent","slug":"nt-xent","name":"NT-Xent","full_name":"Normalized Temperature-scaled Cross Entropy Loss","full_name_withheld":false,"description_markdown":"**NT-Xent**, or **Normalized Temperature-scaled Cross Entropy Loss**, is a loss function. Let $\\text{sim}\\left(\\mathbf{u}, \\mathbf{v}\\right) = \\mathbf{u}^{T}\\mathbf{v}/||\\mathbf{u}|| ||\\mathbf{v}||$ denote the cosine similarity between two vectors $\\mathbf{u}$ and $\\mathbf{v}$. Then the loss function for a positive pair of examples $\\left(i, j\\right)$ is :\r\n\r\n$$ \\mathbb{l}\\_{i,j} = -\\log\\frac{\\exp\\left(\\text{sim}\\left(\\mathbf{z}\\_{i}, \\mathbf{z}\\_{j}\\right)/\\tau\\right)}{\\sum^{2N}\\_{k=1}\\mathcal{1}\\_{[k\\neq{i}]}\\exp\\left(\\text{sim}\\left(\\mathbf{z}\\_{i}, \\mathbf{z}\\_{k}\\right)/\\tau\\right)}$$\r\n\r\nwhere $\\mathcal{1}\\_{[k\\neq{i}]} \\in ${$0, 1$} is an indicator function evaluating to $1$ iff $k\\neq{i}$ and $\\tau$ denotes a temperature parameter. The final loss is computed across all positive pairs, both $\\left(i, j\\right)$ and $\\left(j, i\\right)$, in a mini-batch.\r\n\r\nSource: [SimCLR](https://paperswithcode.com/method/simclr)","description_state":"present","introduced_year":null,"introduced_by":{"title":"Improved Deep Metric Learning with Multi-class N-pair Loss Objective","paper":"/paper/improved-deep-metric-learning-with-multi","first_author":"Kihyuk Sohn","n_authors":1,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/improved-deep-metric-learning-with-multi"},"source":{"url":"http://papers.nips.cc/paper/6200-improved-deep-metric-learning-with-multi-class-n-pair-loss-objective","title":"Improved Deep Metric Learning with Multi-class N-pair Loss Objective","url_on_a_paper_host":true},"code_snippet_url":"https://github.com/google-research/simclr/blob/bfe07eed7f101ab51f3360100a28690e1bfbf6ec/objective.py#L38","code_snippet_url_on_a_code_host":true,"categories":[{"area":"General","area_id":"general","collection":"Loss Functions","url":"/methods/category/loss-functions","pwc_aliases":[]}],"n_papers_tagged":251,"archive_num_papers":251,"papers_newest_first":[{"paper":null,"title":"Low-resource keyword spotting using contrastively trained transformer acoustic word embeddings","date":"2025-06-21","arxiv_id":"2506.17690","n_code_links":0,"syntology":null},{"paper":null,"title":"Probabilistic Variational Contrastive Learning","date":"2025-06-11","arxiv_id":"2506.10159","n_code_links":0,"syntology":null},{"paper":"/paper/2506-10031","title":"scSSL-Bench: Benchmarking Self-Supervised Learning for Single-Cell Data","date":"2025-06-10","arxiv_id":"2506.10031","n_code_links":1,"syntology":null},{"paper":"/paper/circumventing-backdoor-space-via-weight","title":"Circumventing Backdoor Space via Weight Symmetry","date":"2025-06-09","arxiv_id":"2506.07467","n_code_links":1,"syntology":null},{"paper":"/paper/ssps-self-supervised-positive-sampling-for","title":"SSPS: Self-Supervised Positive Sampling for Robust Self-Supervised Speaker Verification","date":"2025-05-20","arxiv_id":"2505.14561","n_code_links":1,"syntology":null},{"paper":null,"title":"Representation Learning via Non-Contrastive Mutual Information","date":"2025-04-23","arxiv_id":"2504.16667","n_code_links":0,"syntology":null},{"paper":null,"title":"Impact of Language Guidance: A Reproducibility Study","date":"2025-04-10","arxiv_id":"2504.08140","n_code_links":0,"syntology":null},{"paper":null,"title":"Unsupervised Detection of Fraudulent Transactions in E-commerce Using Contrastive Learning","date":"2025-03-24","arxiv_id":"2503.18841","n_code_links":0,"syntology":null},{"paper":null,"title":"A Statistical Theory of Contrastive Learning via Approximate Sufficient Statistics","date":"2025-03-21","arxiv_id":"2503.17538","n_code_links":0,"syntology":null},{"paper":null,"title":"SinSim: Sinkhorn-Regularized SimCLR","date":"2025-02-13","arxiv_id":"2502.10478","n_code_links":0,"syntology":null},{"paper":"/paper/dataset-ownership-verification-in-contrastive","title":"Dataset Ownership Verification in Contrastive Pre-trained Models","date":"2025-02-11","arxiv_id":"2502.07276","n_code_links":1,"syntology":null},{"paper":"/paper/self-supervised-frameworks-for-speaker","title":"Self-Supervised Frameworks for Speaker Verification via Bootstrapped Positive Sampling","date":"2025-01-29","arxiv_id":"2501.17772","n_code_links":1,"syntology":null},{"paper":null,"title":"Bridging Contrastive Learning and Domain Adaptation: Theoretical Perspective and Practical Application","date":"2025-01-28","arxiv_id":"2502.00052","n_code_links":0,"syntology":null},{"paper":null,"title":"Learning Compact and Robust Representations for Anomaly Detection","date":"2025-01-09","arxiv_id":"2501.05130","n_code_links":0,"syntology":null},{"paper":"/paper/enhancing-contrastive-learning-inspired-by","title":"Enhancing Contrastive Learning Inspired by the Philosophy of \"The Blind Men and the Elephant\"","date":"2024-12-21","arxiv_id":"2412.16522","n_code_links":1,"syntology":null},{"paper":null,"title":"Self-Supervised Radiograph Anatomical Region Classification -- How Clean Is Your Real-World Data?","date":"2024-12-20","arxiv_id":"2412.15967","n_code_links":0,"syntology":null},{"paper":null,"title":"Maximising Histopathology Segmentation using Minimal Labels via Self-Supervision","date":"2024-12-19","arxiv_id":"2412.15389","n_code_links":0,"syntology":null},{"paper":"/paper/amclr-unified-augmented-learning-for-cross","title":"AmCLR: Unified Augmented Learning for Cross-Modal Representations","date":"2024-12-10","arxiv_id":"2412.07979","n_code_links":1,"syntology":null},{"paper":null,"title":"Mitigating Instance-Dependent Label Noise: Integrating Self-Supervised Pretraining with Pseudo-Label Refinement","date":"2024-12-06","arxiv_id":"2412.04898","n_code_links":0,"syntology":null},{"paper":"/paper/tight-pac-bayesian-risk-certificates-for","title":"Tight PAC-Bayesian Risk Certificates for Contrastive Learning","date":"2024-12-04","arxiv_id":"2412.03486","n_code_links":1,"syntology":null},{"paper":null,"title":"Explorations in Self-Supervised Learning: Dataset Composition Testing for Object Classification","date":"2024-12-01","arxiv_id":"2412.00770","n_code_links":0,"syntology":null},{"paper":"/paper/breccia-and-basalt-classification-of-thin","title":"Breccia and basalt classification of thin sections of Apollo rocks with deep learning","date":"2024-10-28","arxiv_id":"2410.21024","n_code_links":1,"syntology":null},{"paper":null,"title":"Accelerating Augmentation Invariance Pretraining","date":"2024-10-27","arxiv_id":"2410.22364","n_code_links":0,"syntology":null},{"paper":null,"title":"Rethinking Positive Pairs in Contrastive Learning","date":"2024-10-23","arxiv_id":"2410.18200","n_code_links":0,"syntology":null},{"paper":null,"title":"SigCLR: Sigmoid Contrastive Learning of Visual Representations","date":"2024-10-22","arxiv_id":"2410.17427","n_code_links":0,"syntology":null},{"paper":null,"title":"Self-Supervised Anomaly Detection in the Wild: Favor Joint Embeddings Methods","date":"2024-10-05","arxiv_id":"2410.04289","n_code_links":0,"syntology":null},{"paper":null,"title":"BiSSL: Enhancing the Alignment Between Self-Supervised Pretraining and Downstream Fine-Tuning via Bilevel Optimization","date":"2024-10-03","arxiv_id":"2410.02387","n_code_links":0,"syntology":null},{"paper":null,"title":"Understanding the Benefits of SimCLR Pre-Training in Two-Layer Convolutional Neural Networks","date":"2024-09-27","arxiv_id":"2409.18685","n_code_links":0,"syntology":null},{"paper":"/paper/self-supervised-pretraining-for-1","title":"Self-supervised Pretraining for Cardiovascular Magnetic Resonance Cine Segmentation","date":"2024-09-26","arxiv_id":"2409.18100","n_code_links":1,"syntology":null},{"paper":"/paper/cross-model-cross-stream-learning-for-self","title":"Cross-Model Cross-Stream Learning for Self-Supervised Human Action Recognition","date":"2024-09-23","arxiv_id":null,"n_code_links":1,"syntology":null}],"papers_shown":30,"tasks":[{"task":"/task/contrastive-learning","name":"Contrastive Learning","papers":123},{"task":"/task/self-supervised-learning","name":"Self-Supervised Learning","papers":121},{"task":"/task/representation-learning","name":"Representation Learning","papers":78},{"task":"/task/data-augmentation","name":"Data Augmentation","papers":29},{"task":"/task/image-classification","name":"Image Classification","papers":21},{"task":"/task/transfer-learning","name":"Transfer Learning","papers":16},{"task":"/task/image-classification","name":"image-classification","papers":16},{"task":"/task/linear-evaluation","name":"Linear evaluation","papers":11},{"task":"/task/retrieval","name":"Retrieval","papers":11},{"task":"/task/object-detection","name":"Object Detection","papers":10},{"task":"/task/object-detection-1","name":"object-detection","papers":10},{"task":"/task/semantic-segmentation","name":"Semantic Segmentation","papers":9},{"task":"/task/classification-1","name":"Classification","papers":8},{"task":"/task/clustering","name":"Clustering","papers":8},{"task":"/task/classification","name":"General Classification","papers":8},{"task":"/task/activity-recognition","name":"Activity Recognition","papers":7},{"task":"/task/human-activity-recognition","name":"Human Activity Recognition","papers":7},{"task":"/task/segmentation","name":"Segmentation","papers":7},{"task":null,"name":"Triplet","papers":7},{"task":"/task/anomaly-detection","name":"Anomaly Detection","papers":5}],"tasks_shown":20,"n_tasks":212,"usage_by_year":[{"year":"2016","papers":1},{"year":"2018","papers":1},{"year":"2020","papers":24},{"year":"2021","papers":51},{"year":"2022","papers":58},{"year":"2023","papers":54},{"year":"2024","papers":48},{"year":"2025","papers":14}],"row_source":"methods_table","archive":{"source":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","archive_url":"https://paperswithcode.com/method/nt-xent"},"syntology_read_at":"2026-09-24T18:15:14+00:00"}