---
id: 17617
lang: en
title: "Chrome Extension Anonymizes a 20-Page Contract Before It Reaches ChatGPT in 1.7 Seconds"
published_at: "2026-10-27 20:02:16"
source_name: "Хабр: NLP"
source_url: "https://habr.com/ru/articles/1099118/?utm_campaign=1099118&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/17617"
categories: ["research", "ethics"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# Chrome Extension Anonymizes a 20-Page Contract Before It Reaches ChatGPT in 1.7 Seconds

> **Краткая суть (BLUF):** Contracts are increasingly being sent to ChatGPT with names and company details included, which creates a risk under Russia's personal data law 152-FZ. The author built an open-source Chrome extension that replaces personal data directly in the chat window and sends nothing over the network. Inside is a fine-tuned rubert-tiny2 model, 30 MB in size, which processes a 20-page contract in 1.7 seconds on a CPU. Before a document goes to a neural network, it is better to anonymize it locally.  • int8 quantization shrank the model from 111 MB to 30 MB • Token agreement with the original model rose from 98.1% to 99.7% • In a commercial offer, 46 of the 49 "organizations" it found were false positives

A hundred-page contract, a deadline that passed yesterday, and the document goes into a ChatGPT window with the request "find the catch in the liability section." Along with the text, the signatories' full names, tax IDs and company names go to a public service. That is personal data protected by Russia's 152-FZ law. A developer who had been in exactly this situation wrote an open-source Chrome extension. It intercepts the file on the chat page and replaces personal data before the message is sent. Everything runs on the user's computer: a 20-page contract is processed in roughly 1.7 seconds, and the neural network that finds names and organizations weighs 30 MB.

## Why the problem is not far-fetched

People do this far from rarely. According to foreign surveys, 38 to 57% of employees admit to entering confidential data into public neural networks, often through personal accounts the employer knows nothing about. Telemetry from the Solar group shows that in Russia in 2025, the volume of corporate data flowing into public neural networks grew 30-fold, and among it were legal documents.

The consequences can be serious. In summer 2026, a Moscow court of first instance upheld the dismissal of a sales director for disclosing commercial secrets; among other things, she had uploaded internal reports to DeepSeek. She was denied recovery of 5 million rubles under a "golden parachute" clause.

The author was not satisfied with the ready-made anonymizers. Some are cloud services themselves, so the document still ends up somewhere. Others can be installed locally, but only with a paid subscription. So he set his own solution with strict constraints: no network requests, no telemetry, no server, and open code for trust. The extension should take no more than 75 MB, and the model no more than 45 MB.

## Rules fell short, so he took a small model

The first version worked without a neural network. Parties to a contract were located using markers such as "in the person of" and "INN:" and a database of known counterparties. For contracts this was enough, but other documents caused problems. False positives, such as replacing "Alisa AI" as a name, are not dangerous, since the data goes nowhere. What is dangerous are misses, when personal data stays in the text.

For recognizing names, organizations and locations, he chose rubert-tiny2, a compact Russian BERT under the MIT license. In the browser it runs on WASM in a single thread. After int8 quantization, where each number is stored in one byte, the file takes 30 MB, and the cold start is about 0.3 seconds.

The first training attempt used WikiANN, 20,000 sentences each in Russian and English. Quality on organization recognition (F1, the balance of precision and recall) stalled at 71–74% against a required minimum of 75%. Tuning the learning rate, number of epochs and batch size did not help. He then applied distillation: first he trained a large "teacher," xlm-roberta-base (80.5%), and then trained the "student" rubert-tiny2 on both the correct labels and the teacher's probabilities. The result rose to 76%.

But WikiANN consists of Wikipedia headings, which contain no "LLC 'Rogi i Kopyta'" and no full names in oblique cases. On contracts the model scored only 23% on organizations. He added 10% template examples: legal-form abbreviations, three kinds of quotation marks, full names in four cases, "IP" before a name, and negative examples such as the word "Customer." The commercial offer still went badly: of 49 "organizations" found, 46 were false. The model took all-caps headings, abbreviations (EDO, MVP) and product names (Word, Excel) for companies.

## Quantization and the second attempt

The pipeline is: training, export to ONNX, int8 quantization, a check that predictions match the original model on at least 99% of tokens, and threshold calibration (0.7). Standard quantization gave 98.1% matches, because the embedding table was compressed with a single shared scale. Per-row quantization helped: each vector gets its own coefficient, so outliers in one row do not damage its neighbors. Agreement rose to 99.7%, and the size dropped from 111 MB to 30 MB, about 3.7 times smaller.

The second attempt was built on different data: WikiANN, 35% synthetic text across ten business genres (commercial offers, letters, invoices and UPD forms, reconciliation statements, résumés, correspondence) generated with Claude, and about 4,900 sentences from the factRuEval-2016 news corpus under MIT. Roughly a third of the synthetic text contains no entities at all: all-caps text, abbreviations, products and job titles are labeled as "not an entity." Names from the test corpus were removed from the synthetic data so as not to inflate the score.

## What remains open

The final metrics for the second attempt are not given in the original text, so it is too early to judge its success. The extension has not yet been published in the Web Store, and the author has postponed some datasets (Nerus, RuREBus, NEREL) because their licenses are unclear.

The practical takeaway for teams building local anonymization is that the bottleneck is data, not architecture. A model trained on encyclopedic text will not handle contracts and commercial offers until real business genres and examples of "non-entities" are added to the training set.

---
- **Первоисточник:** [Хабр: NLP](https://habr.com/ru/articles/1099118/?utm_campaign=1099118&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/17617
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
