MagFace: A Universal Representation for Face Recognition and Quality Assessment
- Publication
- CVPR 2021Conference
- First submitted to arXiv
- arXiv:2103.06627
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{facerecognitionmagface2021,
title = {{MagFace: A Universal Representation for Face Recognition and Quality Assessment}},
author = {Qiang Meng and Shichao Zhao and Zhida Huang and Feng Zhou},
year = {2021},
eprint = {2103.06627},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2103.06627}
}
The camera at the door catches someone walking past, and three seconds leave ninety frames. A few are frontal faces, a few catch only half the face, a few are smeared into a blur by motion. Before anything goes into the recognition model, the system has to pick out the few frames best suited for matching.
This picking step is called face image quality assessment (FIQA). The usual approach is to prepare a separate quality model: some look at sharpness and brightness, some are trained on human-labeled scores, and SER-FIQ sends the same face through the recognition network a hundred times with dropout switched on and watches how much the feature wobbles.
The authors of this paper noticed that the recognition network already has a ready-made number in hand. Before computing logits, losses like ArcFace divide the 512-dimensional feature vector by its own length, keeping only the direction; once that length is computed, nobody pays it any more attention. MagFace wants to make this length meaningful: the easier a face is to recognize, the longer its feature.
The paper comes from the algorithm research team at Aibee; the authors are Qiang Meng, Shichao Zhao, Zhida Huang and Feng Zhou. The network architecture is not touched at all; only the loss changes, making the angular margin grow with the feature length and adding a regularizer that rewards length. The authors prove that, under a few conditions, each sample has exactly one length at which it ends up, and the closer it is to its own class center, the larger that length.
Defining the Problem
Picking a good face
What FIQA has to answer is "how useful is this image for face recognition," and it outputs a score. Images with low scores are more likely to cause matching errors, so they can be dropped up front, or given less weight when several images are fused.
The paper sorts existing methods into three kinds, each with its own trouble.
- Image quality metrics: BRISQUE, NIQE, PIQE and the like, which measure blur, noise and distortion. A perfectly crisp profile can score high on these metrics and still be of little use for recognition.
- Quality models trained on labels: FaceQnet and Best-Rowden's method first label training images with a quality score and then regress it. The problem is that "quality" has no clear definition, and people do not know which factors a recognition system actually cares about, so the labels are easily wrong.
- Uncertainty estimation: SER-FIQ runs many forward passes with dropout and looks at the variation of the features; PFE and DUL have each face output a Gaussian, with the mean as the feature and the variance as the uncertainty. These need no quality labels, but they either run many extra passes at inference or add a network branch; and the variance cannot be dropped straight into ordinary cosine matching.
What the authors want is for the recognition network itself to hand over quality along the way, with no change to the inference pipeline.
The length that normalization throws away
Start with the recognition side. The training data has faces and identities; the network's last layer outputs the feature of the -th face, and is its identity. The -th weight vector of the classification layer serves as the class center of class , is the angle between and , and . ArcFace's loss for each face is Eq. (1), and the overall loss averages it over the faces:
is the margin added to the correct class's angle; ArcFace uses 0.5 radians, about 28.6°. is the scale parameter, set to 64.
Only is left in the equation; features and weights are both normalized to unit length first. The feature's original length , which the paper calls the magnitude, has no effect on the loss whatsoever. The network can output whatever length it likes, and the loss does not care.
The authors see two problems with this.
First, photos of the same person at different quality levels have no rule for where they sit within the class. ArcFace uses the same for every photo; once the angle is inside the decision boundary, the loss no longer cares where in particular it stands. A high-quality frontal face may hug the boundary while a blurry profile sits close to the center. A messy intra-class structure hurts later clustering.
Second, hard samples and noisy samples find it hard to squeeze inside the boundary, so their loss stays large and so do their gradients. Training images blurred beyond recognition, or even labeled as the wrong person, get emphasized by the model over and over, and in the end it overfits.
So, can the loss make different demands of images of different quality, and write that difference into the magnitude?
Solving the Problem
The loss function
MagFace adds two magnitude-dependent functions to ArcFace: a margin that grows with the magnitude, and a regularizer . The per-sample loss is Eq. (2), written here with numerator and denominator split out:
is the correct class's logit after the margin is added, gathers the contributions of all the other classes, and sets how much weight the regularizer carries. With and , this is ArcFace.
The concrete forms of the two functions are in Appendix B.2. The margin is a straight line: as the magnitude goes from the lower limit to the upper limit , the margin increases linearly from to :
The regularizer is a hyperbola:
The paper uses and . The best set in the ablations is , and , and we use these numbers from here on. The slope is , so a feature of magnitude 20 gets 0.44 radians (25.2°), magnitude 35 gets 0.50 (28.6°, the same as ArcFace), and magnitude 50 gets 0.56 (32.1°).
is 0.101 at , 0.031 at and 0.018 at , decreasing all the way. Multiplied by , it goes from 3.53 down to 0.64. A loss that wants to shrink will want to push the magnitude up.
The two functions pull in opposite directions. As the magnitude grows, lowers the loss, but the margin grows too, more is deducted from the correct class's logit, and the classification term grows. The magnitude settles at the balance point of this tug-of-war.
What happens geometrically

This figure draws the feature space before normalization, so a point's distance from the origin is its magnitude.
(a) is ArcFace. Between the two class centers and , the two decision boundaries and are separated by a fixed . The three circles are three photos of the same class, 1 the clearest and 3 the worst. The pink feasible region constrains only the angle, so the three circles can sit anywhere inside it; as drawn, the best one, 1, happens to be farthest from the center.
(b) switches to MagFace, where the margin follows the magnitude. The largest magnitude, (red), gets the largest margin ; measured from , its decision boundary is the red , the one closest to . The smallest magnitude, (blue), gets , and its decision boundary is the blue , farthest from . The boundary labels run in the opposite order to the magnitude labels, so going by color is less confusing. Connect the angles each magnitude can occupy, and the feasible region becomes a triangle narrowing toward : the farther from the origin, the narrower the range of angles a sample can occupy.
(c) shows the two forces. With only , a low-quality sample does best by shrinking toward the origin: a small magnitude means a small margin, which makes it easier to stay inside the feasible region (the blue arrow). High-quality samples could still wander anywhere inside the triangle, so is added to push every sample outward (the purple arrow). Pushing outward runs into the triangle's slanted side, and the farther out the side goes, the closer it gets to .
(d) is how things look once the two forces balance. Sample 1 is pushed farthest out, with the largest magnitude and the smallest angle; sample 3 stays near the origin, with the largest angle. The whole class lines up into a cone, and magnitude now matches closeness to the center.
Where the magnitude settles
The figure is a sketch; now let us work it out. Fix one sample's angle and , treat purely as a function of the magnitude , and differentiate with respect to .
Start with the classification term. , and differentiating with respect to gives . is exactly , where is the softmax probability of the correct class after the margin is added. The derivative of with respect to is . The two minus signs cancel, and the whole derivative is:
The first term is greater than or equal to 0; it is the cost of the margin, and it wants the magnitude smaller. The second term, , is less than or equal to 0; it is the regularizer's reward, and it wants the magnitude larger. The optimal magnitude is where the two are equal in size.
This equation shows directly whose magnitude will be large. is how far the sample is from being classified correctly. For an easy sample that is already well classified, is close to 1 and the margin's cost is almost 0, so the regularizer can keep pushing the magnitude up until the margin grows and starts to fall. A hard sample has a small to begin with, so the margin's cost stays large; growing the magnitude costs it more than it gains, and it has to settle near the lower limit.
Appendix A of the paper states this as two properties.
A unique optimum. Look at the two ends of the interval first. At , , so the reward vanishes and only the positive cost remains; the derivative is greater than 0, and the magnitude will not want to exceed the upper limit. At , the cost is at most (, , , with the upper bound on the margin's slope), so as long as
the derivative is less than or equal to 0, and the magnitude will not want to go below the lower limit. Plugging in our numbers, and , so the lower bound is about 25.8; is enough. One end negative, the other positive, so there is at least one zero in between.
Then look at the second derivative. It has three terms. The regularizer's is always positive; the two terms that come out of the classification term are guaranteed non-negative only if and are both non-negative, that is, . When this condition holds, is strictly convex in and the zero is unique.
This angle condition does not hold for every sample. With around 0.5, it requires , that is, . The paper's Lemma 1 argues that it holds in most cases using "many classes, and the sample ranked among the top few"; MS1MV2 has 85,742 identities. Late in training, most samples really are within this range, while the hardest handful fall outside the theorem's protection.
Monotonicity. Fix the magnitude and move the sample closer to its own center ( smaller). gets smaller and larger, so the cost shrinks at every , the point where it equals the reward moves to the right, and grows. When the other classes are farther away ( smaller), grows and the conclusion is the same. So the optimal magnitude increases monotonically with "closer to your own center, farther from everyone else's." This is why MagFace dares to use the magnitude as quality.
Plugging in numbers
Abstract monotonicity is hard to get a feel for, so let us plug in numbers close to real training. MS1MV2 has 85,742 classes; suppose the nearest negative class center of this face has and the other 85,740 classes are all perpendicular to it (), so . Changing only the angle to its own class center and solving for the optimal magnitude:
| 25° | 0.906 | 73.0 | 0.65 | 0.98 |
| 30° | 0.866 | 55.0 | 0.58 | 0.96 |
| 35° | 0.819 | 37.5 | 0.51 | 0.90 |
| 40° | 0.766 | 21.8 | 0.45 | 0.70 |
| 45° | 0.707 | 12.7 | 0.41 | 0.10 |
Solved for this note from Eq. (2), Appendix B.2 and the hyperparameter values in Table 4 of the paper.
Every 5° increase in angle knocks the optimal magnitude down a notch. At 45°, is down to 0.10, the face is almost never classified correctly, and its magnitude is held down near the lower limit of 10. You can also look at the effect of : with the angle fixed at 30°, changing the nearest negative cosine from 0.3 and 0.4 to 0.5 lowers from 77.5 and 55.0 to 32.6.
Plot the two terms of the derivative above, and their crossings are the in the table:

The gray dashed line is the regularizer's reward, which depends only on the magnitude, so all three angles share it. The three solid lines are the margin's cost, all the same shape. At small magnitudes is close to 1 and the cost is too small to appear on the chart; as the magnitude grows, the margin widens, falls, and the cost climbs quickly to around . The smaller the angle, the later this curve climbs, and the farther right it crosses the dashed line.
Check it once with . At the margin is 0.51 radians, , , and the cost is ; the reward is . The two sides are equal.
The in the table spans a wide range because we moved only one angle of one sample. In real training the network changes angles and magnitudes at the same time, and the trained magnitudes usually cluster between 20 and 40 (see the numbers from the official logs later).
Does it really look like this after training?

All three models are ResNet50 trained on MS1MV2 for 20 epochs, with 512 samples taken from the last iteration. The horizontal axis is sample difficulty, easier to the right; Softmax uses the negative loss (the author explained in issue #4 that it is the value of the log softmax), and the other two use to the class center. The vertical axis is the magnitude.
In (a), Softmax, magnitude and difficulty show no relationship. In (b), ArcFace, the magnitudes of easy samples scatter from 1.0 to 1.9 with no pattern; more interesting is the dashed line on the left: hard samples' magnitudes have a lower bound that varies with difficulty. In (c), MagFace, the points line up from lower left to upper right; samples near 0.5 have magnitudes of 30 to 35, and those above 0.85 mostly 38 to 46.
What this figure supports is a relationship on the training set. Test images have no class center to compare with, so whether the magnitude works as quality depends on the experiments that follow.
The official implementation
The official repo's models/magface.py and run/trainer.py write the equations above in a dozen or so lines. The version below follows MagLinear, MagLoss and the training loop, keeps the variable names of the original files and merges a few lines; the comments were added for this note:
# x: backbone output before normalization (B, 512); weight: class centers (512, C)
x_norm = torch.norm(x, dim=1, keepdim=True).clamp(l_a, u_a) # a_i, gradient flows through it
ada_margin = (u_margin - l_margin) / (u_a - l_a) * (x_norm - l_a) + l_margin # m(a_i)
cos_m, sin_m = torch.cos(ada_margin), torch.sin(ada_margin)
cos_theta = torch.mm(F.normalize(x), F.normalize(weight, dim=0)).clamp(-1, 1)
sin_theta = torch.sqrt(1.0 - torch.pow(cos_theta, 2))
cos_theta_m = cos_theta * cos_m - sin_theta * sin_m # cos(theta + m(a_i))
cos_theta_m = torch.where(cos_theta > 0, cos_theta_m, cos_theta) # easy_margin=True
one_hot = torch.zeros_like(cos_theta).scatter_(1, target.view(-1, 1), 1.0)
output = scale * (one_hot * cos_theta_m + (1.0 - one_hot) * cos_theta)
loss_id = F.cross_entropy(output, target)
loss_g = torch.mean(1 / (u_a ** 2) * x_norm + 1 / x_norm) # g(a_i)
loss = loss_id + lambda_g * loss_g
A few details differ from the paper and need watching when you use it.
- The magnitude is clamped to with
clamp, and outside that range the gradient is 0. Within the range there is no stop-gradient: the gradients of both the margin and the regularizer flow back into the backbone and shape the magnitude directly. easy_marginis on by default, so samples with (angle over 90°) get no margin. This is a different matter from the the theorem needs; the hardest samples were outside the theorem's range to begin with.- The backbone ends in a fully connected layer followed by
BatchNorm1d(512), and the magnitude is the length of this BN output. run.shdefaults to , and , which differ from Table 4's best set . The training program prints the lower bound for at startup, which for this setting is 22.59.
Training setup
- Data: MS1MV2, 5.8M images of 85K identities, aligned to 112×112 the ArcFace way, with horizontal flipping only.
- Backbone: ResNet100 for the main results, ResNet50 for the ablations and Figure 3.
- Optimization: 8 1080Ti GPUs, SGD, learning rate 0.1, divided by 10 at epochs 10, 18 and 22, stopping at epoch 25; weight decay 5e-4, momentum 0.9.
- Loss: ; , ; are chosen so that the average margin on the training set equals ArcFace's 0.5.
- Baselines: Softmax, SV-AM-Softmax, SphereFace, CosFace and ArcFace, all retrained by the authors with the same backbone.
Discussion
Recognition: the easy benchmarks first
LFW, CFP-FP, AgeDB-30, CALFW and CPLFW are all 1:1 verification: given two faces, decide whether they are the same person, and report accuracy. LFW is 6,000 photo pairs split into 10 folds for cross-validation; CFP-FP is frontal against profile, AgeDB-30 is photos of the same person 30 years apart, and CALFW and CPLFW extend LFW with pairs deliberately chosen for large age and pose gaps.
| Method | LFW | CFP-FP | AgeDB | CALFW | CPLFW |
|---|---|---|---|---|---|
| Softmax | 99.70 | 98.20 | 97.72 | 95.65 | 92.02 |
| CosFace | 99.78 | 98.26 | 98.17 | 96.18 | 92.18 |
| ArcFace | 99.81 | 98.40 | 98.05 | 95.96 | 92.72 |
| MagFace | 99.83 | 98.46 | 98.17 | 96.15 | 92.87 |
Compiled from Table 1 of the paper (%), ResNet100, MS1MV2, all retrained by the authors.
These benchmarks are saturated. MagFace leads ArcFace by 0.02 to 0.19 percentage points; on CALFW, CosFace's 96.18 is even a bit higher than MagFace, and on AgeDB the two tie. The authors themselves wrote "performances are almost saturated."
Recognition: IJB-C and magnitude weighting
IJB-B and IJB-C are mixed-quality benchmarks with both high-quality photos and video stills. The unit of matching is the template, a set of photos and frames of the same person. IJB-C has about 3,500 people, 31,334 photos and 117,542 frames, and its 1:1 verification has about 19k same-person template pairs and 15M different-person pairs.
The metric is TAR@FAR: first set the threshold so that the share of different-person pairs wrongly judged to be the same person (FAR) equals a given value, then see what share of same-person pairs pass (TAR). On IJB-C, FAR=1e-4 allows about 1,500 different-person pairs through; 1e-6 allows only about 15, so this column is very sensitive to a handful of pairs.
A template first has to become a single feature. The usual approach normalizes each image's feature, sums them and normalizes once more, so every image counts equally. MagFace offers another option, which the authors call MagFace+:
Sum the unnormalized features directly, and each image's share is proportional to its magnitude. Put a clear photo of magnitude 35 and a blurry frame of magnitude 20 in the same template, and their weights are 64% and 36% instead of half and half.
| Method | 1e-6 | 1e-5 | 1e-4 |
|---|---|---|---|
| Softmax | 64.07 | 83.68 | 92.40 |
| CosFace | 87.96 | 92.68 | 95.56 |
| ArcFace | 85.65 | 92.69 | 95.74 |
| MagFace | 89.26 | 93.67 | 95.81 |
| MagFace+ | 90.24 | 94.08 | 95.97 |
Compiled from Table 2 of the paper; TAR of IJB-C 1:1 verification (%), with FAR as the columns.
The authors' retrained ArcFace matches the original paper, off by −0.11 on IJB-B and +0.14 on IJB-C at FAR=1e-4. MagFace's gains over ArcFace concentrate at strict thresholds: on IJB-C it adds 3.61 percentage points at 1e-6 and only 0.07 at 1e-4. Magnitude weighting adds a bit more, with MagFace+ gaining another 0.98 at 1e-6.
IJB-B shows the same trend; at 1e-4 it is ArcFace 94.09, MagFace 94.33 and MagFace+ 94.51. The one exception is IJB-B at 1e-6, where first place goes to Softmax at 46.73; the authors' explanation is that when very few false pairs are allowed, TAR is too sensitive to noise.
Quality: can the magnitude rank good from bad?
The quality experiments take the magnitude of the same MagFace model used for IJB above as the score.
First, the qualitative result. The authors took 100,000 faces from IJB-C, split them into eight groups by magnitude, and stacked each group's images into an average.

In the group with magnitudes below 24, the average does not even show facial features; the group at 36 and above has clear eyes and mouth corners. The authors' explanation is that high-quality faces tend to be more frontal, so after alignment they stack up well.
The paper also plots the magnitude distributions of each dataset. LFW mostly falls at high magnitudes; CFP-FP has two peaks, at about 28 and 34, corresponding to profile and frontal faces; IJB-C is the most spread out. Images around magnitude 15 hardly show a face, and between 20 and 40 the images gradually go from profiles, blur and occlusion to clear frontal faces. (Take this distribution plot's numbers with a grain of salt. In issue #27, someone measured LFW with the released model and got noticeably smaller magnitudes than the plot shows; the author replied that the plot came from "a very early model whose parameters are set empirically," while the paper's main text says the quality experiments all use the IJB model above.)
The quantitative evaluation uses error-versus-reject curves. Sort images by quality score from low to high, drop a certain fraction of the worst, and recompute the verification error on what remains. The error is FNMR, the share of same-person pairs judged to be different people; the threshold is fixed at FMR=0.001, meaning one in a thousand different-person pairs is wrongly judged to be the same person. The more accurate the quality score, the more the error should fall after dropping just a few images, so the faster a curve falls toward the lower right, the better.

Each row is a dataset; the verification features in the left column come from ArcFace and in the right column from MagFace, and the quality score is always MagFace's magnitude (or each baseline method's own score). The starting points at 0% are all the same; the difference is how fast the curves fall as they move right.
The LFW curves zigzag badly, because the starting FNMR is only 0.0033: fewer than ten errors among 3,000 same-person pairs, so removing one wrong pair is a whole step. CFP-FP and AgeDB-30 have more errors and much smoother curves. On CFP-FP with ArcFace features, MagFace drops 20% of the images and FNMR falls from 0.046 to 0.011; SER-FIQ is almost as fast, and between 5% and 10% even slightly lower. On AgeDB-30 with ArcFace features the two pull apart: after dropping 50%, MagFace is at about 0.011 and SER-FIQ at about 0.019; with MagFace's own features, the two lines nearly overlap from 40% on, and between 50% and 60% SER-FIQ is even slightly lower.
There are three things to read from this figure.
- The features in the left column come from a different model, and MagFace's magnitude still picks out which images will make ArcFace fail.
- The image quality metrics (the three dotted lines) are mostly worse than the face-specific methods, and sometimes dropping images actually increases the error; pose, occlusion, expression and the other factors that matter for recognition are beyond what they measure.
- DUL does fine on CFP-FP, but on AgeDB-30 it gets worse the more it drops; the authors speculate that its Gaussian assumption is too simplistic.
Cost is MagFace's biggest advantage. The magnitude is there the moment the feature is extracted, at the price of computing one vector length; SER-FIQ needs 100 dropout forward passes on the same face and then the pairwise distances among them.
This section has only curves, with no numbers such as the area under the curve that could be compared directly, and the comparison goes only as far as SER-FIQ.
Clustering
A tidy intra-class structure should help clustering. The authors compare ArcFace and MagFace on IJB-B's clustering protocol, with the same and average margin for both, using four clustering algorithms (K-means, AHC, DBSCAN and the graph-convolutional L-GCN) on the three largest subtasks (512, 1,024 and 1,845 people), and report BCubed F-score and NMI, both of which measure how well the clusters agree with the true identities. MagFace is higher in every combination, but not by much. K-means's F-score gains only 0.05 to 0.51 percentage points; the largest gap is L-GCN on the 1,845-person subtask, 80.35 versus 81.58. The authors also used the method of GCN-V to estimate each sample's "confidence of being a class center" from its neighborhood structure, which on IJB-B-1845 correlates positively with the magnitude.
How to distribute the margin: ablations
Appendix C fixes , and and tries four sets of , each keeping the average margin on the training set at 0.50 and changing only how spread out the margins are.
| Margin range | CFP-FP | 1e-6 | 1e-4 | |
|---|---|---|---|---|
| ArcFace | 0.50 | 97.32 | 83.88 | 95.00 |
| (0.45, 0.65) | 0.49–0.52 | 97.23 | 81.12 | 94.95 |
| (0.40, 0.80) | 0.46–0.53 | 97.47 | 85.82 | 95.12 |
| (0.35, 1.00) | 0.42–0.54 | 97.40 | 84.35 | 95.05 |
| (0.25, 1.60) | 0.35–0.61 | 97.30 | 81.64 | 94.91 |
Compiled from Table 4 of the paper, ResNet50; the last two columns are IJB-C TAR@FAR (%).
The overly concentrated is worse than ArcFace, which the authors attribute to the magnitude penalty dragging down recognition. The overly spread is also worse than ArcFace: hard samples get margins that are too small, which amounts to down-weighting them too much. The middle set, , is best on CFP-FP and on IJB-C from 1e-6 to 1e-4.
There is one more thing to read from this table. For the best set, the margins actually assigned on the training set range only from 0.46 to 0.53 radians, a spread of about 4°. MagFace's "adaptive margin" barely moves in real training; what it mainly changes is how the magnitudes are arranged.
Also, by the condition above, needs and needs 87.1, while the table uses 35 for both, so neither satisfies the paper's own condition and the guarantees of a unique optimum and monotonicity do not hold for them (this is computed from Eq. (9); the paper does not discuss it). Then again, , which also fails the condition, is second best in all three columns; and comes last only on IJB-C at 1e-4, with the overly concentrated set worst on CFP-FP and 1e-6. The numbers in the table cannot separate the effect of the unmet condition from the effect of spreading the margins too far.
Official code and reproduction
The official repo's README states plainly that the original code lives in the company's private codebase and will not be released: "This repo is an official but abridged version." The iResNet100 in the model table is marked "Trained by original codes."
The most common trap is preprocessing. The official inference code reads images with OpenCV (BGR) and only divides by 255, with no mean subtraction, so inputs fall in ; InsightFace-family models use . In issue #14 (June 2021), someone ran LFW with ArcFace's evaluation script and got 60.7% accuracy; with the preprocessing fixed it was 89.1%, which the author still called too low, asking them to extract features with the official script instead. Alignment matters a lot too: the asker in issue #23 aligned LFW themselves with MTCNN and got only 96.7%, and with InsightFace's preprocessed images it was 99.8%.
One report on reproducing the paper's numbers is fairly complete. In issue #28 (October 2021), someone retrained iResNet100 following run.sh and got 96.11 on IJB-C at 1e-4, higher than the paper's MagFace+ at 95.97; at 1e-6 they got only 87.54, against the paper's 90.24. The author replied that 1e-4 is the most widely accepted metric and 1e-6 is easily affected by noise, so this result counts as slightly better. (The paper's biggest gain over ArcFace happens to be the +3.61 at 1e-6.) The author also admitted that the released model, though trained with the same hyperparameters, was trained on the private code: "There are differences between the original implementation and the released version."
The magnitude values themselves are not stable either. In issue #42 (March 2022), someone's trained magnitudes spanned a narrower range than the official model's, and the author's answer was blunt: the magnitude is only comparable within your own model; it is a relative quantity. To spread it out, increase or raise . Another common case is taking an already trained ArcFace model and fine-tuning it with MagFace; issue #7 reported that the magnitude barely moves. The README later added a recipe: first measure where the existing model's magnitudes fall, then set outside that; starting from an ArcFace model with magnitudes around 1, the author used , , , and .
The earlier claim that real magnitudes mostly fall between 20 and 40 can be checked against the official logs posted in issue #12. The DP version of iResNet50 ends training with a mean magnitude of 22.36, a range of 12.71 to 30.96, and margins of 0.46 to 0.52; the DDP version's log, because of a bug that multiplied by 8, has the mean magnitude running up to 33.97 (the author says the released code is fixed).
If you want to bring MagFace into InsightFace's Partial FC to train on millions of classes, look at issue #20 (July 2021) first: the asker's magnitudes kept growing, the author asked them to check whether the magnitude's gradient was wired correctly, and the issue is still open today.
What came after
MagFace lets gradients flow through the magnitude and actively shapes the relationship between magnitude and recognizability. AdaFace, a year later, also uses the feature norm as quality but does the opposite: it stops the norm's gradient and uses it only as an indicator. Its analysis also points out that MagFace's loss has an incentive to lower the magnitude in exchange for a smaller margin, and that its gradient distribution is much like ArcFace's.
In the same year, Terhörst et al.'s QMagFace exploits the linear relationship between the quality learned by MagFace and the comparison score, folding quality directly into the comparison score, with the largest gains on cross-pose, cross-age and cross-quality benchmarks.
The weakness of magnitude-as-quality shows most clearly on cross-quality data. In CR-FIQA's comparison table (ArcFace features, FMR=1e-3), on XQLFW (pairs derived from LFW with the quality gap deliberately maximized), MagFace's area under the curve is 0.40 against CR-FIQA(L)'s 0.21; on LFW, where there are almost no errors left to fix, MagFace is the best in the whole table at 0.0016.
Another follow-up is in standards bodies. OFIQ (Open Source Face Image Quality), led by Germany's Federal Office for Information Security (BSI), is the reference implementation of the revised face image quality standard ISO/IEC 29794-5, and version 1.0.0 was released in November 2024. Its unified quality score uses a modified MagFace iResNet50, with the raw magnitude passed through a sigmoid centered at 23 to give a score from 0 to 100. BSI's slides at a NIST workshop in April 2025 state that, measured by "FNMR after removal of 5% lowest quality images," this score ranks first among 52 algorithms in NIST FATE Quality.
Conclusion
MagFace makes the margin grow linearly with the magnitude and rewards large magnitudes with a hyperbola, without changing a single line of the network architecture; the balance point of the two forces leaves easier-to-recognize samples at larger magnitudes. For recognition, the easy benchmarks are roughly flat, IJB-C's gains concentrate at strict thresholds like 1e-6, and magnitude-weighted templates add a bit more; for quality, the magnitude's error-versus-reject curves on CFP-FP and AgeDB-30 are mostly below those of SER-FIQ and the other methods, at almost no extra compute.
When using the official model, follow its preprocessing (BGR, divide by 255, no mean subtraction) and align with InsightFace's pipeline. The magnitude is a relative quantity, so quality thresholds have to be picked on your own model and your own data, and picked again for any new model; for scenarios with very large quality gaps, draw an error-versus-reject curve on your own data before deciding. If you train it yourself, take a look at that lower bound in the startup message.
The length that ArcFace divides away every time it is computed is now the quality score in an ISO standard's reference implementation.