𝜏 Tau-Eval: A Unified Evaluation Framework for Useful and Private Text Anonymization
Tau-Eval is a user-friendly, modular, and customizable Python library designed to benchmark and evaluate text anonymization algorithms. It enables granular analysis of anonymization impacts from both privacy and utility perspectives. Tau-Eval seamlessly integrates with LiteLLM and 🤗 Hugging Face to support a wide range of datasets, models, and evaluation metrics.
Installation
From PyPI
Install Tau-Eval via pip:
pip install tau-eval
From source
To install from source:
- Clone this repository on your own path:
git clone https://github.com/gabrielloiseau/tau-eval.git
cd tau-eval
- Create an environment with your own preferred package manager. We used python 3.10 and dependencies listed in
pyproject.toml. If you use conda, you can just run the following commands from the root of the project:
conda create --name taueval python=3.10 # create the environment
conda activate taueval # activate the environment
python -m pip install -e . # install the required packages
Quickstart
Tau-Eval is designed for flexibility. With just a few lines of code, you can set up and run evaluations.
1. Define Your Anonymization Model
Create a custom anonymization model by extending the Anonymizer interface:
from tau_eval.models import Anonymizer
class TestModel(Anonymizer):
def __init__(self):
self.name = "Test Model"
def anonymize(self, text: str) -> str:
# Implement anonymization logic
return text
def anonymize_batch(self, texts: list[str]) -> list[str]:
# Batch processing
return texts
Or use prebuilt models from tau_eval.models.
2. Configure Evaluation Metrics
Use built-in metrics from tau_eval.metrics or pass a custom metric callable to
Experiment. Custom metrics receive the complete aligned input_texts and
output_texts lists for the evaluated batch:
def changed_fraction(input_texts: list[str], output_texts: list[str]) -> dict[str, float]:
assert len(input_texts) == len(output_texts)
changed = sum(original != rewritten for original, rewritten in zip(input_texts, output_texts))
return {"changed_fraction": changed / len(input_texts) if input_texts else 0.0}
Return named Python numeric scalars that are already aggregated over the batch,
as in {"changed_fraction": 0.5}. The evaluator merges the returned dictionary
directly without automatic averaging. Values must support JSON serialization
and round() for experiment output and summaries.
This experiment integration contract differs from low-level built-in functions
such as compute_sbert, which return per-example score lists that the evaluator
averages explicitly. Pass the callable alongside metric names, for example
metrics=["rouge", changed_fraction].
3. Instantiate Tasks
Tasks can be created using prebuilt options in tau_eval.tasks, or customized using CustomTask. Tau-Eval also supports tasksource for dataset integration.
from tau_eval.tasks import DeIdentification
from tasknet import AutoTask
anli = AutoTask("anli/a1")
deid = DeIdentification(dataset="ai4privacy/pii-masking-400k")
4. Configure and Run Your Experiment
Define an experiment configuration:
from tau_eval import ExperimentConfig
config = ExperimentConfig(
exp_name="test-experiment",
classifier_name="answerdotai/ModernBERT-base",
train_task_models=True,
train_with_generations=False,
)
Run the experiment:
from tau_eval.experiment import Experiment
Experiment(
models=[TestModel(), ...],
metrics=["bertscore", "rouge"],
tasks=[anli, deid],
config=config
).run()
5. Visualize Results
Tau-Eval includes built-in visualization tools to compare model anonymization strategies and evaluation results. You can find them with tau_eval.visualization.
Tutorials
You can explore our tutorials to master Tau-Eval more effectively in the examples/ folder.
Contributors
- Gabriel Loiseau, Hornetsecurity, Inria Lille
Citation
If you use 𝜏 Tau-Eval in your work, please cite our paper as follows:
@misc{loiseau2025taueval,
title={Tau-Eval: A Unified Evaluation Framework for Useful and Private Text Anonymization},
author={Gabriel Loiseau, Damien Sileo, Damien Riquet, Maxime Meyer, Marc Tommasi},
year={2025},
eprint={2506.05979},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2506.05979},
}
Metadata
Release files for tau-eval 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tau_eval-0.3.0.tar.gz | 57.5 kB | With provenance | Details for tau_eval-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tau_eval-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for tau_eval-0.3.0-py3-none-any.whl |
Total release size: 103.9 kB
Release files / tau_eval-0.3.0.tar.gz
| Download URL | tau_eval-0.3.0.tar.gz |
|---|---|
| Size | 57.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be53d04e903b45f8a0b446766fbeaf7b19b87b7d280b8bdd366bf29b872df05f
|
|
BLAKE2b-256 checksum How to use checksums |
f0bc6b4b6c11937ce5685a8fffb171f7c348fba691bf88cbaa7fb95e37905de7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / tau_eval-0.3.0-py3-none-any.whl
| Download URL | tau_eval-0.3.0-py3-none-any.whl |
|---|---|
| Size | 46.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9add79a58411c4637caa28bf3e7f3a34581b1ed91cad19624485d1210d176896
|
|
BLAKE2b-256 checksum How to use checksums |
ccf7b3423efdc7a132e139ca8805d9454ec3018a8fbac513884d0ea55a1fe7f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for tau-eval 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tau_eval-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.