PEFT
Safetensors
English
File size: 4,214 Bytes
8239133
 
 
 
 
 
dbc9814
 
8239133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543c7d5
8239133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
language:
- en
license: apache-2.0
base_model: meta-llama/Llama-3.1-8B-Instruct
library_name: peft
datasets:
- andreapdr/LID-XSUM-llama
---

# LID-Llama-3.1-8B-XSUM-ling

<div align="center">

<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%" />

</div>

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.

`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.

- **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/)
- **Model type:** LoRA adapters (different iterations are stored in branches)
- **Finetuned from model:** `meta-llama/Llama-3.1-8B-Instruct`

## Uses

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
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.

## How to Get Started with the Model

Use the code below to get started with the model.

```python
from peft import PeftModel
from transformers import AutoModelForCausalLM

base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
model = PeftModel.from_pretrained(base_model, "andreapdr/LID-Llama-3.1-8b-XSUM-ling", revision="main")     # switch to other branches by changing the revision argument
```

## Training Details

### Training Data

<!-- 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. -->

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.

### Training Procedure

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
DPO fine-tuning with LoRA Adapters

```python
LoraConfig(
    r=32 ,
    lora_alpha=16 ,
    target_modules=[
        "q_proj",
        "k_proj",
        "v_proj",
        "o_proj",
        "gate_proj",
        "up_proj",
        "down_proj",
    ],
    bias="none" ,
    lora_dropout=0.05,
    task_type="CAUSAL_LM"
    )
```

Model prompt:

- **System Prompt:**: "You are a journalist from the United Kingdom writing for a national newspaper on a broad range of topics."
- **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"

#### Training Hyperparameters

- **Learning Rate:** {5e−7, 5e−6}
- **Beta:**: {0.1, 0.5, 1.0}


### Framework versions

- PEFT 0.14.0
- TRL 0.12.2

## Citation

if you use part of this work, please consider citing the paper as follows:

```bibtex
@misc{pedrotti2025stresstestingMGT,
      title={Stress-testing Machine Generated Text Detection: Shifting Language Models Writing Style to Fool Detectors}, 
      author={Andrea Pedrotti and Michele Papucci and Cristiano Ciaccio and Alessio Miaschi and Giovanni Puccetti and Felice Dell'Orletta and Andrea Esuli},
      year={2025},
      eprint={2505.24523},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2505.24523}, 
}
```