Free · WaitlistJoin the waitlist for the free 2-day Vibecoding & AI Agents Intensive (autonomous Hermes + DeepSeek agent · led by Jemal Hamidun, Head of AI at Alpina Digital & MIPT)Join the waitlist →

Nemo Program Hides Names From Contracts Before They Reach an AI Model and Restores Them in the Correct Case

An accountant pastes a contract into ChatGPT, and the signatory's full name, tax ID and bank accounts go with it. Replacing names with "XXX" breaks the reply. The Nemo program swaps the data for tags such as [CHELOVEK_1|rd] (the "rd" suffix means the genitive case) and puts the real name back into the answer, in the right case: "powers of Belousov Arkadiy Gennadyevich". Everything is computed locally, and only the tagged text goes to the cloud, so a contract can be checked for risks without showing the model any identifying details.

AI-processed from Хабр: Машинное обучение; edited by Hamidun News
Nemo Program Hides Names From Contracts Before They Reach an AI Model and Restores Them in the Correct Case
Source: Хабр: Машинное обучение. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceХабр: Машинное обучение ↗
Editor-in-Chief
Key metric #1Tax IDs (INN), SNILS and OGRN are validated by checksum; bank cards by the Luhn algorithm
Key metric #2The name-recognition model runs without a GPU, and the whole program weighs about 140 MB
Key metric #3One person written in five different forms gets a single shared tag

Anyone who works with documents knows the scenario: an accountant or lawyer copies a contract into an AI chat and asks it to find risks. Along with the text, the cloud receives the signatory's full name (surname, first name and patronymic), the INN (a tax number for an organization or an individual), bank accounts, passport details and the director's phone number. Nobody is going to anonymize ten pages by hand. Simply replacing names with "XXX" doesn't help either: the model stops understanding who owes what to whom, and its answer loses its meaning.

The authors of the Nemo project (an open repository on GitHub) tackled this problem with a Windows program. It substitutes tags for personal data, sends only the tagged text to the model, and then restores the real values in the model's reply, in the correct grammatical case. The developers ran the program through Alice, ChatGPT and Qwen and described what broke along the way.

Tags That Remember Grammatical Case

The phrase "in the person of director Belousov Arkadiy Gennadyevich, INN 5915881392" becomes "in the person of director [CHELOVEK_1|rd], INN [INN_1]". The suffix "rd" stands for the genitive case. The model sees the person's role and the structure of the contract, but not the name itself. When the model replies "check the powers of [CHELOVEK_1|rd]", the program looks up the right full name in a local "tag → value" table, inflects it, and outputs "check the powers of Belousova Arkadiya Gennadyevicha" (the genitive form), rather than the nominative "Belousov Arkadiy Gennadyevich".

Recognition, the lookup table and inflection all run on the user's computer. Before sending, the user sees the entire tagged text and can edit it by hand.

Checksums Instead of "Looks Like a Number"

The first version searched for an INN as "10 or 12 digits in a row". Contracts are full of such numbers: order numbers, sums written without spaces, codes. So now any number that has a check digit is validated against it. For a legal entity's INN, this takes a few lines of Python: nine digits are multiplied by fixed weights, the sum is taken modulo 11, then modulo 10, and the result must match the last digit. The same approach validates individuals' INNs, SNILS, OGRN and OGRNIP. Bank card numbers are checked with the Luhn algorithm. KPP and BIK have no checksum, so they are found by context only: the number must follow the words "KPP" or "BIK".

Names, organizations and cities are found by an open NER model for Russian (it recognizes names and proper nouns in text). It needs no GPU and loads in a few seconds. The whole program, together with the model and dictionaries, takes up about 140 MB, so it can be installed on an ordinary office computer.

Conflicts and One Person in Five Guises

Sometimes detected fragments overlap, for example when a number sits inside a long string. Priorities are defined for such cases. Requisites (INN, accounts, cards, passport) outrank names. Among names, organizations and places, the longer fragment wins. According to the authors, they had to rework this scheme after running the program through the AI models.

The second problem is also typical for contracts. One person appears in the text as the full name in the genitive, as "Belousov A.G.", as "A.G. Belousov" and as the first name and patronymic in the dative. If each variant gets its own tag, the model will conclude that five different people are party to the deal and draw wrong conclusions. So a signature is built for each mention: surname and initials, plus the full first name and patronymic when available. If signatures match, it is the same person. All forms share the same tag number, and the form of the mention is recorded as a suffix.

What This Means in Practice

For companies that cannot send counterparties' details to external services, the approach is workable: the model analyzes the contract but never receives the data itself. Developers can take away two techniques. First, validate identifiers with checksums, not just regular expressions. Second, store grammatical information in the tag so that substituting the data back does not break the Russian language.

There are limitations too. Quality depends on the NER model: if it misses a rare surname or an organization name, that data goes to the cloud in plain text. That is why the step where the user reviews the tagged text before sending cannot be treated as a formality. The authors promise a separate write-up of what in Nemo still does not work, and that section is worth reading before putting the program into production workflows.

Story

Key Questions Answered

What are the key details on Tags That Remember Grammatical Case?

The phrase "in the person of director Belousov Arkadiy Gennadyevich, INN 5915881392" becomes "in the person of director [CHELOVEK_1|rd], INN [INN_1]". The suffix "rd" stands for the genitive case. The model sees the person's role and the structure of the contract, but not the name itself.

What are the key details on Checksums Instead of "Looks Like a Number"?

The first version searched for an INN as "10 or 12 digits in a row". Contracts are full of such numbers: order numbers, sums written without spaces, codes. So now any number that has a check digit is validated against it. For a legal entity's INN, this takes a few lines of Python: nine digits are multiplied by fixed weights, the sum is taken modulo 11, then modulo 10, and the result must match the last digit. The same approach validates individuals' INNs, SNILS, OGRN and OGRNIP.

What are the key details on Conflicts and One Person in Five Guises?

Sometimes detected fragments overlap, for example when a number sits inside a long string. Priorities are defined for such cases. Requisites (INN, accounts, cards, passport) outrank names. Among names, organizations and places, the longer fragment wins. According to the authors, they had to rework this scheme after running the program through the AI models. The second problem is also typical for contracts. One person appears in the text as the full name in the genitive, as "Belousov A.G.", as "A.G.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…