Cookie Consent
Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent.
Read our Privacy Policy

Triplet Loss

Triplet Loss is a loss function used in machine learning, particularly in the context of training neural networks for tasks involving learning similarities and differences between inputs, such as face recognition and similarity learning.

How Triplet Loss Works

Triplet loss operates on three data points at a time (a triplet) - an anchor, a positive example (similar to the anchor), and a negative example (dissimilar to the anchor). The goal of the loss function is to ensure that the anchor is closer to the positive example than to the negative example in the learned feature space. This is typically used in tasks where the relationships between data points are more important than their individual categorizations.

Lakera LLM Security Playbook
Learn how to protect against the most common LLM vulnerabilities

Download this guide to delve into the most common LLM security risks and ways to mitigate them.

Related terms
untouchable mode.
Get started for free.

Lakera Guard protects your LLM applications from cybersecurity risks with a single line of code. Get started in minutes. Become stronger every day.

Join our Slack Community.

Several people are typing about AI/ML security. 
Come join us and 1000+ others in a chat that’s thoroughly SFW.