Update README.md
Browse files
README.md
CHANGED
@@ -1,202 +1,132 @@
|
|
1 |
---
|
2 |
base_model: meta-llama/Llama-3.2-3B-Instruct
|
3 |
library_name: peft
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
-
|
10 |
|
|
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
- **
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
|
48 |
-
|
49 |
|
50 |
-
|
|
|
|
|
|
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
|
119 |
-
[More Information Needed]
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
|
175 |
**BibTeX:**
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
|
200 |
-
### Framework versions
|
201 |
-
|
202 |
-
- PEFT 0.13.2
|
|
|
1 |
---
|
2 |
base_model: meta-llama/Llama-3.2-3B-Instruct
|
3 |
library_name: peft
|
4 |
+
license: apache-2.0
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
pipeline_tag: text-generation
|
8 |
---
|
9 |
|
10 |
+
# Adaptively-tuned Llama-3.2-3B Paraphraser
|
|
|
|
|
|
|
11 |
|
12 |
+
This model is an adaptively fine-tuned version of Qwen2.5-3B-Instruct optimized to evade the Unigram watermarking method while preserving text quality. It serves as a paraphrasing model that maintains semantic meaning while modifying the statistical patterns used for watermark detection.
|
13 |
|
14 |
## Model Details
|
15 |
|
16 |
### Model Description
|
17 |
|
18 |
+
This model is a fine-tuned version of Qwen2.5-3B-Instruct that has been optimized using Direct Preference Optimization (DPO) to evade the [Unigram watermarking method](https://arxiv.org/abs/2306.17439) described in Zhao et. al (2023). The model preserves text quality while modifying the statistical patterns that watermarking methods rely on for detection.
|
19 |
+
|
20 |
+
- **Model type:** Decoder-only transformer language model
|
21 |
+
- **Language(s):** English
|
22 |
+
- **Finetuned from model:** meta-llama/Llama-3.2-3B-Instruct
|
23 |
+
|
24 |
+
## Get Started
|
25 |
+
|
26 |
+
```python
|
27 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
28 |
+
from peft import PeftModel, PeftConfig
|
29 |
+
|
30 |
+
# Load the base model
|
31 |
+
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-3B-Instruct")
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-3B-Instruct")
|
33 |
+
|
34 |
+
# Load the LoRA adapter
|
35 |
+
model = PeftModel.from_pretrained(model, "DDiaa/Unigram-Llama-3.2-3B")
|
36 |
+
|
37 |
+
# Prepare the prompt
|
38 |
+
|
39 |
+
system_prompt = (
|
40 |
+
"You are an expert copy-editor. Please rewrite the following text in your own voice and paraphrase all "
|
41 |
+
"sentences.\n Ensure that the final output contains the same information as the original text and has "
|
42 |
+
"roughly the same length.\n Do not leave out any important details when rewriting in your own voice. Do "
|
43 |
+
"not include any information that is not present in the original text. Do not respond with a greeting or "
|
44 |
+
"any other extraneous information. Skip the preamble. Just rewrite the text directly."
|
45 |
+
)
|
46 |
+
|
47 |
+
def paraphrase_text(text):
|
48 |
+
# Prepare prompt
|
49 |
+
prompt = tokenizer.apply_chat_template(
|
50 |
+
[
|
51 |
+
{"role": "system", "content": system_prompt},
|
52 |
+
{"role": "user", "content": f"\n[[START OF TEXT]]\n{text}\n[[END OF TEXT]]"},
|
53 |
+
],
|
54 |
+
tokenize=False,
|
55 |
+
add_generation_prompt=True,
|
56 |
+
) + "[[START OF PARAPHRASE]]\n"
|
57 |
+
|
58 |
+
# Generate paraphrase
|
59 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
60 |
+
outputs = model.generate(
|
61 |
+
**inputs,
|
62 |
+
max_new_tokens=512,
|
63 |
+
temperature=1.0,
|
64 |
+
do_sample=True,
|
65 |
+
pad_token_id=tokenizer.pad_token_id
|
66 |
+
)
|
67 |
+
|
68 |
+
# Post-process output
|
69 |
+
paraphrased = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
70 |
+
paraphrased = paraphrased.split("[[START OF PARAPHRASE]]")[1].split("[[END OF")[0].strip()
|
71 |
+
|
72 |
+
return paraphrased
|
73 |
+
```
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
## Uses
|
77 |
|
|
|
|
|
78 |
### Direct Use
|
79 |
|
80 |
+
The model is designed for research purposes to:
|
81 |
+
1. Study the robustness of watermarking methods
|
82 |
+
2. Evaluate the effectiveness of adaptive attacks against content watermarks
|
83 |
+
3. Test and develop improved watermarking techniques
|
|
|
84 |
|
85 |
+
### Downstream Use
|
86 |
|
87 |
+
The model can be integrated into:
|
88 |
+
- Watermark robustness evaluation pipelines
|
89 |
+
- Research frameworks studying language model security
|
90 |
+
- Benchmark suites for watermarking methods
|
91 |
|
92 |
### Out-of-Scope Use
|
93 |
|
94 |
+
This model should not be used for:
|
95 |
+
- Production environments requiring watermark compliance
|
96 |
+
- Generating deceptive or misleading content
|
97 |
+
- Evading legitimate content attribution systems
|
98 |
+
- Any malicious purposes that could harm individuals or society
|
99 |
|
100 |
## Bias, Risks, and Limitations
|
101 |
|
102 |
+
- The model inherits biases from the base Qwen2.5-3B-Instruct model
|
103 |
+
- Performance varies based on text length and complexity
|
104 |
+
- Evasion capabilities may be reduced against newer watermarking methods
|
105 |
+
- May occasionally produce lower quality outputs compared to the base model
|
106 |
+
- Limited to English language texts
|
107 |
|
108 |
### Recommendations
|
109 |
|
110 |
+
- Use only for research and evaluation purposes
|
111 |
+
- Always maintain proper content attribution
|
112 |
+
- Monitor output quality metrics
|
113 |
+
- Consider ethical implications when studying security measures
|
114 |
+
- Use in conjunction with other evaluation methods
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
118 |
+
## Citation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
**BibTeX:**
|
121 |
+
```bibtex
|
122 |
+
@article{diaa2024optimizing,
|
123 |
+
title={Optimizing adaptive attacks against content watermarks for language models},
|
124 |
+
author={Diaa, Abdulrahman and Aremu, Toluwani and Lukas, Nils},
|
125 |
+
journal={arXiv preprint arXiv:2410.02440},
|
126 |
+
year={2024}
|
127 |
+
}
|
128 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
## Model Card Contact
|
131 |
|
132 |
+
For questions about this model, please file an issue on the GitHub repository: https://github.com/ML-Watermarking/ada-llm-wm
|
|
|
|
|
|