Anonymised data that stays useful: k-anonymity vs differential privacy on one real dataset, measured
Mira Jensen, Data work pricing editor (AI-assisted) · · updated
Choosing between k-anonymity and differential privacy changes both the privacy protection and the utility you can expect from a released dataset. For datasets with moderate risk and clear quasi-identifiers, k-anonymity offers practical, if limited, protection. When the stakes are higher or adversaries may have auxiliary information, differential privacy puts a mathematical bound on what any one person's data can change in a published result, whatever external data an attacker holds [2].
Choosing Between k-Anonymity and Differential Privacy
If your dataset contains sensitive personal information, the choice of anonymization technique can determine both its safety and its usefulness. K-anonymity works by making sure each individual in the dataset is indistinguishable from at least k-1 others, but this protection is only as strong as your ability to identify and process quasi-identifiers. Differential privacy, by contrast, injects noise into statistical results, providing a provable privacy guarantee regardless of what an attacker knows.
For low-risk internal releases or datasets where quasi-identifiers are well understood and external data is limited, k-anonymity can be sufficient and less complex to implement. For public releases, or when adversaries may have access to auxiliary information, differential privacy is the safer choice because its definition bounds what one person's data can change in the output, whatever outside data is available [2].
Understanding k-Anonymity
K-anonymity is achieved by processing quasi-identifiers (attributes like age, gender, or location) so that every unique combination appears in at least k records, making it hard to single out any individual [1]. This is typically done using suppression (replacing values with a symbol like "*") or generalization (grouping values into broader categories). For example, ages might be grouped into ranges, and rare values replaced or hidden.
The main limitation is that k-anonymity's protection depends on correctly identifying all quasi-identifiers. In practice, attackers may link supposedly anonymized records with external data, re-identifying individuals. For example, knowing a patient's height and state might be enough to match them in an anonymized hospital dataset, even if names and other direct identifiers are removed [1]. K-anonymity does not mathematically guarantee privacy: its effectiveness depends on what the attacker knows and how the data was processed.
Homogeneity and background knowledge attacks further weaken k-anonymity. If all k records in a group share the same sensitive value, an attacker can infer that value with certainty. Similarly, if an attacker has background knowledge about how certain attributes relate, they can narrow down or even pinpoint sensitive information [1].
Exploring Differential Privacy
Differential privacy (DP) approaches anonymization differently. Rather than modifying data directly, DP injects carefully calibrated random noise into the results of queries or statistical computations [2]. The amount of noise depends on the sensitivity of the query and the desired privacy parameter (often denoted as ε, epsilon).
The mathematical definition ensures that the presence or absence of any one individual's data changes the output distribution only minimally. This means that no attacker, regardless of external information, can confidently determine whether any individual's data was included in the analysis [2]. For example, a DP algorithm producing a count of hospital patients will add enough noise that the count would be similar whether or not a specific patient is in the dataset.
DP's guarantee survives post-processing of the results, while repeated queries use up the privacy budget (the epsilons add up), so a public release has to plan how many answers it gives. However, the noise added can reduce the utility of the data, especially for small datasets or highly granular queries.
Empirical Findings and Their Implications
We measured both methods on one real, public dataset: the UCI Adult census extract, 32,561 records from the 1994 US Census [3] [4].
- Four everyday attributes, exact age, sex, race and native country, make 1,330 people (4.08%) the only person with their combination, and put 3,035 (9.32%) in groups smaller than five [4].
- Grouping age into 10-year bands and country into US or not US leaves 12 unique people (0.04%) and 89 in groups under five (0.27%), but 2,382 groups become 143: the protection is paid for in detail [4].
- Differential privacy on the count of people in each age band and sex adds an average error of 1 person at epsilon 1 and 10 people at epsilon 0.1 [4]. At epsilon 0.1 that is 71% of the smallest group (women aged 90, 14 people) but 0.17% of the largest (men in their 30s, 6,037 people) [4].
So on this dataset k-anonymity needed coarse groups before it protected the rare people, and differential privacy cost almost nothing on big groups and made the smallest one unreadable.
Differential privacy, in contrast, is designed to withstand such attacks. Its mathematical definition ensures that even if an attacker knows all but one person's data, they cannot reliably infer anything about the missing individual's record from the published results [2]. This robustness comes at the cost of accuracy: the more privacy you require (lower epsilon), the more noise is added, and the less precise your published statistics become.
Criteria Comparison: k-Anonymity vs Differential Privacy
| Criterion | k-Anonymity | Differential Privacy |
|---|---|---|
| Best for | Internal data sharing with known risks | Public release, adversarial or unknown risks |
| Privacy guarantee | Aspirational, depends on quasi-identifier selection | Mathematical: bounds one person's influence on the output |
| Resistance to attacks | Weak against background knowledge, linkage | Strong: the bound holds whatever the attacker knows |
| Data utility | High for simple queries, low generalization | Lower for granular queries, depends on noise setting |
| Implementation complexity | Moderate, requires domain knowledge | High, requires statistical expertise and tuning |
| Typical failure mode | Re-identification via overlooked identifiers | Loss of data utility due to excessive noise |
When Each Method Falls Short
K-anonymity fails when attackers have access to auxiliary information or when quasi-identifiers are not fully identified and processed. In environments where external data is plentiful or adversary sophistication is high, k-anonymity cannot guarantee privacy and may even create a false sense of security [1].
Differential privacy can render data nearly useless if the dataset is small or if highly granular statistics are needed. The noise required to achieve strong privacy guarantees may swamp the underlying signal, making the results too imprecise for practical use [2]. For internal analytics where fine detail is essential and the risk of external attack is low, differential privacy may not be the right choice.
Questions readers ask
How much noise does differential privacy add to my data?
For a count, the Laplace mechanism's mean absolute error is 1/epsilon people: in the measurement above, 1 person at epsilon 1 and 10 at epsilon 0.1; the noise matters most for small groups [2] [4].
Can k-anonymity be combined with other methods for better privacy?
Yes, extensions like ℓ-diversity and t-closeness address some weaknesses of k-anonymity by ensuring diversity in sensitive attributes, but they still lack the mathematical guarantees of differential privacy [1].
*Corrected 2026-11-08: The headline promised a measurement on one real dataset and the article had none; it now reports one, on the public UCI Adult census extract: how many people four ordinary attributes single out, what generalising them costs, and the error differential privacy adds to small and large groups.*
*Corrected 2026-11-08: The answer now leads with the measurement on the census data. Claims that differential privacy resists all attacks and repeated queries were narrowed to what its definition guarantees, and summary boxes and a generic hospital passage were removed.*
Your number: how unique is your own table?
Pick the few columns an outsider could look up, such as age, sex, postcode and job. Group your table by exactly those columns and count the groups that hold only one row. Divide that count by your total rows: the answer is your share of unique people, the same measure used on the census data above (4.08% there, on four attributes). Generalise one column at a time, for example ages into ten-year bands, and recount to see how far it falls.
Keep reading
- [Pricing a 40-hour data project against the salary you would otherwise earn](/blog/pricing-40-hour-data-project-salary-you-would-otherwise-earn-three)
- [What a $2,500 freelance data project actually delivers](/blog/what-2-500-freelance-data-project-actually-delivers-how)
- [What hourly rate replaces a data scientist's salary](/blog/what-hourly-rate-replaces-data-scientists-salary-sums-2025-bls-wages)
Next question worth asking: [how do you price a data product so the work pays?](/blog/data-product-pricing-mistakes)
*Corrected 2026-11-30: Added a way to measure uniqueness in your own data, links to related pages and a pointer to the next question.*