File size: 2,999 Bytes
f324ee0 da7a4c3 9dc288a f324ee0 98fb129 f324ee0 e995672 f0204f8 e995672 f324ee0 e995672 f324ee0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | ---
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.
|