CurricularFace: Adaptive Curriculum Learning Loss for Deep Face Recognition
- Publication
- CVPR 2020Conference
- First submitted to arXiv
- arXiv:2004.00288
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{facerecognitioncurricularface2020,
title = {{CurricularFace: Adaptive Curriculum Learning Loss for Deep Face Recognition}},
author = {Yuge Huang and Yuhan Wang and Ying Tai and Xiaoming Liu and Pengcheng Shen and Shaoxin Li and Jilin Li and Feiyue Huang},
year = {2020},
eprint = {2004.00288},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2004.00288}
}
Train MobileFaceNet with ArcFace, the margin at ArcFace's default of 0.5, on CASIA-WebFace. The loss goes down until around step 2,100, suddenly bounces back up, and a few hundred steps later turns into NaN; only after the margin is lowered to 0.45 does it train.
Small networks buckling under large margins was not news at the time. The paper cites AirFace's observation that ArcFace diverges on small backbones such as MobileFaceNet and has to be pretrained for a while with plain softmax first. Around the same time, another school of methods wanted to weigh hard samples even more heavily. MV-Arc-Softmax picks out misclassified samples and up-weights them, with the weighting factor (in the CurricularFace paper's notation) a hand-set constant greater than 1, for example 1.2; the paper relays MV-Arc-Softmax's own claim that a slightly larger , above 1.4, may make the model hard to converge.
On one side, a margin that treats every sample the same; on the other, mining that up-weights hard samples from the very first step. The question this paper asks is whether hard samples should be up-weighted from the start at all.
People usually learn the easy things first and the hard things later, and in machine learning this idea is called curriculum learning, proposed by Bengio et al. in 2009: draw up a syllabus ordered by sample difficulty, teach the easy ones first, then the hard ones. The catch is that a traditional syllabus has to fix every sample's difficulty in advance. Yuge Huang, Ying Tai, Feiyue Huang and others at Tencent Youtu Lab, together with Yuhan Wang of Zhejiang University and Xiaoming Liu of Michigan State University, want the loss function to decide for itself which lesson the class is on.
Defining the Problem
The common skeleton of margin-based softmax
First, write the face recognition losses of recent years in one form. The backbone's output feature and every column of the fully connected layer's weights are L2-normalized, so their inner product is the cosine of the angle between them, ; can be seen as the class center of the -th identity. The cosine times a scale (64 here, as in ArcFace) is the logit fed to softmax. The paper writes all the methods as one equation, Eq. (1):
is the correct class. governs the correct-class logit, where the margin is added; governs the other classes, the negative classes. The negative-class form is written uniformly as:
is called the modulation coefficient and is a constant. ArcFace's setting is with , and the negative classes are left untouched, and .
What counts as a hard sample
MV-Arc-Softmax and CurricularFace use the same criterion. For sample and some negative class , whenever
the pair counts as hard. That is, once the margin is added, the correct class loses to this negative class.
Plug in some numbers. Suppose a face is at angle from its own class center; radians is about 28.6°, so adding it gives 88.6°, and . There are two negative classes:
- the first at 75°, , hard;
- the second at 89°, , easy.
The first negative class is actually farther away than the correct class (75° versus 60°); without the margin, this face would be classified correctly, and only the margin turns it into a "misclassification." So hardness here is judged pair by pair: the same face can be hard for some negative classes and easy for others, and the margin itself manufactures hard samples.
As this paper summarizes it, MV-Arc-Softmax changes the negative cosine of a hard pair to , with in the figure. The first negative class's 0.259 becomes 0.511; multiplied by , the logit goes from 16.6 to 32.7, and the hard sample's loss grows sharply. Because
as long as , the logit of a hard negative class is always raised, from the first training step to the last.
That leaves two questions. Can the force with which hard samples are up-weighted change with training progress? And how should progress be measured, so that nobody has to hand-tune a constant the way MV-Arc-Softmax does?
Solving the Problem
Putting progress into the modulation coefficient
CurricularFace's correct class follows ArcFace, ; the paper notes that any margin form could go here. All the changes are on the hard negative classes. Writing , the of Eq. (7) is
Easy negative classes stay as they are. For hard negative classes the modulation coefficient becomes , which depends on two things at once. stands for training progress, starting at 0 and growing; stands for how hard this pair is: the closer the negative class, the larger the cosine and the larger the coefficient.

The horizontal axis is the angle to the negative class; the farther left, the harder. The two red lines in the left chart are the two extremes of . At (dashed), , below 1 everywhere, so the logits of all hard negative classes are pushed down; at (solid), , above 1 everywhere, so every hard negative class is raised, and the harder it is, the more it is raised. During training climbs from 0, the red line moves from the dashed one toward the solid one, and that is what the red arrow on the left depicts. The right chart shows the negative cosine after multiplying back by ; compared with the blue line (ArcFace, no modulation), you can see whether each stage pushes down or raises.
When is between the two ends, where is the dividing line? For , is equivalent to . At , the negative cosine has to exceed 0.7 to be up-weighted; at , anything above 0.26 is. Listing a few values, each cell holds and the gradient coefficient used in the next section:
| 0.1 | 0.40/0.50 | 0.70/0.80 | 0.84/0.94 |
| 0.3 | 0.60/0.90 | 0.90/1.20 | 1.04/1.34 |
| 0.5 | 0.80/1.30 | 1.10/1.60 | 1.24/1.74 |
Computed for this note from Eqs. (7) and (8) of the paper; in each cell the left value is and the right is . Above 1 means more weight than ArcFace.
Back to that 75° negative class, . At , the modulated value is and the logit drops from 16.6 to 9.3; at , the coefficient is 0.999 and the logit is 16.5, almost back to ArcFace. The same pair of samples is let off early on and treated as usual later.
In terms of decision boundaries, the boundary for a hard sample is . Compared with ArcFace's , this amounts to an extra margin . When , is negative and the boundary is looser than ArcFace's; once grows, turns positive and the boundary is stricter than ArcFace's. MV-Arc-Softmax's extra margin is , which is always positive at .
How the gradient changes
The logit of a hard negative class is ; treating as a constant and differentiating with respect to :
So in the paper's Eq. (8), the gradient a hard negative class sends back to the features and weights carries one extra factor compared with ArcFace:
ArcFace's is fixed at 1, MV-Arc-Softmax's at . CurricularFace's grows with and also with the difficulty of the negative class. The paper plots and over one training run.

The red line is . It starts at 0, climbs to 0.5 within the first few thousand iterations, then sits near 0.6; at around iteration 27,000 it jumps above 0.65, then climbs to 0.7 and finally settles at 0.74. The green band is the range of from smallest to largest over all hard negative classes at each iteration: about 0.7 to 0.97 early on, raised to 0.85 to 1.27 later; the blue line is MV-Arc-Softmax's 1.2. The paper's explanation is that fewer hard samples are mined later in training, which is why spikes appear along the band's upper edge.
There are two more things to read from this figure; what follows is this note's own inference.
First, where jumps. The figure runs to about 48,000 iterations, which matches 50 epochs on CASIA-WebFace (about 490,000 images) at batch size 512; the learning rate in that setting drops at epochs 28 and 38, which comes to around iterations 27,000 and 36,500, exactly where the red line jumps up twice. When the learning rate drops, the correct-class cosines rise across the board and follows. In this run, the curriculum's "next stage" follows the learning-rate schedule.
Second, the range of lets you back out the range of . Late in training, and peaks at about 1.27, meaning the hardest negative class has of about 0.27, so is about 1.0; the minimum of about 0.85 corresponds to of about 0.8. Early on, and falls roughly between 0.65 and 0.8. In other words, in the paper's own run, the coefficient for hard negative classes stays below 1 almost the whole way, pushing down hard early and less later, and only at the end returns to around ArcFace. The second half of "learn the easy ones first, then up-weight the hard ones" is far gentler than the red line in Figure 1.
How is estimated
What remains is where comes from. The authors observe that the mean of , the cosine between every sample in a batch and its own class center, can serve as an indicator of training progress: the more mature the model, the higher this mean. A single batch's statistic gets dragged around by extreme samples, so it is smoothed with an exponential moving average (EMA), Eq. (9):
is the mean positive cosine of the -th batch (without the margin). Note that this is , not the margin-added .
The paper says , meaning each step looks almost entirely at the current batch. The official code says:
self.t = target_logit.mean() * 0.01 + (1 - 0.01) * self.t
The new batch gets only 0.01 and the old value 0.99, exactly the reverse. In April 2020 someone asked in issue #8 which one was right, and the maintainer HuangYG123 replied the same day with an apology, saying the code is the right version. After that the question was asked three more times, in issue #19, #32 and #37, with no reply from a maintainer; arXiv has only this one version, and Eq. (9) in the official CVPR version still says 0.99. Tencent's own TFace training framework includes CurricularFace, with yet another default of 0.1. (Paper 0.99, official code 0.01, TFace 0.1: take your pick.)
With the official code's 0.01, takes about 100 iterations to reach 63% of its target and 300 to reach 95%. For training that runs tens of thousands of iterations, this merely smooths out the noise between batches.
As for which statistic to use for , the authors compared three:
| Statistic | LFW | CFP-FP |
|---|---|---|
| Mode of positive cosine | 99.42 | 96.49 |
| Mean of correct-class prob. | 99.42 | 95.39 |
| Mean of positive cosine | 99.47 | 96.96 |
Compiled from Table 3 of the paper (%).
The mean beats the mode, and the cosine beats the probability. Under the probability is very steep, with most samples close to either 0 or 1, too coarse to measure progress; that is this note's reading, while the paper only says the cosine better reflects the training stage.
also depends on the backbone. The asker in issue #8 trained with ResNet18 and saw only around 0.4 in the first stage, against 0.6 in the paper's figure; the maintainer replied that small backbones have a harder time pushing the positive cosine up.
The official implementation
The whole method is one classification head in code. The version below follows CurricularFace.forward in the official head/metrics.py, keeps the variable names of the original file, merges a few lines and omits the raw cosine returned for accuracy computation; the comments were added for this note:
embbedings = l2_norm(embbedings, axis=1)
kernel_norm = l2_norm(self.kernel, axis=0)
cos_theta = torch.mm(embbedings, kernel_norm).clamp(-1, 1) # (B, n)
target_logit = cos_theta[torch.arange(0, embbedings.size(0)), label].view(-1, 1)
sin_theta = torch.sqrt(1.0 - torch.pow(target_logit, 2))
cos_theta_m = target_logit * self.cos_m - sin_theta * self.sin_m # cos(theta_y + m)
mask = cos_theta > cos_theta_m # hard pairs, element-wise
final_target_logit = torch.where(target_logit > self.threshold, # theta_y + m <= pi
cos_theta_m, target_logit - self.mm) # else cos(theta_y) - m*sin(m)
hard_example = cos_theta[mask]
with torch.no_grad(): # t is a buffer, no gradient
self.t = target_logit.mean() * 0.01 + (1 - 0.01) * self.t
cos_theta[mask] = hard_example * (self.t + hard_example) # Eq. (7)
cos_theta.scatter_(1, label.view(-1, 1).long(), final_target_logit) # positive column last
output = cos_theta * self.s # logits for CrossEntropyLoss
A few implementation details:
maskis element-wise, judged once for each negative class of each sample; the correct-class column also falls intomask, but is overwritten byscatter_at the end.- The modulation line is not wrapped in
no_grad, so the gradient with respect tohard_exampleis exactly ; itself passes no gradient. thresholdandmmare carried over from ArcFace's official code. Once passes 180°, rises again as the angle grows, so the worst samples would be penalized less; hence when (about 151° for ), is used instead. Someone asked about the meaning of this line in issue #31 (July 2021), people were still adding the same question in 2024, and the maintainers never replied.tis a tensor registered withregister_buffer, and the line above reassigns it rather than modifying it in place. PyTorch'snn.DataParallelrebuilds replicas of the module on each GPU at every forward pass, and updates to module attributes made during the forward pass are discarded. So if this head is wrapped in DataParallel, stays at 0 forever, equivalent to a fixed ; issue #10 (May 2020) reported that with multiple GPUs starts from 0 every time, again with no reply from a maintainer. The official training script uses DistributedDataParallel, which does not have this problem.
The head costs very little. In the same environment with the same batch size, ArcFace takes 0.370 seconds per iteration and CurricularFace 0.378 seconds, 2% more; at inference the classification head is discarded entirely, so the cost is the same as the backbone's.
Discussion
Experimental setup
- Training data: CASIA-WebFace (about 10,000 people, 490,000 images) and the cleaned MS1MV2 (about 86,000 people, 5.8 million images), trained separately to allow comparison with earlier work.
- Preprocessing and backbone: faces aligned with five landmarks and cropped to 112×112 as in ArcFace; the backbones are ArcFace's versions of ResNet50 and ResNet100.
- Optimization: PyTorch, 4 Tesla P40 GPUs, batch size 512, SGD (momentum 0.9, weight decay 5e−4), initial learning rate 0.1. CASIA-WebFace drops the learning rate at epochs 28, 38 and 46, for 50 epochs in total; MS1MV2 drops it at epochs 10, 18 and 22, for 24 in total. , .
Fixed versus adaptive
| LFW | CFP-FP | |
|---|---|---|
| 0 | 99.32 | 95.90 |
| 0.3 | 99.37 | 96.47 |
| 0.7 | 99.42 | 96.66 |
| 1 | 99.45 | 93.94 |
| Adaptive | 99.47 | 96.96 |
Compiled from Table 2 of the paper (%).
means hard negative classes are always pushed down; means they are always up-weighted. LFW rises slightly all the way from 0 to 1, with differences all within 0.15; CFP-FP, which verifies frontal against profile faces, is more sensitive, and drops to 93.94%, nearly 3 percentage points below . Up-weighting hard samples from start to finish hurts most on the test with large pose variation.
is already very close to the adaptive result. The adaptive ends at 0.74 and stays below 0.7 for the first thirty thousand iterations, so the two differ mainly in the early part of training. The gap between them is 0.05 on LFW and 0.30 percentage points on CFP-FP.
For both this table and the earlier comparison of statistics, the paper does not say which training set and backbone were used (guess the ablation setup yourself).
Convergence on a small backbone
The NaN experiment from the opening comes from here.

MobileFaceNet on CASIA-WebFace. At , the green ArcFace line in the inset bottoms out around iteration 2,140 and rebounds, and the paper says it becomes NaN at about iteration 2,400; the blue CurricularFace line converges, with LFW 99.25%. At both converge, CurricularFace at 99.20% and ArcFace at 99.10%.
Now look at the early and late parts of the curves. At first the yellow line (CurricularFace) is clearly below the red line (ArcFace), because the hard samples' losses are pushed down; later the yellow line is slightly above the red, which the paper attributes to up-weighting hard samples in the later stage. By the inference above, however, the late-stage coefficients are mostly still below 1, and with coefficients below 1, plugging in the same features gives CurricularFace a loss that can only be smaller than ArcFace's. The two curves come from two separately trained models, so the level of the loss also reflects differences in the features themselves; this figure alone cannot measure how much up-weighting took place.
Against ArcFace
The main results use MS1MV2 and ResNet100. LFW is already saturated: CurricularFace 99.80%, ArcFace 99.77%. On the other four 1:1 verification sets, CFP-FP and CPLFW test pose, while AgeDB and CALFW test age:
| Method | CFP-FP | CPLFW | AgeDB | CALFW |
|---|---|---|---|---|
| ArcFace | 98.27 | 92.08 | 98.15 | 95.45 |
| MV-Arc-Softmax* | 98.28 | 92.83 | 97.95 | 96.10 |
| CurricularFace | 98.37 | 93.13 | 98.32 | 96.20 |
Compiled from Table 4 of the paper (%); * marks results the authors reproduced with ResNet100.
IJB-B and IJB-C are harder mixed-quality datasets, where each person has several photos and frames from several videos; together these form a template, and the paper follows ArcFace in averaging the features within a template. IJB-B has 1,845 people, and its 1:1 verification has 10,270 same-person and 8 million different-person template pairs; IJB-C has about 3,500 people, with 19,557 same-person and 15.64 million different-person pairs. The metric TAR@FAR=1e−4 means setting the threshold so that only one in every ten thousand different-person pairs may be falsely accepted, then seeing what share of same-person pairs pass at that threshold.
| Method | IJB-B | IJB-C |
|---|---|---|
| ArcFace | 94.2 | 95.6 |
| MV-Arc-Softmax* | 93.6 | 95.2 |
| CurricularFace | 94.8 | 96.1 |
Compiled from Table 5 of the paper; TAR@FAR=1e−4 (%).
The error rate drops from 5.8% to 5.2% and from 4.4% to 3.9%, relative reductions of 10% and 11%.
MegaFace tests identification. The 530 people of FaceScrub, about 100,000 photos, serve as probes, and the database mixes in 1 million distractor photos of 690,000 people; two numbers are reported. Id is the rank-1 identification rate: a probe searches for its closest match among the 1 million distractors and has to find the right person. Ver is the verification pass rate at FAR=1e−6. MegaFace's original labels contain quite a few errors, and the ArcFace team compiled a cleaning list, so the table shows results before and after cleaning:
| Method | Id | Ver |
|---|---|---|
| ArcFace | 81.03 | 96.98 |
| MV-Arc-Softmax* | 80.59 | 96.22 |
| CurricularFace | 81.26 | 97.26 |
| ArcFace (cleaned) | 98.35 | 98.48 |
| MV-Arc-Softmax* (cleaned) | 97.76 | 97.80 |
| CurricularFace (cleaned) | 98.71 | 98.64 |
Compiled from Table 6 of the paper (MS1MV2, ResNet100, %).
All three tables point the same way, with CurricularFace highest in every column, by roughly 0.1 to 1 percentage point. The small training set (CASIA-WebFace, ResNet50) behaves the same, with the cleaned Id going from ArcFace's 91.75% to 92.48%.
There is one condition when reading these tables. The ArcFace rows are the ArcFace paper's own numbers, trained with MXNet; CurricularFace uses its own PyTorch code. The only comparisons with the same code and only the loss swapped are the authors' reproduction of MV-Arc-Softmax and the ablations above.
Results from other people's reruns
Outside the paper, several independent reruns are less one-sided.
- Official issues. In issue #17 (June 2020), a user trained IR-101 from scratch with the official code and got LFW 99.77%, CFP-FP 98.30% and AgeDB 98.18%, against 99.80%, 98.36% and 98.37% for the pretrained model in the README: a rough reproduction, with AgeDB 0.19 short.
- FaceX-Zoo (JD AI's face recognition toolbox, October 2021 version) compared eight classification heads with the same MobileFaceNet and the same MS-Celeb-1M-v1c. CurricularFace's MegaFace rank-1 is 87.27%, against ArcFace's 88.39% and MV-Softmax's 90.39%; on AgeDB it scores 95.82%, against ArcFace's 96.23%. This toolbox's authors overlap with MV-Softmax's.
- AdaFace (2022) ran a same-setting comparison with ResNet50 on MS1MV2. Without data augmentation, CurricularFace averages 96.85% on the high-quality test sets and 41.00% on the low-quality ones, both slightly above AdaFace's 96.72% and 40.95%; with augmentation, CurricularFace drops on both.
- AdaSin (a 2025 preprint) retrained on MS1MV3 with IResNet50: CurricularFace's IJB-C TAR@FAR=1e−5 is 94.41%, against ArcFace's 94.74%; CFP-FP is 97.30%, against ArcFace's 98.03%. This paper also points out that CurricularFace's modulation coefficient rarely exceeds 1, consistent with the inference above.
The last three all come from authors proposing competing methods, and their backbones, data and training lengths differ from the original paper's; they only show that CurricularFace's lead depends on the setup. The paper's own MS1MV2/ResNet100 results have not been overturned.
Pitfalls with the pretrained model
The official README includes a pretrained IR101 model. The two most common "failures to reproduce" in the issues have nothing to do with the loss.
One is LFW at only about 66%, which several people ran into. It took until 2022 for someone to find the cause: when the config file does not specify a checkpoint path, the program raises no error and evaluates with randomly initialized weights. The other is IJB-B/IJB-C TAR@FAR=1e−4 at only about 87%; the asker in issue #24 (November 2020) found the cause themselves the next day, a different face alignment. After switching to InsightFace's alignment, a similarity transform from five landmarks onto a fixed template, the paper's numbers could be reproduced.
Limitations
The paper's conclusion names two directions itself: designing a better negative-class function , and studying noisy samples, since mislabeled faces also get optimized as hard samples. The latter reappeared later in AdaFace from a different angle. Some hard samples are faces so blurry nobody can tell who they are; up-weight them, and the model can only memorize cues such as the color of the clothes.
Beyond that, this curriculum is tied to two external things. is the mean positive cosine, so the smaller the backbone, the more slowly grows; and 's jumps follow the learning-rate schedule. Change the backbone or the schedule and the curriculum changes with them, and the paper's ablations do not cover these cases.
Conclusion
CurricularFace changes only the logits of hard negative classes, multiplying them by , and estimates with an EMA of the mean positive cosine. Training time goes up 2% and inference is unchanged. On MS1MV2 with ResNet100 it edges out ArcFace in every table, with relative error reductions of about a tenth on IJB-B and IJB-C; MobileFaceNet also converges at . Other teams that reran it with different backbones and data did not see a consistent lead.
To use it, take the official classification head as is, with the code's EMA of 0.01; for multi-GPU training use DistributedDataParallel, or change to an in-place update. Print during training: the paper's setup ends at 0.74, and smaller backbones such as ResNet18 come out lower (one report had only 0.4 in the first stage); if it stays at 0, DataParallel has most likely swallowed the update. When evaluating the official weights, switch to InsightFace's alignment first.
Two years later, this paper's co-author Xiaoming Liu, with Minchul Kim and Anil K. Jain, published AdaFace, arguing that some of the up-weighted hard samples are faces that can never be learned no matter what.