De-identifying text at scale: How Airbnb protects personal data in AI training Airbnb has built a text de-identification system on top of Presidio, the open-source PII detection library originally developed by Microsoft and now under community governance, to strip personally identifiable information from messages, reviews, and support chats before that data trains its machine learning models. Airbnb's Privacy Architecture team sets the de-identification policy with Legal, Policy, and Engineering, and engineering implements it as code; Presidio runs in-process as a Python package so raw personal data is de-identified inside the calling pipeline rather than in a separate service, and it replaces PII with realistic simulated values that stay consistent within a run. The library ships as a reusable step in Airbnb's shared ML workflow orchestrator, with teams supplying only their data schema to mark which columns carry personal data. Here’s how Airbnb detects and replaces personal data in messages, reviews, and support chats before it reaches a model. By: Emelin Flores https://www.linkedin.com/in/emelinflores01/ , Alex Klimov https://www.linkedin.com/in/alexander-klimov-8521599/ , Lee Formyduval https://www.linkedin.com/in/wlformyd/ , Bahador Nooraei https://www.linkedin.com/in/bahadorn/ Introduction Airbnb is built on trust. Every night that a guest books a stay, or a host welcomes someone into their home, that trust is backed by information they’ve shared with us, which includes personally identifiable information PII such as names, home location, current location, and payment details. We now use transaction information to train machine learning models. Before we do so, we remove PII to minimize the number of copies of this information and prevent leakage into and through our models. As we’ve written before https://medium.com/airbnb-engineering/personal-data-classification-2d816d8ea516 , Airbnb maintains a shared taxonomy as to what constitutes PII, from commonly used fields such as names and card numbers to less frequently used fields such as precise location coordinates. We use de-identification to remove PII and replace it with simulated data that’s as realistic as possible to maximize its usefulness for ML model training. Decisions relating to user privacy start as policy. These policies are set and maintained by Airbnb’s Privacy Architecture team, with engagement from Legal, Policy, and Engineering. Engineering then implements policy decisions as code. This post focuses on text de-identification. We’ll describe the OSS library we chose to start with, the changes we made to create a functional system for Airbnb, and how we confirm that the system is working. 1. Choosing Presidio as the foundation Many organizations are concerned with protecting PII, so there’s a lot of existing best practice and tested code out there that we can use. We chose Presidio https://github.com/data-privacy-stack/presidio , an open-source https://presidio.dataprivacystack.org/ library originally developed by Microsoft and recently transitioned to community governance. We needed to meet demanding requirements: - On-premises hosting, to keep data on our infrastructure - General-purpose functionality and high degree of modularity, for maximum extensibility - Multilingual support, for our global user base - PII detection and obfuscation separate, but within a single framework, for manageability and consistency - Support for redaction, masking, and realistic replacement - Consistent fake values within a run ie, the same name repeatedly produces the same fake result Presidio meets these requirements well, especially regarding modularity. Functional elements such as PII recognizers, natural language processing NLP engines, and operators are all pluggable. We bypassed alternatives such as managed cloud services, since hosting is not on-premises, and standalone recognizers, known as named entity recognition NER models, since they only address part of the problem we needed to solve. 1.1 Deployment and distribution Presidio ships as a Python package https://pypi.org/project/presidio/ , and each consumer imports it in-process rather than calling a service we operate. Raw personal data is de-identified inside the calling process, so no separate service holds it and the data flow stays simple. It also removes a central bottleneck, since jobs run independently wherever compute is available. The decision is reversible: the same library wraps into a service if the need arises. The tradeoff is distribution. The library only protects data if every pipeline calls it, on the current version, with a compliant configuration. Models at Airbnb train through a shared machine learning ML workflow orchestrator, so the library ships as a reusable pipeline step. A team supplies only its data schema, marking which columns carry personal data; we own the recognizers, operators, language handling, and runtime environment. The resulting dataset is tagged as de-identified, and that tag follows the data into the model registry, where it is designed to gate deployment to production. Each run records the library version and configuration used, so registered models can be traced back to the datasets that produced them. 2. How it works Presidio runs text through two stages. The Analyzer finds spans that look like personal data, then labels each span with an entity type and a confidence score; the Anonymizer decides what replaces each span. Everything we build sits inside the Analyzer or the Anonymizer. 2.1 The Analyzer The Analyzer https://presidio.dataprivacystack.org/analyzer/ is a collection of recognizers for personal data, each responsible for one entity type, such as a name or a phone number. Recognizers differ in how they decide that a span of text is an entity of interest to this capability, and we use three kinds. For a pattern-based recognizer, detection quality depends on both a regex and a context-word list. For an NER-based one, it depends on the model behind it, so the model choices discussed later affect only some of our recognizers. Recognizers run independently, so two different recognizers can claim text strings that overlap, or in which one is nested within another. A LISTING ID matched inside an EMAIL ADDRESS is one common case. Overlaps pass through the Analyzer untouched and are resolved in the Anonymizer as a configurable step before any operator runs. Language detection is a prerequisite. Recognizers and models are language-specific, so it’s important that language detection be accurate. Names and addresses are short and carry few language cues, so we detect language on the whole record, or take it from the record’s locale metadata when it exists. If neither gives a confident answer, we use a more conservative configuration rather than taking the risk of using a model that might be for the wrong language. Pattern-based recognizers. We support Presidio’s standard entity types https://presidio.dataprivacystack.org/supported entities alongside Airbnb-specific ones such as LISTING ID and AIRBNB GIFT CARD, which no general-purpose model knows about. We defined Airbnb-specific recognizers as PatternRecognizers. For an identifier that’s just a run of digits, shape alone can’t settle the match. A gift card number, a credit card number valid against the widely used Luhn algorithm, and a listing ID all look the same. Presidio’s context words https://presidio.dataprivacystack.org/tutorial/06 context/?h=context example-adding-context-words-support-to-recognizers supply the deciding signal, so “listing” appearing a few tokens before a number raises the LISTING ID score above the other candidates. But stock context matching is single-token, so “gift card” declared as context never fires, and “card” alone fires just as readily next to a credit card. We extended the enhancer with a phrase pass, an ordered contiguous multi-word match in the tokens before a candidate, scored above a single-word hit, so the recognizer whose specific phrase appears wins the span. NER-based recognizers. Names and street addresses have no structural pattern, so detecting them depends on a model. Presidio’s default NLP engine https://presidio.dataprivacystack.org/analyzer/customizing nlp models/ is spaCy, which is fast, mature, cheap at scale, and requires no training from us. Its generic NER tags any location it sees, including cities, landmarks, and neighborhoods, while the detail that identifies a person is a street address with a house number. On our benchmark those broad tags never resolved to the full address span. We replaced spaCy for PERSON and LOCATION with recognizers built on GLiNER https://github.com/urchade/GLiNER , a zero-shot NER model that takes an entity description at inference time. That lets us ask specifically for a street address instead of any place name, and precision improved for both entity types. We evaluate newer backends the same way, and GLiNER2 https://github.com/fastino-ai/GLiNER2 is wired into the harness as a candidate. We adopt one for a given recognizer only when the benchmark shows a gain. Configurable detection. Score thresholds and entity scope https://presidio.dataprivacystack.org/analyzer/analyzer engine provider/ are set per recognizer and per consumer, because different consumers want different answers from the same text. A pipeline feeding raw text into training wants a low threshold and accepts false positives. On already-reviewed data, a consumer can trade recall for fewer unnecessary redactions. Consumers can also limit detection to the entity types present in their data. 2.2 The Anonymizer The Anonymizer operates on the Analyzer’s output, a set of detected entities whose overlaps are unresolved. Settling those is its first job, and how it settles them is configurable https://presidio.dataprivacystack.org/api/anonymizer python/ presidio anonymizer.ConflictResolutionStrategy . For each surviving span it then applies an operator, a transformation that decides what replaces the original value. Presidio’s default operators https://presidio.dataprivacystack.org/anonymizer/ built-in-operators leave a document full of placeholder tokens or blank gaps, and both tell a downstream model far less than realistic-looking text does. Most of our work on the Anonymizer went into closing that gap. Faker-based values. For most entity types we use the faker library https://faker.readthedocs.io/en/master/index.html to generate realistic fake values, so a real name becomes another plausible name rather than