Skip to content
Machine Learning

ArcFace: The Loss Function That Makes Modern Face Recognition So Accurate

ArcFace is a loss function that trains face recognition by adding an angular margin between each face and its identity's centre, which forces tighter, better-separated clusters. It trains like a simple classifier, so it avoids the pair mining that contrastive and triplet loss need. Introduced by Jiankang Deng and colleagues in 2019, it reached 99.83% on LFW. Ollie's model uses CosFace, a close relative that applies the margin to the cosine instead.

The Ollie teamJune 15, 2026 · 3 min read
3D plot of a unit sphere with an arc drawn across its surface
Image: BagLuke, CC BY-SA 4.0, via Wikimedia Commons (resized)

The Problem: Learning a Good Face Space

A face recognition network turns a face into an embedding, a list of numbers (512 in Ollie's case). The goal is a space where photos of the same person land close together and different people land far apart. The loss function is how training measures progress toward that goal.

Before 2017, two approaches dominated:

  • Contrastive loss looked at pairs of photos: pull same-person pairs together, push different-person pairs apart beyond a margin. See contrastive loss explained.
  • Triplet loss, made famous by Google's FaceNet in 2015, looked at three photos at a time: an anchor, a positive of the same person and a negative of someone else.

Both work, but both need careful selection of hard pairs or triplets, and the number of possible combinations explodes with dataset size. Training was slow and finicky.

The Classifier Trick

The alternative was to train the network as a classifier: give it photos of 85,000 people and ask it to say which person each photo shows, using an ordinary softmax layer. After training, throw away the classifier and keep the embedding layer.

Plain softmax has a weakness. It only needs each photo to score highest for the right person. It doesn't care whether the margin is huge or razor-thin. The resulting embeddings separate the training identities, but not with enough room to spare for new faces.

The fix was to normalise everything and think in angles. If both the embedding and each person's classifier weight vector are scaled to length 1, the classifier score is just the cosine of the angle between them. Each person's weight vector acts like a centre for that identity on the surface of a sphere. Now you can demand a margin.

Read more: What Is Facial Embedding? The Technology Behind Celebrity Matching

Three Ways to Add a Margin

Three closely related papers added a margin in slightly different ways. With θ as the angle between a face's embedding and its true identity's centre:

MethodYearMargin applied asTypical setting
SphereFace (A-Softmax)2017Multiply the angle: cos(m·θ)m = 4
CosFace (Large Margin Cosine Loss)2018Subtract from the cosine: cos(θ) − mm = 0.35, scale s = 64
ArcFace (Additive Angular Margin)2019Add to the angle: cos(θ + m)m = 0.5, scale s = 64

In each case, the right answer is made artificially harder during training. The network can only win by pulling each face much closer to its identity's centre than strictly necessary, which leaves clear gaps between people.

ArcFace's version has a neat geometric meaning: the margin is a fixed distance along the surface of the sphere (an arc, hence the name). That makes the gap between identities the same everywhere, and in practice ArcFace trained a little more stably and scored slightly better than the others.

The Results

Jiankang Deng, Jia Guo, Niannan Xue and Stefanos Zafeiriou published ArcFace at CVPR 2019. Trained on MS1MV2 with a ResNet-100 backbone, it reached 99.83% on LFW, around 98% on the cross-age AgeDB-30 and the front-to-profile CFP-FP, and strong results on the much harder IJB-B and IJB-C benchmarks. The team released code and models through the InsightFace project, which helped ArcFace become the default choice for years.

The loss is also cheap. There's no pair or triplet mining. Each photo is processed once per step like any classification problem, which makes training on millions of images straightforward.

Get new guides by email

By joining, you agree that Ollie can email you about new features and style tips. Every email has an unsubscribe link. Privacy

Why Ollie Uses CosFace

Ollie's 20-layer network was trained with CosFace (s = 64, m = 0.40) rather than ArcFace. The two give very similar embeddings, and CosFace has a practical advantage: because it simply subtracts a constant from the cosine, it's simpler and very stable, with no special handling needed when angles get large. For a model trained from scratch on a single consumer GPU, that stability was worth more than the small difference in benchmark scores.

The result scores 99.5% on LFW, with LFW identities removed from training first. For more on the full model, see how Ollie works.

Limits and Later Work

Margin losses assume clean labels. Web-scraped datasets contain mistakes, and a hard margin can force the network to cram mislabelled photos into the wrong cluster. Later methods such as Sub-center ArcFace (2020) give each identity several centres so noisy photos can sit apart, and AdaFace (2022) adjusts the margin based on image quality so blurry photos aren't punished as hard.

The core idea has held up: normalise, think in angles and demand a margin. Most face models in use today are trained with ArcFace, CosFace or one of their descendants.

Frequently Asked Questions

What is ArcFace?

A loss function for face recognition that adds an angular margin between each face and its identity's centre during training, producing tight, well-separated clusters. It was introduced by Deng and colleagues in 2019.

What is the difference between ArcFace and CosFace?

Both add a margin. ArcFace adds it to the angle, cos(θ + m). CosFace subtracts it from the cosine, cos(θ) − m. They give very similar results.

Why does ArcFace beat triplet loss?

It trains like a classifier, one image at a time, so there's no hard triplet mining, and it enforces a fixed margin between every identity.

What accuracy does ArcFace get on LFW?

99.83% with a ResNet-100 trained on MS1MV2, as reported in the 2019 paper.

Try it yourself

Find your celebrity lookalike

Upload a photo and see which celebrities you look most like. Free to try, and your photo is never stored.

Find my celebrity look alike

About the author

The Ollie teamWrites for Ollie, a free celebrity lookalike AI

The Ollie team wrote and trained Ollie's own face-recognition model from scratch, and writes these guides to explain how face matching works in plain English. Questions or corrections are welcome on the contact page, and the FAQ covers how Ollie works and what happens to your photo.

Related Articles