t-closeness is a privacy model for anonymized datasets that requires the distribution of a sensitive attribute within every equivalence class to stay within a distance t of that attribute’s distribution in the whole table. In privacy engineering, it is a refinement of k-anonymity and l-diversity designed to stop attackers from learning too much about an individual simply by locating the group of records that person belongs to.
The model was introduced in 2007 by Ninghui Li, Tiancheng Li and Suresh Venkatasubramanian. Its core idea is that a release is safe only if knowing someone’s group reveals little more than knowing the population as a whole, which limits attribute disclosure rather than only identity disclosure.
How the t-closeness requirement is defined
A table is first generalized or suppressed so that records sharing the same quasi-identifier values, such as age range, postal code prefix and gender, form equivalence classes. The model then compares two probability distributions for the sensitive attribute: the global distribution P across the full table and the local distribution Q inside each class.
The release satisfies the model when the distance D(P, Q) is less than or equal to t for every class. A smaller threshold means stronger protection, because each group must look more like the population. The original proposal measures distance with the Earth Mover’s Distance (EMD), which captures how much probability mass must move, and how far, to turn one distribution into the other.
The parameters involved in the definition are summarized below.
| Element | Meaning | Typical setting |
|---|---|---|
| Quasi-identifiers | Attributes linkable to external data | Age, postal code, gender, dates |
| Sensitive attribute | Value the attacker wants to learn | Diagnosis, salary, credit score |
| Equivalence class | Records indistinguishable on quasi-identifiers | Created by generalization |
| Distance measure | Gap between class and table distribution | Earth Mover’s Distance |
| Threshold t | Maximum allowed distance | Often 0.1 to 0.3 on a 0 to 1 scale |
Measuring distance between distributions
The choice of distance function decides what kind of leakage counts. For a categorical attribute without order, such as an unordered list of diseases, EMD with equal ground distance reduces to half the sum of absolute probability differences, which is the total variation distance. For numeric or ordered attributes, such as salary bands, EMD uses ordered distance, so a class concentrated at one end of the scale is penalized more than one spread across neighboring values.
Hierarchical attributes can use a generalization tree as the ground distance, so that grouping two related diagnoses costs less than grouping unrelated ones. Some later work replaced EMD with Kullback-Leibler divergence or other measures, but each choice changes the meaning of t, so thresholds are not comparable across measures.
| Attribute type | Ground distance | Effect on protection |
|---|---|---|
| Unordered categorical | Equal distance between values | Limits skew in value frequencies |
| Ordered numeric | Normalized rank difference | Prevents clustering at extremes |
| Hierarchical categorical | Distance in a taxonomy tree | Treats related values as closer |
Relationship to k-anonymity and l-diversity
The model forms the third step in a well-known progression of syntactic privacy models. k-anonymity hides each person among at least k records, but a class whose members all share one diagnosis still reveals that diagnosis, which is the homogeneity attack. l-diversity requires at least l well-represented sensitive values per class, yet it remains vulnerable to skewness attacks and similarity attacks.
In a skewness attack, a class that is 50 percent positive for a rare disease satisfies 2-diversity, but it raises an attacker’s belief sharply if the population rate is 1 percent. In a similarity attack, a class may contain diverse but semantically similar values, such as three different stomach conditions, which still disclose that the person has a stomach illness. Distribution closeness addresses both problems directly.
| Model | Guarantee | Main remaining weakness |
|---|---|---|
| k-anonymity | At least k records per class | Homogeneity and background knowledge |
| l-diversity | At least l distinct sensitive values | Skewness and similarity attacks |
| t-closeness | Class distribution close to global | High utility loss, no formal composition |
| Differential privacy | Bounded influence of any one record | Noise reduces accuracy |
Applying the model to a data release
Practitioners apply the model with anonymization tools that search a generalization lattice for the least distorting transformation satisfying all constraints. A typical workflow first classifies attributes, then sets k, l and t together, runs the search, and finally measures utility loss with metrics such as discernibility, information loss or the accuracy of downstream models.
Choosing t is a policy decision, not a purely technical one. The table below illustrates how different release contexts usually influence the setting.
| Release context | Suggested strictness | Reason |
|---|---|---|
| Public open data | Low t, around 0.1 | Unknown attackers with rich background data |
| Controlled research access | Moderate t, around 0.2 | Contracts and access controls add protection |
| Internal analytics | Higher t, around 0.3 | Trusted recipients, utility matters more |
| Highly skewed sensitive data | Combine with suppression | Rare values otherwise force heavy generalization |
Limitations and common mistakes
The strongest criticism concerns utility. Forcing every class to mirror the global distribution can require coarse generalization that erases correlations between quasi-identifiers and the sensitive attribute, which are often exactly what analysts want to study. The model also protects one sensitive attribute at a time; handling several sensitive columns together multiplies the constraints.
- Treating t as a universal constant. Its meaning depends on the distance measure and the attribute scale.
- Ignoring background knowledge. Attackers with auxiliary data may still infer values beyond the model’s assumptions.
- Assuming composition is safe. Several releases of the same population can be combined to re-identify people.
- Skipping risk assessment. Passing a syntactic test does not replace a documented re-identification risk analysis.
For these reasons, many teams now treat the model as one control within a broader de-identification strategy, often alongside differential privacy for aggregate statistics and strict access governance for record-level data.
The simple explanation
Imagine a hospital shares patient records after hiding names and blurring details such as exact age and address. People end up in small groups that look alike. If one group is made up mostly of cancer patients, anyone who knows a neighbor belongs to that group can guess the diagnosis.
This model prevents that guess. It requires every group to have roughly the same mix of diagnoses as the whole hospital. Finding someone’s group then tells you almost nothing new about that person. The trade-off is that the data becomes blurrier and less detailed for research.
How it is used in practice
A regional health authority plans to publish a dataset of 40,000 hospital discharges for academic researchers. The quasi-identifiers are age, sex, three-digit postal code and admission month, and the sensitive attribute is the primary diagnosis group. An initial 5-anonymous version passes review, yet the privacy team finds classes where over 60 percent of patients share a psychiatric diagnosis, compared with 8 percent overall.
The team applies a threshold of 0.15 using Earth Mover’s Distance over a diagnosis taxonomy. The anonymization tool widens age bands to ten years, merges admission months into quarters and suppresses about 2 percent of records with rare combinations. Every class now mirrors the regional diagnosis mix closely.
Researchers can still study seasonal admission trends and age patterns, while the authority documents a substantially reduced attribute disclosure risk in its release assessment.