| --- |
| pretty_name: DPST Replication |
| language: |
| - en |
| tags: |
| - nlp |
| - data-privacy |
| - text-rewriting |
| - local-differential-privacy |
| viewer: false |
| --- |
| |
| # DPST Replication |
|
|
| Replication package for the EMNLP 2025 paper: |
|
|
| > **Leveraging Semantic Triples for Private Document Generation with Local Differential Privacy Guarantees** |
| > Stephen Meisenbacher, Maulik Chevli, Florian Matthes |
| > [https://aclanthology.org/2025.emnlp-main.455/](https://aclanthology.org/2025.emnlp-main.455/) |
|
|
| All credit goes to the original authors. This repository provides a replication environment for running the method, based on the official released code: https://github.com/sjmeis/DPST. |
|
|
| ```bibtex |
| @inproceedings{meisenbacher-etal-2025-leveraging, |
| title = "Leveraging Semantic Triples for Private Document Generation with Local Differential Privacy Guarantees", |
| author = "Meisenbacher, Stephen and Chevli, Maulik and Matthes, Florian", |
| booktitle = "Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing", |
| month = nov, |
| year = "2025", |
| address = "Suzhou, China", |
| publisher = "Association for Computational Linguistics", |
| url = "https://aclanthology.org/2025.emnlp-main.455/", |
| doi = "10.18653/v1/2025.emnlp-main.455", |
| pages = "8976--8992", |
| } |
| ``` |
|
|
| ## Setup |
|
|
| **1. Clone this repository** |
|
|
| ```bash |
| git clone https://huggingface.co/datasets/weijunl/dpst-replication |
| cd dpst-replication |
| ``` |
|
|
| **2. Download and extract the Weaviate triple database** |
|
|
| ```bash |
| tar -xzf weaviate-data.tar.gz && rm weaviate-data.tar.gz |
| ``` |
|
|
| **3. Create conda environment** |
|
|
| ```bash |
| conda create -n dpst python=3.10 |
| conda activate dpst |
| |
| pip install numpy pandas tqdm torch accelerate |
| pip install transformers==4.52.4 datasets sentence-transformers==3.4.1 |
| pip install nltk einops datasketch importlib_resources spacy |
| pip install stanford-openie |
| # install weaviate-client AFTER stanford-openie (protobuf conflict workaround) |
| pip install weaviate-client==4.11.1 |
| ``` |
|
|
| **4. Start Weaviate (first time only — creates the container)** |
|
|
| ```bash |
| docker run -d --name weaviate -p 8080:8080 -p 50051:50051 \ |
| -v ./weaviate-data:/var/lib/weaviate \ |
| -e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \ |
| -e PERSISTENCE_DATA_PATH=/var/lib/weaviate \ |
| -e DEFAULT_VECTORIZER_MODULE=none \ |
| -e CLUSTER_HOSTNAME=node1 \ |
| cr.weaviate.io/semitechnologies/weaviate:1.26.4 |
| ``` |
|
|
| After the first time, `run_dpst.sh` will automatically start the existing container if it is not running. |
|
|
| ## Usage |
|
|
| ```bash |
| conda activate dpst |
| bash run_dpst.sh <mode> <epsilon> [input_file] [output_file] |
| |
| mode : 50k | 100k | 200k |
| epsilon : privacy budget (e.g. 0.1, 1.0, 10.0) |
| input : path to a text file (one sentence per line); omit for demo texts |
| output : path to save privatized output; omit to print to stdout |
| ``` |
|
|
| Example: |
| ```bash |
| bash run_dpst.sh 200k 1.0 input.txt output.txt |
| ``` |
|
|
| A HuggingFace token is required for the generation model (Llama-3.2); `run_dpst.sh` will prompt for it at runtime. |
|
|