> For the complete documentation index, see [llms.txt](https://docs.caf.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caf.io/caf-api/all-id/ai-facematch-documentation.md).

# Facematch AI Documentation

## 1. All.ID’s Facematch Artificial Intelligence Model

**Facematch** is a \*\*proprietary \*\*artificial intelligence model developed and trained by **Certta**. It serves as the **core engine** for All.ID’s decentralized biometric network, designed to verify identity through **anonymized facial similarity** analysis and a decentralized similarity voting network.

The model operates as a high-performance feature extractor that converts facial images into mathematical representations. Unlike traditional comparisons that rely on raw pixel data, Facematch utilizes deep learning to understand the unique features of a face, ensuring robust performance even under varying lighting conditions or image quality.

***

## 2. Keywords

To ensure clarity regarding the technical operation of the model, the following terminology is defined:

* **Subjects:** Unique individuals existing within the network datasets who have had their images captured multiple times for training and testing purposes.
* **Threshold (T):** A numerical limit used to probabilistically determine if two images belong to the same person. If the calculated distance between embeddings is lower than *T*, it is considered a match. This value is dynamic and adjustable to balance False Positives (FAR) and False Negatives (FRR).
* **FAR (False Acceptance Rate):** The probability that the system incorrectly identifies two different subjects as the same person.
* **FRR (False Rejection Rate):** The probability that the system incorrectly identifies two images of the same subject as different people.
* **Embedding:** A high-dimensional numerical **vector** (specifically, an array of **128** floating-point numbers in this architecture) that represents the abstract features of a face extracted by the **CNN**. After generation, the embedding is **obfuscated** using a **unique, private orthogonal rotation matrix** per peer on the network, then **multiplied by a universal seed**. It transforms visual data into mathematical coordinates where **similar faces are positioned closely** together in the **vector space**. Once the image is converted into this numerical array, the original facial image **cannot be reconstructed**, ensuring total anonymity and data privacy (GDPR/LGPD compliance).
* **Hash:** Within the context of the Facematch network, the term "Hash" is used interchangeably with **Vector Embedding**. Unlike standard cryptographic hashes that randomize data, this "biometric hash" functions as a unique, anonymized identifier that preserves structural similarity, allowing the system to calculate mathematical distances between identities without exposing the original image.

***

## 3. Technology Stack

Facematch utilizes a **Convolutional Neural Network (CNN)** architecture optimized for high-dimensional feature extraction, built on a **FaceNet128** backbone (128-dimensional embedding output).

* **Embeddings & Anonymization:** The model processes pre-processed selfie images (input) and outputs a **128-dimensional vector (embedding/hash)**. After the embedding is generated, it is **obfuscated** by applying a **unique, private orthogonal rotation matrix** for each peer on the network, and the result is then **multiplied by a universal seed**. Together, this pipeline acts as an irreversible "lossy compression." Once the image is converted into this numerical array, the original facial image cannot be reconstructed, ensuring total anonymity and data privacy (GDPR/LGPD compliance).
* **Decentralized Comparison:** These anonymized embeddings are the data transmitted across the biometric network.
* **Similarity Voting:** The network compares the incoming embedding against stored hashes. Based on the calculated distance (similarity) relative to the Threshold (*T*), the system triggers voting mechanisms to validate the identity.

***

## 4. Training Datasets

The Facematch model is trained on proprietary datasets constructed from Certta's production databases, supplemented by curated datasets designed to ensure strict demographic balancing. This approach guarantees that the data represents real-world production environments while effectively mitigating statistical bias through controlled distribution, rather than synthetic lab conditions.

* **Volume:** Approximately **1.5 million subjects**, with multiple images per subject.
* **Demographic Distribution:** The dataset is curated to minimize bias, reflecting a diverse population:
* **Gender:** 55.5% Male, 45.5% Female.
* **Ethnicity:** 35% Latino-Hispanic, 25% Caucasian, 25% African Descent, 13.5% Asian, 1.5% Indian.
* **Robustness:** Images undergo data augmentation (blur, lighting reflection, masks, noise) to ensure the model is resilient to low-quality cameras and environmental factors.
* **Training Methodology:** The network employs a triplet loss approach, learning to minimize the distance between two images of the same subject while maximizing the distance from a third image of a different subject.

***

## 5. Metrics

The following performance metrics refer to the **Facematch v0.46.4** model (best model’s Selfie-to-Selfie comparison).

| **FAR**        | **FRR**   |
| -------------- | --------- |
| 1 / 30.791     | 0,01 (1%) |
| 1 / 163,537    | 0,02 (2%) |
| 1 / 457,361    | 0,03 (3%) |
| 1 / 1,043,130  | 0,04 (4%) |
| 1 / 2.004.075  | 0,05 (5%) |
| 1 / 14.377.060 | 0,1 (10%) |

**Table 1: FAR vs. FRR Performance**

***

## 6. FAQ (Frequently Asked Questions)

### 1. How are matches and non-matches defined between a pair of images?

A **match** is declared when the mathematical distance between the embeddings generated by the Facematch model is smaller than a specific **Threshold (T)**. Conversely, if the distance exceeds *T*, it is a **non-match** (different individuals). The Threshold is dynamically optimized to achieve the lowest possible FAR for a maximum defined FRR. See the Table 1 in Metrics section.

### 2. Are there differences in metrics for 1:1 and 1:N comparisons?

The fundamental accuracy metrics (True Positives and False Negatives) do not change between 1:1 and 1:N approaches. However, the volume of comparisons differs significantly:

* **1:1 (Verification):** Compares one subject against one specific claimed identity. The number of negative comparisons equals the number of subjects.
* **1:N (Identification):** Compares one subject against the entire database. The number of negative comparisons approximates the square of the number of subjects. Consequently, while accuracy remains stable, the absolute count of False Positives may increase exponentially due to the sheer volume of comparisons in large datasets.

### 3. What is the total response time for a Facematch model inference?

* **Anonymization (AI processing):** \~600ms – 900ms.
* **Face found in network:** \~1.5 seconds total. **Comparisson:**
* **Face checked externally (Serpro):** \~3.2 seconds total.

### 4. How does data anonymization work?

Data anonymization in Facematch is achieved through a process of **feature extraction** and **vectorization**, effectively transforming biometric traits into a mathematical abstraction. The process follows a strict pipeline:

1. **Input**: The raw selfie image is pre-processed (cropped and aligned).
2. **Inference**: The image is passed through our Deep Convolutional Neural Network (DCNN), proprietary architecture and hyperparameters used.
3. **Output**: Instead of classifying the image, the network outputs the values from the final fully connected layer, resulting in a **128-dimensional vector** (also known as an **embedding** or sometimes refered to as “**hash**” internally).
4. **Obfuscation**: After the embedding is generated, it is obfuscated using a **unique, private orthogonal rotation matrix** per peer on the network, then **multiplied by a universal seed**.

The system uses a CNN to transform a 2D image (face) into a 1D embedding. Through layers of **convolution** (applying matrix filters) and **pooling** (Max or Average pooling to reduce dimensions), the image is compressed into a vector. This process is mathematically **irreversible**; the **embedding cannot be used to reconstruct the original photograph**, making it ideal for securing sensitive biometric data.

Because each peer uses its own private rotation matrix, an anonymized embedding is only directly comparable within that same peer. For cross-peer comparisons in distributed deployments, the network re-rotates the embedding into the target peer's rotation space before comparison — see [Architecture Overview](/caf-api/all-id/architecture-overview.md) for the full data flow and the Router's role in this process.

### 5. How does a new client join as a node in the network?

This is an invite-only process for clients with databases exceeding 20 million faces.

1. **Integration:** Integrate via the official API.
2. **Hosting:** Choose between On-premise or Cloud hosting.
3. **Hash Creation:** Convert the image database into anonymized embeddings (or hashes).
4. **Hygienization:** The new embeddings (or hashes) are cross-referenced within the network to remove potential False Positives. If not found, external bureaus are used for validation.
5. **Go Live:** The node becomes active.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.caf.io/caf-api/all-id/ai-facematch-documentation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
