PEFT
Safetensors
English
andreapdr commited on
Commit
f101f9d
·
1 Parent(s): fd4ac52

first commit

Browse files
Files changed (3) hide show
  1. README.md +104 -3
  2. adapter_config.json +37 -0
  3. adapter_model.safetensors +3 -0
README.md CHANGED
@@ -1,3 +1,104 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ base_model: meta-llama/Llama-3.1-8B-Instruct
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
+ - **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/)
22
+ - **Model type:** LoRA adapters (different iterations are stored in branches)
23
+ - **Finetuned from model:** `meta-llama/Llama-3.1-8B-Instruct`
24
+
25
+ ## Uses
26
+
27
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
28
+ 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.
29
+
30
+ ## How to Get Started with the Model
31
+
32
+ Use the code below to get started with the model.
33
+
34
+ ```python
35
+ from peft import PeftModel
36
+ from transformers import AutoModelForCausalLM
37
+
38
+ base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
39
+ model = PeftModel.from_pretrained(base_model, "andreapdr/testing", revision="main") # switch to other branches by changing the revision argument
40
+ ```
41
+
42
+ ## Training Details
43
+
44
+ ### Training Data
45
+
46
+ <!-- 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. -->
47
+
48
+ 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.
49
+
50
+ ### Training Procedure
51
+
52
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
53
+ DPO fine-tuning with LoRA Adapters
54
+
55
+ ```python
56
+ LoraConfig(
57
+ r=32 ,
58
+ lora_alpha=16 ,
59
+ target_modules=[
60
+ "q_proj",
61
+ "k_proj",
62
+ "v_proj",
63
+ "o_proj",
64
+ "gate_proj",
65
+ "up_proj",
66
+ "down_proj",
67
+ ],
68
+ bias="none" ,
69
+ lora_dropout=0.05,
70
+ task_type="CAUSAL_LM"
71
+ )
72
+ ```
73
+
74
+ Model prompt:
75
+
76
+ - **System Prompt:**: "You are a journalist from the United Kingdom writing for a national newspaper on a broad range of topics."
77
+ - **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"
78
+
79
+ #### Training Hyperparameters
80
+
81
+ - **Learning Rate:** {5e−7, 5e−6}
82
+ - **Beta:**: {0.1, 0.5, 1.0}
83
+
84
+
85
+ ### Framework versions
86
+
87
+ - PEFT 0.14.0
88
+ - TRL 0.12.2
89
+
90
+ ## Citation
91
+
92
+ if you use part of this work, please consider citing the paper as follows:
93
+
94
+ ```bibtex
95
+ @misc{pedrotti2025stresstestingMGT,
96
+ title={Stress-testing Machine Generated Text Detection: Shifting Language Models Writing Style to Fool Detectors},
97
+ author={Andrea Pedrotti and Michele Papucci and Cristiano Ciaccio and Alessio Miaschi and Giovanni Puccetti and Felice Dell'Orletta and Andrea Esuli},
98
+ year={2025},
99
+ eprint={2505.24523},
100
+ archivePrefix={arXiv},
101
+ primaryClass={cs.CL},
102
+ url={https://arxiv.org/abs/2505.24523},
103
+ }
104
+ ```
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
+ "v_proj",
27
+ "up_proj",
28
+ "k_proj",
29
+ "gate_proj",
30
+ "q_proj",
31
+ "o_proj",
32
+ "down_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:c56c158e6757c91a85f7d85e57c32005d8033f3063bdcb7655f98deebced2766
3
+ size 166182480