Skip to main content

04 - AI Proctoring: What the AI Act and GDPR Require

Remote proctoring and EU law: what the AI Act and GDPR say, with executed code on signal persistence, calibration, false positives and pseudonyms.

What do you think about this article?

At a Glance

Remote proctoring and EU law: what the AI Act and GDPR say, with executed code on signal persistence, calibration, false positives and pseudonyms.

Supervising a remote exam without building a surveillance system

Anyone designing an online exam faces an uncomfortable question: how much can you observe a student to know they are answering alone, without the observation becoming more dangerous than the cheating? The answer this article defends is that the best system collects little, processes on the student's own device, produces flags rather than verdicts, and always puts a competent person between the flag and the consequence. Every code choice that follows translates one of these four criteria, and every criterion rests on European legal texts that I read in order to write it: the citations are in the sources, with the date of consultation.

An honest caveat first: this is not legal advice, and the rules change. Regulation (EU) 2024/1689, the AI Act, says in Article 113 that it applies in general from 2 August 2026, with Chapters I and II (including the prohibitions of Article 5) applying from 2 February 2025.

The application calendar of Regulation (EU) 2024/1689 (AI Act) was amended by Regulation (EU) 2026/1744 (OJ L, 24.7.2026, in force from 27.7.2026). As of today: prohibitions and Article 4 from 2 February 2025; general-purpose AI models, governance and penalties from 2 August 2025; general application and Article 50 from 2 August 2026; Annex III high-risk from 2 December 2027; Annex I high-risk from 2 August 2028. Dates read on EUR-Lex on 2026-11-13; check the consolidated version before setting a deadline. Before putting a system into production you must check the consolidated version and ask your data protection officer. For the rest of the series, the article on multi-tenant architecture explains where to keep data per customer, and the one on Video Streaming for Education explains how video arrives, if you choose to transmit it.

What the texts actually say: six verified points

The documentation circulating on this topic contains imprecise claims, so it is best to start from the texts. The table reports only what I read directly in the Italian edition of the regulation and of the GDPR (the sources are at the end), with the practical effect for whoever designs the system.

What the text saysWhereWhat changes for the designer
AI systems intended to monitor and detect prohibited behaviour of students during tests are high-riskAI Act, Annex III, point 3, letter dAI proctoring is high-risk because of its purpose, not because it "uses biometric data"
Inferring a person's emotions in educational institutions is prohibited, except for medical or safety reasonsAI Act, Article 5, paragraph 1, letter fNo "stress level" or "nervousness" among the signals, not even as a secondary indicator
Whoever uses the system assigns human oversight to people with competence, training and authorityAI Act, Article 26, paragraph 2; Article 14The reviewer must be able to change the outcome, and must be trained
Bodies governed by public law that use high-risk systems first assess the impact on fundamental rightsAI Act, Article 27A public university has this obligation on top of the data protection impact assessment
"Special categories" include biometric data for the purpose of uniquely identifying a personGDPR, Article 9, paragraph 1; Article 4, point 14Counting faces identifies nobody; facial recognition to verify who the student is does
Consent is not a valid ground when there is a clear imbalance between the data subject and the controller, especially if the controller is a public authorityGDPR, recital 43A university cannot rely only on "consent" for an exam that conditions the degree

Read line by line, the table corrects three common errors. The first: the biometric data of Article 9 is not every datum that concerns the face, but the data processed to uniquely identify a person, and so a system that counts how many faces are in the frame without recognising them sits in a different zone from one that compares the face with the photo on an ID document. The second: high risk comes from the purpose listed in Annex III, not from the technique. The third: consent does not save a system. Since the exam is a mandatory step of the study path, the legal basis has to be found elsewhere (for a university, typically a task carried out in the public interest) and consent, if you collect it, serves to inform more than to authorise. The GDPR fines for violating the basic principles, including those of Article 9, reach 20 million euros or 4% of total worldwide annual turnover if higher (Article 83, paragraph 5).

Processing on the device and keeping only the flags

The first design consequence is not to transmit the video. If face and gaze detection runs in the student's browser, the server receives only events such as "second person in frame from second 40 to 46". Google's MediaPipe project offers a model for this, the Face Landmarker, which according to its documentation tracks 478 three-dimensional points of the face and runs in the browser with WebAssembly. The indices of the points you need (eye corners, iris centre) must be taken from the documentation of the model you use, not from an article: they change between versions.

The second step is deciding what becomes an event. The listing works on synthetic observations (one every 100 milliseconds) and applies a simple rule: a condition is flagged only if it stays true continuously for a minimum time, 3 seconds for gaze outside the frame and 2 for a second person. This is what separates someone consulting notes from someone merely looking at the keyboard. The output is not a score, it is a list of intervals, and it is the format a reviewer can check against the video, if one exists, or against the audio or the context.

Python - Flag only persistent conditions, return intervals and not scores
from dataclasses import dataclass

FPS = 10                      # one observation every 100 ms (analysed frames, not webcam frames)

@dataclass(frozen=True)
class Intervallo:
    tipo: str
    inizio_s: float
    fine_s: float

def intervalli_persistenti(flags, tipo, durata_min_s):
    """Report only conditions that stay true CONTINUOUSLY for at least durata_min_s seconds."""
    risultato, inizio = [], None
    for i, vero in enumerate(list(flags) + [False]):      # the final False closes an open interval
        if vero and inizio is None:
            inizio = i
        elif not vero and inizio is not None:
            durata = (i - inizio) / FPS
            if durata >= durata_min_s:
                risultato.append(Intervallo(tipo, inizio / FPS, i / FPS))
            inizio = None
    return risultato

def sessione(secondi, sguardo_via, volti):
    n = secondi * FPS
    via = [any(a <= i / FPS < b for a, b in sguardo_via) for i in range(n)]
    piu_volti = [any(a <= i / FPS < b for a, b in volti) for i in range(n)]
    return via, piu_volti

casi = {
    "A: four 1 s glances at the keyboard": sessione(60, [(10, 11), (20, 21), (30, 31), (40, 41)], []),
    "B: gaze away for 5 s in a row":       sessione(60, [(25, 30)], []),
    "C: second person in frame for 6 s":   sessione(60, [], [(40, 46)]),
}
for nome, (via, piu_volti) in casi.items():
    trovati = intervalli_persistenti(via, "gaze_away", 3.0) + intervalli_persistenti(piu_volti, "multiple_faces", 2.0)
    print(nome)
    print("   ->", [f"{x.tipo} {x.inizio_s:.0f}-{x.fine_s:.0f}s" for x in trovati] or "no flags")

# Output:
# A: four 1 s glances at the keyboard
#    -> no flags
# B: gaze away for 5 s in a row
#    -> ['gaze_away 25-30s']
# C: second person in frame for 6 s
#    -> ['multiple_faces 40-46s']

The listing was run with Python 3 and the data are synthetic: they serve to show the rule, not to prove that it works on real students. In case A the student looks at the keyboard four times for one second, and the system flags nothing because no glance reaches 3 seconds. In case B the gaze stays away for five seconds in a row and an interval is born, from second 25 to 30. In C a second person stays in the frame for six seconds. The function intervalli_persistenti closes the still-open interval by appending a final False: without that line, a condition that is true until the end of the recording would be lost. The minimum durations are values chosen for the example and you must tune them with real trials, because the goal is not to flag behaviours that even someone who is not cheating adopts all the time.

Gaze: a number without a unit, and why it needs calibrating

To estimate where the student is looking, the raw signal is the position of the iris inside the eye: if it sits halfway between the two corners, the gaze is "at the centre". The listing computes this offset as a fraction, from -1 to +1. The point not to get wrong is that this is a ratio without a unit: multiplying it by 45 and calling it "degrees", as is often done, gives the impression of a measurement that does not exist, because converting it would require the distance from the camera and the shape of the eye. The remedy is calibration: at the start you ask the student to look at the centre of the screen, take the median of the offset and measure deviations relative to it.

TypeScript - Iris offset and calibration, with synthetic points
interface Punto { readonly x: number; readonly y: number }          // normalised coordinates 0..1
interface Occhio { readonly esterno: Punto; readonly interno: Punto; readonly iride: Punto }

// Horizontal position of the iris in the eye: 0 = centre, -1 / +1 = the two corners.
// A number WITHOUT a unit: these are not degrees, and multiplying by 45 does not make them so.
export function scostamentoIride(o: Occhio): number {
  const centro = (o.esterno.x + o.interno.x) / 2;
  const mezzaLarghezza = Math.abs(o.esterno.x - o.interno.x) / 2;
  return (o.iride.x - centro) / (mezzaLarghezza + 1e-9);
}

// Calibration: the median offset while the student looks at the centre of the screen.
export function mediana(v: readonly number[]): number {
  const s = [...v].sort((a, b) => a - b);
  const m = Math.floor(s.length / 2);
  return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
}

const occhio = (irideX: number): Occhio => ({
  esterno: { x: 0.40, y: 0.50 }, interno: { x: 0.50, y: 0.50 }, iride: { x: irideX, y: 0.50 },
});

console.log('iris at the centre     :', scostamentoIride(occhio(0.45)).toFixed(2));
console.log('iris toward the outside:', scostamentoIride(occhio(0.42)).toFixed(2));

// An off-centre webcam: looking at the screen centre the iris sits at 0.485, not 0.45.
const base = mediana([0.485, 0.487, 0.483, 0.485, 0.486].map((x) => scostamentoIride(occhio(x))));
const soglia = 0.5;
for (const x of [0.485, 0.45]) {
  const grezzo = scostamentoIride(occhio(x));
  console.log(`iris ${x}: raw ${grezzo.toFixed(2)} (${Math.abs(grezzo) > soglia ? 'out' : 'ok'}),`,
    `relative to calibration ${(grezzo - base).toFixed(2)} (${Math.abs(grezzo - base) > soglia ? 'out' : 'ok'})`);
}

// Output:
// iris at the centre     : 0.00
// iris toward the outside: -0.60
// iris 0.485: raw 0.70 (out), relative to calibration 0.00 (ok)
// iris 0.45: raw 0.00 (ok), relative to calibration -0.70 (out)

The listing runs with Node 24 and uses invented coordinates, because there is no webcam and no model: it demonstrates the arithmetic, not the detection. The first two lines check the definition: an iris halfway across is 0.00, shifted toward the outer corner it is -0.60. The last two show why calibration matters, in both directions. With an off-centre webcam, a student who looks at the centre of the screen has the iris at 0.485 and the raw value is 0.70, so without calibration they would be flagged as "out" (a false positive). Another who shifts their gaze toward the outside has a raw value of 0.00, "ok", while relative to the calibration they are at -0.70, that is, really out (a false negative). The threshold 0.5 is a value for the example. Your value depends on the camera, the lighting and the student's task: reading from a sheet beside the screen is a deviation just as much as copying is.

Why a person must decide: the arithmetic of false positives

The AI Act requires human oversight, but the concrete reason is arithmetic, and it is best seen with numbers. Suppose a system that flags 80% of those who cheat (sensitivity) and 5% of those who do not (false positives). It sounds good. The listing computes what happens over 1000 exams under two hypotheses about the percentage of cheaters, which we do not know: all the input numbers are assumptions, chosen to show the mechanism, not measurements of a real system.

Python - How many flags are right, given a low cheating rate
def segnalazioni(esami, prevalenza, sensibilita, falsi_positivi):
    """How many flags are right and how many are not. ALL the input numbers are assumptions."""
    scorretti = esami * prevalenza
    onesti = esami - scorretti
    veri = scorretti * sensibilita
    falsi = onesti * falsi_positivi
    return veri, falsi, veri / (veri + falsi)

for prev in (0.02, 0.005):
    v, f, quota = segnalazioni(esami=1000, prevalenza=prev, sensibilita=0.80, falsi_positivi=0.05)
    print(f"prevalence {prev:.1%}: out of 1000 exams {v:.0f} correct flags and {f:.0f} on honest students "
          f"-> {quota:.0%} of flags are correct")

# Output:
# prevalence 2.0%: out of 1000 exams 16 correct flags and 49 on honest students -> 25% of flags are correct
# prevalence 0.5%: out of 1000 exams 4 correct flags and 50 on honest students -> 7% of flags are correct

With 2% of cheaters, out of 1000 exams the system produces 16 correct flags and 49 on honest students: a reviewer who receives 65 flags will find one in four to be right. If cheaters are 0.5%, the correct ones drop to 7%. The mechanism is that the 5% error applies to a much larger mass (the honest) than the one the sensitivity applies to. The result is that a flag, on its own, is not proof and not even a strong clue, and that treating it as an automatic sanction hits mostly the innocent. So measure sensitivity and false positive rate on your own system, with real data and by group of students: without those two numbers you cannot know what a flag is worth.

That these errors are not evenly distributed is documented for facial analysis in general. Gender Shades measured, on three commercial gender classification systems, errors of up to 34.7% for darker-skinned women against a maximum of 0.8% for lighter-skinned men; the NIST report NISTIR 8280, on facial recognition, reports differences in false positives between demographic groups of 10 and more than 100 times. Neither measures face detection or gaze, and you cannot transfer their numbers: the message to take away is to measure your own system by group, not to trust an average accuracy percentage.

Pseudonyms that can truly be called that

To keep events separate from identity, the system uses a session identifier in place of the name or student ID. A frequent mistake is to compute that identifier as a hash of the student ID (sha256(matricola)) and call it "irreversible". It is in theory but not in practice, because the space of student IDs is small: whoever has the hash tries all possible IDs until they find the one that produces it. The solution is an HMAC with a secret key kept outside the database: the same student always produces the same pseudonym (needed to link the events of the session), but without the key the correspondence cannot be reconstructed.

Python - Plain hash versus keyed HMAC for a small space of student IDs
import hashlib, hmac, time

def hash_semplice(matricola: str) -> str:
    return hashlib.sha256(matricola.encode()).hexdigest()

def pseudonimo(matricola: str, chiave: bytes) -> str:
    return hmac.new(chiave, matricola.encode(), hashlib.sha256).hexdigest()

bersaglio = hash_semplice("482913")          # the hash that ends up, by mistake, in a log

t0 = time.perf_counter()
trovata = next(m for m in (f"{n:06d}" for n in range(1_000_000)) if hash_semplice(m) == bersaglio)
dt = time.perf_counter() - t0
print("plain hash of a 6-digit student ID -> recovered:", trovata,
      "by trying up to 1,000,000 values in under 5 s:", dt < 5)

chiave = b"long-secret-key-kept-outside-the-database"   # in production: from a secrets manager
p = pseudonimo("482913", chiave)
print("keyed HMAC: same student, same pseudonym:", p == pseudonimo("482913", chiave))
print("keyed HMAC: does the attack without the key find it?   ",
      any(pseudonimo(f"{n:06d}", b"another-key") == p for n in range(1_000_000)))

# Output:
# plain hash of a 6-digit student ID -> recovered: 482913 by trying up to 1,000,000 values in under 5 s: True
# keyed HMAC: same student, same pseudonym: True
# keyed HMAC: does the attack without the key find it?    False

The listing was run: the plain hash of a six-digit student ID is recovered by trying values up to one million in under 5 seconds (the exact time varies with the machine). With the HMAC, the same student has a stable pseudonym, and an attacker who tries all the IDs with the wrong key finds nothing. The key in the listing is written in the code only for the example: in production it sits in a secrets manager. A legal clarification: recital 26 of the GDPR says that pseudonymised data, attributable to a person with additional information, remain personal data. Pseudonymisation reduces the risk, it does not remove the obligations. How long to keep the events, finally, is a decision to document in the impact assessment, case by case: there is no number of days valid for everyone, and any figure you find around without a source should be treated as such.

Human review as a process, not a checkbox

Article 14 of the AI Act requires high-risk systems to be designed so that natural persons can effectively oversee them, and Article 26, paragraph 2, requires whoever uses them to assign that oversight to people with competence, training and authority. In practice this means three things. The reviewer sees the intervals and the context, not a score from 0 to 1 that invites trust. They can change the outcome without having to justify "contradicting the system". And every decision stays recorded with who made it and when, so that the student can contest it. A platform that sends a flag automatically into the student's file, with no person in between, also risks Article 22 of the GDPR, which recognises the right not to be subject to a decision based solely on automated processing when it produces significant effects.

The process also has a cost, and it must be declared before adoption: if out of 1000 exams the flags are 65, someone has to look at them, and if the staff is not there, the system is not usable. It is a good feasibility criterion: the number of reviewers you have decides how sensitive the system can be, not the other way round. The events, by the same minimisation principles, can go through the same event pipeline described in Learning Analytics with xAPI and Kafka, with the same care not to collect more than necessary.

What you can do now

You can say which parts of a proctoring system fall under the AI Act's high risk and why, what Article 5 prohibits in educational institutions, and when a face datum is really biometric data under the GDPR. You can write a persistence rule that reduces innocent flags, calibrate a gaze offset, compute with your own assumptions how many flags are right, and produce pseudonyms with an HMAC. To keep the work on the person, and not on the system, move on to the conversational tutor: Personalized Tutoring with LLMs and RAG.

Frequently asked questions

Is AI proctoring banned in Europe?

It is not banned outright. It is classified as high-risk when it serves to monitor prohibited behaviour of students during tests (Annex III, point 3, letter d, of the AI Act), with the obligations that follow. Inferring students' emotions, on the other hand, is prohibited, except for medical or safety reasons (Article 5, paragraph 1, letter f). Check the consolidated version for the application deadlines.

Does detecting a face on a webcam mean processing biometric data?

Not automatically. Article 9 of the GDPR concerns biometric data for the purpose of uniquely identifying a person. Counting how many faces are in the frame, without recognising them, is different from comparing the face with the photo on a document. Your data protection officer assesses the specific case.

Is the student's consent enough as a legal basis?

As a rule no, if the controller is a university and the exam conditions the degree: recital 43 of the GDPR says that consent is not a valid ground when there is a clear imbalance, especially with a public authority. The legal basis has to be found elsewhere and the privacy notice remains mandatory.

Sources

The four listings (Python 3 for segnali.py, baserate.py and pseudonimo.py, Node 24 for sguardo.ts) were run and the outputs are real, but the input data are synthetic and the false positive percentages in the listing are assumptions. No face or gaze detection was run on real images. The article is not legal advice: the texts were read in the EUR-Lex edition of 2026-11-12 and it was not checked whether later acts have changed the AI Act's application deadlines.

Commenti

Caricamento commenti...

Sign in to comment

New articles and tools on Telegram too

The Telegram channel flags the site's new articles and tools.

Did you like this article?

Explore other content on the blog or discover my projects