arXiv:2610.34012cs.CLOct 2026

Manuscript Offprint

arXiv:2610.34012

Reversible Pseudonymisation of Documents Sent to External LLMs: an Open Bilingual Benchmark and an Engine

Vladimir Beskorovainyi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Professionals send working documents to external large language models. A common safeguard is reversible pseudonymisation: personal data are replaced with placeholders before the request and restored locally in the answer. We present an open benchmark of five existing open tools and a regular-expression baseline on Russian and UK English, and an open engine built on the two strongest tools. The benchmark excludes each tool's own authors' dataset from its verdict, compares the engine with each tool on identical datasets for detection, reports masking precision, and tests on a held-out set of synthetic documents whose files, hashes, decision rules, run plan and stopping rule were published before any run. Two local LLMs test whether placeholders survive. All evaluation data are synthetic, and the benchmark was run by the author of the engine; code, data, predictions and raw answers are released. On external datasets no existing tool meets all predefined thresholds: in UK English the identifier and leak thresholds are not met, in Russian the identifier threshold is borderline. On the last held-out set of 1,000 documents per language, the best existing tools leave a whole value visible in 61% (Russian) and 58% (UK) of documents. On these documents, from the generator it was developed on, the engine does so in 0.3% [0.1; 0.9] and 0.2% [0.1; 0.7], leaves any part of a value visible in 0.8% and 0.2%, and meets all detection thresholds in both languages. In UK English it also restores at least 99% of its placeholders after 760 answers. In Russian it restores only 94.6% [93.6; 95.6] of name placeholders, against a 99% threshold, mainly because the inflection it borrows from pii-guard produces wrong surname forms. The engine was developed over six earlier held-out sets from the same generator; real documents were not tested.

1 Introduction

Professionals such as lawyers, clinicians and HR staff may paste client and patient documents into general-purpose LLM services. Reversible pseudonymisation is a practical safeguard: the document is sent with placeholders instead of personal data, the mapping stays on the user's machine, and the original values are restored locally in the answer. If detection is complete, the external service sees placeholders instead of the literal values, although quasi-identifiers may remain. The safeguard is only as good as its recall, because a single missed name or identifier defeats it, and it is only usable if the placeholders survive the model's answer.

Several open tools implement detection and, in some cases, reversible replacement. They are usually evaluated on short messages or sentences, often on datasets released by their own authors. Our question was narrower and practical: how reliable are these tools on documents in Russian and UK English, and do their placeholders survive a round trip through an LLM?

The contributions are:

  • A benchmark protocol with a no home dataset rule, comparisons on identical data, held-out sets of synthetic documents run once per tool, the last three of them published with their

hashes, decision rules and run plans before any run and the last with a stopping rule, a leak metric that matches numbers across separators and Russian surnames in all grammatical cases, masking precision, document-level cluster bootstrap intervals, and a round-trip metric that scores each tool-issued placeholder occurrence once and counts model-invented placeholders separately (Section 3).

• Measurements of five existing open tools and a baseline on external datasets and on 1,000 held-out documents per language, with leaks broken down by noise, hard formats, entity type and the types each tool supports (Section 4).

  • Round-trip measurements for every reversible configuration in both languages, with two system prompts for each placeholder format and a strict and a tolerant parser for pii-guard's tags, on held-out sets 4 and 5, and for the engine with 380 answers per model on sets 5 to 7, the last with a separate threshold for name placeholders (Section 4.3).

• An open engine, pii-roundtrip, built on the two strongest tools, and an account of the errors that reviews and our own checks found in earlier versions of this work (Sections 5 and C).

The author built the engine and ran the benchmark. To make that checkable, the decision rule is applied to every tool alike, unfavourable results of the engine are reported next to favourable ones, the last three held-out tests were registered publicly before they were run, the last with a rule that its result is published whatever it is, and the code, the held-out sets, the per-document predictions and the raw LLM answers are released.

References (19)