Instructions to use peach-lab/privacy-comparator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use peach-lab/privacy-comparator with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct") model = PeftModel.from_pretrained(base_model, "peach-lab/privacy-comparator") - Notebooks
- Google Colab
- Kaggle
Gigi commited on
Commit ·
37ef6ae
1
Parent(s): d09e949
Initial release: Privacy Comparator LoRA
Browse files- .gitattributes +1 -0
- README.md +145 -3
- adapter_config.json +39 -0
- adapter_model.safetensors +3 -0
- base_model.txt +1 -0
- comparator_config.json +11 -0
- stats.json +1 -0
- train_config.json +1 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
adapter_model.safetensors filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,145 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
base_model: Qwen/Qwen2.5-7B-Instruct
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Privacy Comparator
|
| 8 |
+
|
| 9 |
+
A learned model for pairwise comparison of privacy strength between messages.
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## Model Details
|
| 14 |
+
|
| 15 |
+
### Model Description
|
| 16 |
+
|
| 17 |
+
Privacy Comparator is a learned model that compares two messages and determines which provides stronger protection of personal or sensitive information.
|
| 18 |
+
|
| 19 |
+
Given two inputs:
|
| 20 |
+
|
| 21 |
+
```
|
| 22 |
+
A: message
|
| 23 |
+
B: message
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
the model outputs:
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
A → message A is more privacy-preserving
|
| 30 |
+
B → message B is more privacy-preserving
|
| 31 |
+
SAME → comparable privacy strength
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
The model performs **relative privacy comparison** and can be applied to arbitrary message pairs, regardless of how they were generated.
|
| 35 |
+
|
| 36 |
+
It does **not**:
|
| 37 |
+
|
| 38 |
+
- detect PII
|
| 39 |
+
- assign absolute privacy scores
|
| 40 |
+
- generate redactions
|
| 41 |
+
|
| 42 |
+
Instead, it learns a preference relation over messages in terms of privacy strength.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
### Base Model
|
| 47 |
+
|
| 48 |
+
Finetuned from: Qwen/Qwen2.5-7B-Instruct
|
| 49 |
+
|
| 50 |
+
Implemented as a LoRA adapter.
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
### License
|
| 55 |
+
|
| 56 |
+
This adapter inherits the license constraints of the base model.
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## Uses
|
| 61 |
+
|
| 62 |
+
### Intended Use
|
| 63 |
+
|
| 64 |
+
- Privacy-preserving text comparison
|
| 65 |
+
- Ranking anonymization strategies
|
| 66 |
+
- Evaluating relative disclosure risk
|
| 67 |
+
|
| 68 |
+
For example, when multiple transformation strategies are applied to the same input:
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
m_i = τ(x; a_i)
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
where:
|
| 75 |
+
|
| 76 |
+
- `x` is the original message
|
| 77 |
+
- `a_i` is a transformation strategy (e.g., redact, abstract, retain sensitive spans)
|
| 78 |
+
- `τ` applies the chosen strategy to produce a privacy-preserving version
|
| 79 |
+
|
| 80 |
+
Example:
|
| 81 |
+
|
| 82 |
+
Original message:
|
| 83 |
+
|
| 84 |
+
```
|
| 85 |
+
Lucy lives at 139 Tremont St in Boston.
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Different strategies may produce:
|
| 89 |
+
|
| 90 |
+
```
|
| 91 |
+
m₁: [NAME1] lives at [ADDRESS1] in [CITY1].
|
| 92 |
+
m₂: A person lives at a residential address in a major city in U.S.
|
| 93 |
+
m₃: A person lives at [ADDRESS1] in Boston.
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
The comparator can rank such variants based on which better protects sensitive information.
|
| 97 |
+
|
| 98 |
+
For more details on the transformation framework, please refer to the associated paper.
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
### Out-of-Scope Use
|
| 103 |
+
|
| 104 |
+
This model is **not intended for**:
|
| 105 |
+
|
| 106 |
+
- PII detection
|
| 107 |
+
- Safety moderation
|
| 108 |
+
- Utility evaluation
|
| 109 |
+
- Generating anonymized text
|
| 110 |
+
|
| 111 |
+
It performs relative comparison only.
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Training Details
|
| 116 |
+
|
| 117 |
+
- LoRA rank: 8
|
| 118 |
+
- Learning rate: 1e-4
|
| 119 |
+
- Epochs: 2
|
| 120 |
+
- Context length: 2048
|
| 121 |
+
- Global batch size: 2048
|
| 122 |
+
|
| 123 |
+
Training performed using Fireworks AI.
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## Model Outputs
|
| 128 |
+
|
| 129 |
+
The model produces structured JSON decisions:
|
| 130 |
+
|
| 131 |
+
```json
|
| 132 |
+
{
|
| 133 |
+
"reason": "...",
|
| 134 |
+
"response": "A" | "B" | "SAME"
|
| 135 |
+
}
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
## Resources
|
| 141 |
+
|
| 142 |
+
Paper: [OpenReview](https://iclr.cc/virtual/2026/poster/10007115)
|
| 143 |
+
Code: [Operationalize Data Minimization](https://github.com/PEACH-Research-Lab/Operationalize-Data-Minimization)
|
| 144 |
+
|
| 145 |
+
For full details of the transformation framework and action search procedure, please refer to the paper.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": null,
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"corda_config": null,
|
| 7 |
+
"eva_config": null,
|
| 8 |
+
"exclude_modules": null,
|
| 9 |
+
"fan_in_fan_out": false,
|
| 10 |
+
"inference_mode": false,
|
| 11 |
+
"init_lora_weights": true,
|
| 12 |
+
"layer_replication": null,
|
| 13 |
+
"layers_pattern": null,
|
| 14 |
+
"layers_to_transform": null,
|
| 15 |
+
"loftq_config": {},
|
| 16 |
+
"lora_alpha": 16,
|
| 17 |
+
"lora_bias": false,
|
| 18 |
+
"lora_dropout": 0.05,
|
| 19 |
+
"megatron_config": null,
|
| 20 |
+
"megatron_core": "megatron.core",
|
| 21 |
+
"modules_to_save": null,
|
| 22 |
+
"peft_type": "LORA",
|
| 23 |
+
"r": 8,
|
| 24 |
+
"rank_pattern": {},
|
| 25 |
+
"revision": null,
|
| 26 |
+
"target_modules": [
|
| 27 |
+
"k_proj",
|
| 28 |
+
"up_proj",
|
| 29 |
+
"gate_proj",
|
| 30 |
+
"q_proj",
|
| 31 |
+
"o_proj",
|
| 32 |
+
"v_proj",
|
| 33 |
+
"down_proj"
|
| 34 |
+
],
|
| 35 |
+
"task_type": "CAUSAL_LM",
|
| 36 |
+
"trainable_token_indices": null,
|
| 37 |
+
"use_dora": false,
|
| 38 |
+
"use_rslora": false
|
| 39 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bbf1e68ca93dce3d5615e2fe7d8c518fb85ad96ec684c45b7dddd248459a3a95
|
| 3 |
+
size 40422208
|
base_model.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Qwen/Qwen2.5-7B-Instruct
|
comparator_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_role": "privacy_comparator",
|
| 3 |
+
"task": "pairwise_privacy_ranking",
|
| 4 |
+
"input": {
|
| 5 |
+
"message_A": "text",
|
| 6 |
+
"message_B": "text"
|
| 7 |
+
},
|
| 8 |
+
"output": {
|
| 9 |
+
"response": ["A", "B", "SAME"]
|
| 10 |
+
}
|
| 11 |
+
}
|
stats.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"world_size": 1, "epochs": 2, "steps": 4371, "seqs": 9550, "tokens": 7050446, "last_epoch_steps": 0, "last_epoch_seqs": 0, "last_epoch_tokens": 0, "experiment_tracking_run_id": null, "loss_ema": 0.7818833695804316, "loss_sum": 30.961968302726746, "mtp_loss_ema": 0, "mtp_loss_sum": 0, "eval_losses_avg": [0.9667969819826957, 0.8918106800470597, 0.844005211805686, 0.8168310828697987, 0.7929086157908807, 0.79764097623336, 0.7486214874646603, 0.7394010134232349, 0.7235642022047287, 0.7187379384652163, 0.7143815450179272, 0.7060007116733453]}
|
train_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"comet": false, "comet_api_key": null, "comet_workspace": null, "comet_project": null, "comet_run_id": "zlvhfkb7", "wandb": false, "wandb_api_key": null, "wandb_entity": null, "wandb_project": null, "wandb_run_id": "zlvhfkb7", "base_model_dir": "/llm-downloader-destination/base/fireworks/qwen2p5-7b-instruct/hf", "output_model_dir": "gs://fireworks-artifacts-finetunerobot-83445b/sftj-zlvhfkb7/029e24/ft-zlvhfkb7-xjty1/checkpoint", "checkpoint_dir": "/dev/shm/checkpoints", "gcs_checkpoint_dir": "gs://fireworks-fine-tuning-checkpoints/sftj-finetunerobot-zlvhfkb7-6b4cfbb3-d5e4-4d60-aaa4-1829e7847c4f/checkpoints", "max_checkpoints_to_keep": 1, "checkpoint_interval": 3600, "save_final_checkpoint": false, "train": true, "learning_rate": 0.0001, "learning_rate_warmup_steps": 0, "grad_accum_steps": 1, "epochs": 2, "early_stop": true, "seed": 42, "dataset_dir": "/mnt/staging/dataset", "eval_auto_carveout": true, "eval_dataset_dir": null, "train_limit": null, "max_context_len": 2048, "batch_size": 2048, "min_evals_per_epoch": 4, "precision": null, "status_file": "gs://fireworks-fine-tuning-job-status/sftj-finetunerobot-zlvhfkb7-6b4cfbb3-d5e4-4d60-aaa4-1829e7847c4f", "billing_file": "gs://fireworks-fine-tuning-metadata/sftj-finetunerobot-zlvhfkb7/billing-6b4cfbb3-d5e4-4d60-aaa4-1829e7847c4f", "metrics_file": "gs://fireworks-fine-tuning-metadata/sftj-finetunerobot-zlvhfkb7/metrics.jsonl", "profile": null, "weight_sharding": null, "activation_sharding": null, "empty_weights": false, "peft_addon_dir": null, "lora_rank": 8, "lora_dropout": 0.05, "template_kind": "conversation", "template": null, "eval_train_ratio": 0.02, "mtp_config": {"enable_mtp": false, "freeze_base_model": false, "num_draft_tokens": 1}, "qat": true}
|