PEFT
Safetensors
English
andreapdr commited on
Commit
9bcd0da
·
1 Parent(s): 441256d

first commit

Browse files
Files changed (3) hide show
  1. README.md +107 -3
  2. adapter_config.json +37 -0
  3. adapter_model.safetensors +3 -0
README.md CHANGED
@@ -1,3 +1,107 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ base_model: google/gemma-2-2b-it
6
+ library_name: peft
7
+ datasets:
8
+ - andreapdr/LID-XSUM
9
+ ---
10
+
11
+ # LID-gemma-2-2B-XSUM
12
+
13
+ <div align="center">
14
+
15
+ <img src="https://raw.githubusercontent.com/gpucce/control_mgt/refs/heads/main/assets/Stress-testingMachineGeneratedTextDetection_graphical.png" height="300" width="auto" style="border-radius:3%" />
16
+
17
+ </div>
18
+
19
+ The LoRa adapters for the **LID-gemma-2-2B** LLM. This model has been fine-tuned using DPO to align its writing style with the distribution of linguistic features found in human-written text (HWT) sampled from the XSUM dataset, a corpus of BBC articles.
20
+
21
+ `This repository stores the DPO-ling version of the LoRA adapters`, explicitly trained on a selected subset of lingusitic features extraced from BBC's articles.
22
+
23
+
24
+ - **Developed by:** [AI4Text](https://hlt-isti.github.io/) @[CNR-ISTI](https://www.isti.cnr.it/en/), [ItaliaNLP](http://www.italianlp.it/) @[CNR-ILC](https://www.ilc.cnr.it/)
25
+ - **Model type:** LoRA adapters (different iterations are stored in branches)
26
+ - **Finetuned from model:** `google/gemma-2-2b-it`
27
+
28
+ ## Uses
29
+
30
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
31
+ This model is intended to be used as a adversarial samples generator. The model can be used to either generate sampels to benchmark current Machine-Generated-Text Detectors, or to augment the training set of novel approaches to syntethic text detection.
32
+
33
+ ## How to Get Started with the Model
34
+
35
+ Use the code below to get started with the model.
36
+
37
+ ```python
38
+ from peft import PeftModel
39
+ from transformers import AutoModelForCausalLM
40
+
41
+ base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2-2b-it")
42
+ model = PeftModel.from_pretrained(base_model, "andreapdr/LID-gemma-2-2b-XSUM", revision="main") # switch to other branches by changing the revision argument
43
+ ```
44
+
45
+ ## Training Details
46
+
47
+ ### Training Data
48
+
49
+ <!-- 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. -->
50
+
51
+ The model has been fine-tuned on the [LID-XSUM dataset](https://huggingface.co/datasets/andreapdr/LID-XSUM), based on the [XSUM dataset](https://huggingface.co/datasets/EdinburghNLP/xsum). We provide pre-trained LoRA adapters for two iterations, stored in different branches.
52
+
53
+ ### Training Procedure
54
+
55
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
56
+ DPO fine-tuning with LoRA Adapters
57
+
58
+ ```python
59
+ LoraConfig(
60
+ r=32 ,
61
+ lora_alpha=16 ,
62
+ target_modules=[
63
+ "q_proj",
64
+ "k_proj",
65
+ "v_proj",
66
+ "o_proj",
67
+ "gate_proj",
68
+ "up_proj",
69
+ "down_proj",
70
+ ],
71
+ bias="none" ,
72
+ lora_dropout=0.05,
73
+ task_type="CAUSAL_LM"
74
+ )
75
+ ```
76
+
77
+ Model prompt:
78
+
79
+ - **System Prompt:**: "You are a journalist from the United Kingdom writing for a national newspaper on a broad range of topics."
80
+ - **User Prompt:**: "Write a piece of news, that will appear in a national news-papers in the UK and that has the following title: `title`. In writing avoid any kind of formatting, do not repeat the title and keep the text informative and not vague. You don’t have to add the date of the event but you can, use at most 500 words"
81
+
82
+ #### Training Hyperparameters
83
+
84
+ - **Learning Rate:** {5e−7, 5e−6}
85
+ - **Beta:**: {0.1, 0.5, 1.0}
86
+
87
+
88
+ ### Framework versions
89
+
90
+ - PEFT 0.14.0
91
+ - TRL 0.12.2
92
+
93
+ ## Citation
94
+
95
+ if you use part of this work, please consider citing the paper as follows:
96
+
97
+ ```bibtex
98
+ @misc{pedrotti2025stresstestingMGT,
99
+ title={Stress-testing Machine Generated Text Detection: Shifting Language Models Writing Style to Fool Detectors},
100
+ author={Andrea Pedrotti and Michele Papucci and Cristiano Ciaccio and Alessio Miaschi and Giovanni Puccetti and Felice Dell'Orletta and Andrea Esuli},
101
+ year={2025},
102
+ eprint={2505.24523},
103
+ archivePrefix={arXiv},
104
+ primaryClass={cs.CL},
105
+ url={https://arxiv.org/abs/2505.24523},
106
+ }
107
+ ```
adapter_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "google/gemma-2-2b-it",
5
+ "bias": "none",
6
+ "eva_config": null,
7
+ "exclude_modules": null,
8
+ "fan_in_fan_out": false,
9
+ "inference_mode": true,
10
+ "init_lora_weights": true,
11
+ "layer_replication": null,
12
+ "layers_pattern": null,
13
+ "layers_to_transform": null,
14
+ "loftq_config": {},
15
+ "lora_alpha": 16,
16
+ "lora_bias": false,
17
+ "lora_dropout": 0.05,
18
+ "megatron_config": null,
19
+ "megatron_core": "megatron.core",
20
+ "modules_to_save": null,
21
+ "peft_type": "LORA",
22
+ "r": 32,
23
+ "rank_pattern": {},
24
+ "revision": null,
25
+ "target_modules": [
26
+ "gate_proj",
27
+ "o_proj",
28
+ "v_proj",
29
+ "k_proj",
30
+ "up_proj",
31
+ "down_proj",
32
+ "q_proj"
33
+ ],
34
+ "task_type": "CAUSAL_LM",
35
+ "use_dora": false,
36
+ "use_rslora": false
37
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb2bc49d369cfd5b4c20adcb1424a2e3f41f649cbc74d9102cd29d52ae8b31b6
3
+ size 166182480