cd /news/ai-policy/eu-ai-act-article-50-2-for-llm-text-… · home › topics › ai-policy › article
[ARTICLE · art-175465] src=dev.to ↗ pub= topic=ai-policy verified=true sentiment=· neutral

EU AI Act Article 50(2) for LLM text: marking and detecting AI-generated text before 2 December

A developer published a layered compliance design for EU AI Act Article 50(2), which requires providers of AI systems generating synthetic text to mark outputs in a machine-readable, detectable format. The approach combines signed provenance blocks and headers in API responses, metadata in exported documents, a detection endpoint, and an evidence log, since copy-paste strips metadata, edits break hashes, and paraphrasing weakens statistical watermarks. The post notes Article 50 has applied since 2 August 2026, with pre-existing systems given until 2 December 2026 under Article 111(4) of the Digital Omnibus on AI.

by read6 min views1 publishedNov 24, 2026

If your product returns LLM-generated text to people in the EU (chat answers, drafted emails, summaries, generated reports), Article 50(2) of the EU AI Act asks you, the provider, to make that text machine-readably marked and detectable. Our October post covered images with C2PA. Text is harder, because plain text has nowhere to hide a manifest.

This post covers what the law and the Commission's guidelines actually say about text, then a layered design you can ship this week: provenance in API responses, metadata in exported documents, a detection endpoint, and an evidence log. It's readiness support for developers, not legal advice, and it was AI-assisted and then edited.

From the AI Act Service Desk's consolidated text of Article 50 (Regulation (EU) 2024/1689 on EUR-Lex):

"Providers of AI systems, including general-purpose AI systems, generating synthetic audio, image, video or text content, shall ensure that the outputs of the AI system are marked in a machine-readable format and detectable as artificially generated or manipulated. Providers shall ensure their technical solutions are effective, interoperable, robust and reliable as far as this is technically feasible, taking into account the specificities and limitations of various types of content, the costs of implementation and the generally acknowledged state of the art, as may be reflected in relevant technical standards."

And the exceptions:

"This obligation shall not apply to the extent the AI systems perform an assistive function for standard editing or do not substantially alter the input data provided by the deployer or the semantics thereof, or where authorised by law to detect, prevent, investigate or prosecute criminal offences."

The Commission Guidelines on Article 50 (C(2026) 5054 final, 20 July 2026, non-binding) are where the developer-relevant detail lives:

Article 50(2) is the provider's machine-readable mark. Article 50(4) is a separate deployer duty: a visible label on AI text "published with the purpose of informing the public on matters of public interest", unless it went through human review or editorial control. We covered 50(4) here. Your marking doesn't satisfy your customers' labeling duty, and vice versa.

Article 50 has applied since 2 August 2026. For systems placed on the market before that date, the Digital Omnibus on AI (Regulation (EU) 2026/1744) added Article 111(4): those providers "shall take the necessary steps in order to comply with Article 50(2) by 2 December 2026." The Commission FAQ confirms this is the only grace period. That's eight days from today.

The voluntary Code of Practice on Transparency of AI-generated Content, published 10 June 2026, has a Section 1 for providers on marking and detection, and the Commission and AI Board have confirmed it as an adequate tool to demonstrate compliance. If you don't sign it, you must show your own measures are adequate.

No single technique survives everything. Copy-paste strips metadata, any edit breaks a hash, and paraphrasing weakens statistical watermarks. So layer them.

This Express middleware (TypeScript) adds a signed provenance block and headers to any response with output_text, logs it, and exposes a detection function:

// provenance.ts
import { createHash, generateKeyPairSync, sign, verify, randomUUID } from "node:crypto";
import { appendFileSync } from "node:fs";
import type { Request, Response, NextFunction } from "express";

// In production, load the key from your KMS/secret store instead.
const { privateKey, publicKey } = generateKeyPairSync("ed25519");

export interface Provenance {
  id: string; ai_generated: true; generator: string; model: string;
  created_at: string; sha256: string; sig: string; verify_url: string;
}

const sha256 = (s: string) => createHash("sha256").update(s.normalize("NFC")).digest("hex");
const index = new Map<string, Provenance>(); // use a real table in production

export function makeProvenance(text: string, model: string): Provenance {
  const id = `prv_${randomUUID()}`;
  const core = { id, ai_generated: true as const, generator: "acme-writer/3.2.0",
                 model, created_at: new Date().toISOString(), sha256: sha256(text) };
  const sig = sign(null, Buffer.from(JSON.stringify(core)), privateKey).toString("base64url");
  const p = { ...core, sig, verify_url: `https://acme.example/verify/${id}` };
  index.set(p.sha256, p);
  appendFileSync("evidence/art50-2.jsonl", JSON.stringify({
    ts: p.created_at, event: "marked", id, model, sha256: p.sha256,
    channels: ["json", "header"] }) + "\n");
  return p;
}

export function markAiText(model: string) {
  return (_req: Request, res: Response, next: NextFunction) => {
    const json = res.json.bind(res);
    res.json = (body: any) => {
      if (typeof body?.output_text === "string") {
        const p = makeProvenance(body.output_text, model);
        res.setHeader("X-AI-Generated", "true");
        res.setHeader("X-AI-Provenance-Id", p.id);
        body = { ...body, provenance: p };
      }
      return json(body);
    };
    next();
  };
}

// Detection with a human-readable answer.
export function detect(text: string) {
  const p = index.get(sha256(text));
  if (!p) return { result: "no_match",
    message: "No exact match. The text may be human-written, edited, or from another system." };
  const { sig, verify_url, ...core } = p;
  const ok = verify(null, Buffer.from(JSON.stringify(core)), publicKey, Buffer.from(sig, "base64url"));
  return ok
    ? { result: "ai_generated", message: `Generated by ${p.generator} (${p.model}) on ${p.created_at}.` }
    : { result: "invalid_signature", message: "A record exists but its signature does not verify." };
}
// server.ts
app.post("/v1/generate", markAiText("example-llm-2026-09"), async (req, res) => {
  res.json({ output_text: await callLlm(req.body.prompt) });
});
app.post("/verify", (req, res) => res.json(detect(String(req.body.text ?? ""))));

X-AI-Generated is a convention we made up, not a standard. There's no registered header for this yet, so document it in your API reference. Store hashes, not the text, in the lookup table if outputs contain personal data.

If users download a .docx or PDF, put the mark in the file:

import json
from docx import Document          # python-docx
from pypdf import PdfReader, PdfWriter

PROV = {"ai_generated": True, "generator": "acme-writer/3.2.0",
        "provenance_id": "prv_01J9Z6", "verify": "https://acme.example/verify/prv_01J9Z6"}

def mark_docx(src, dst):
    doc = Document(src)
    doc.core_properties.keywords = "AI-generated"
    doc.core_properties.comments = json.dumps(PROV)
    doc.save(dst)

def mark_pdf(src, dst):
    writer = PdfWriter(clone_from=PdfReader(src))
    writer.add_metadata({"/Keywords": "AI-generated", "/AIProvenance": json.dumps(PROV)})
    with open(dst, "wb") as f:
        writer.write(f)

For signed, interoperable provenance on PDFs and media, look at C2PA. For plain chat text, metadata only lives as long as the container does.

If you run the model yourself, a token-level watermark survives copy-paste. Hugging Face Transformers ships a green-list WatermarkingConfig with a WatermarkDetector, plus SynthID Text support (docs):

from transformers import WatermarkingConfig, WatermarkDetector

cfg = WatermarkingConfig(bias=2.5, context_width=2, seeding_scheme="selfhash")
out = model.generate(input_ids, watermarking_config=cfg, max_length=200)
detector = WatermarkDetector(model_config=model.config, device="cpu", watermarking_config=cfg)
print(detector(out))  # array([ True]) when the watermark is detected

Be honest about the limits. Detection needs enough tokens, so short replies are weak. Paraphrasing or translation degrades it. The docs warn that a high bias can hurt output quality, and say to replace the default hashing key with a private one. If you call a hosted model API, you usually can't add this yourself, so ask your model provider what marking they apply. The guidelines (para. 74) allow you to rely on an upstream solution, but the responsibility to demonstrate compliance stays with you.

Every marked output adds a line to evidence/art50-2.jsonl:

{"ts":"2026-11-24T14:39:17.498Z","event":"marked","id":"prv_1e86...","model":"example-llm-2026-09","sha256":"5c12...21af","channels":["json","header"]}
{"ts":"2026-11-24T14:41:02.113Z","event":"exempt","route":"/v1/autocomplete","reason":"short sequence (guidelines para. 68)"}

Log your exemptions too. "We didn't mark autocomplete because outputs are single words" is a defensible, dated decision. Silence isn't.

/verify. Not sure which Article 50 paragraphs apply to your product? RuleReddy has a free Article 50 check at rulereddy.com.

Not legal advice. This is general technical guidance based on the official texts linked above. Talk to counsel about your specific product.

── more in #ai-policy 4 stories · sorted by recency
── more on @european commission 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/eu-ai-act-article-50…] indexed:0 read:6min 2026-11-24 · —