PEFT
Safetensors
English
andreapdr commited on
Commit
8239133
·
1 Parent(s): 2e94a77

first upload

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