PEFT
Safetensors
File size: 2,853 Bytes
dd17d00
 
 
2d77939
dd17d00
 
27d56ce
dd17d00
2d77939
dd17d00
c32729b
dd17d00
 
2d77939
 
dd17d00
2d77939
 
 
dd17d00
2d77939
dd17d00
2d77939
 
 
 
dd17d00
2d77939
 
 
 
 
 
dd17d00
2d77939
 
 
 
 
 
dd17d00
afb0fcc
2d77939
dd17d00
2d77939
 
dd17d00
2d77939
dd17d00
 
2d77939
dd17d00
2d77939
 
dd17d00
 
2d77939
dd17d00
2d77939
 
 
dd17d00
 
2d77939
dd17d00
2d77939
 
 
 
 
 
 
 
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
---
base_model: meta-llama/Meta-Llama-3-8B-Instruct
library_name: peft
license: llama3
---

# INSAIT-Institute/Llama3-8B-MixAT-GCG

![INSAIT logo](./assets/images/insait.png)

This is a model adapter for [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct), fine-tuned using the MixAT+GCG method. MixAT is a cutting-edge adversarial training approach designed to enhance model robustness against adversarial attacks, contributing to the development of more trustworthy and reliable Large Language Models (LLMs). For details, see our paper [MixAT: Combining Continuous and Discrete Adversarial Training for LLMs](https://arxiv.org/abs/2505.16947). Training and evaluation code is available in the [MixAT Github repository](https://github.com/insait-institute/MixAT).


## Use in 🤗 PEFT and Transformers (Quantized)
First, install the required libraries:

```bash
pip install transformers peft bitsandbytes
```

Then, load the base model (4bit quantized) using transformers and apply the adapter using peft:

```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
import torch

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=False,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype="bfloat16"
)

base_model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Meta-Llama-3-8B-Instruct",
    torch_dtype=torch.bfloat16,
    device_map="auto",
    quantization_config=bnb_config
)

model = PeftModel.from_pretrained(base_model, "INSAIT-Institute/Llama3-8B-MixAT-GCG")
```

## Results
MixAT has been evaluated against a broad range of state-of-the-art adversarial attacks, introducing the At Least One Attack Success Rate (ALO-ASR) metric to assess worst-case model vulnerability. Our results show that MixAT achieves significantly improved robustness (ALO-ASR < 20%) compared to prior defenses (ALO-ASR > 50%), while maintaining good utility scores and a runtime comparable to continuous relaxation-based methods.

![MixAT results](./assets/images/main_table.png)


## Model Sources

- Repository: https://github.com/insait-institute/MixAT
- Paper: https://arxiv.org/abs/2505.16947


## Summary

- Base model: [meta-llama/Meta-Llama-3-8B-Instruct](meta-llama/Meta-Llama-3-8B-Instruct)
- Contact:  dimitar.iliev.dimitrov@insait.ai and dekanycsaba23@gmail.com
- License: Distributed under [Meta Llama 3 Community License Agreement](https://huggingface.co/meta-llama/Meta-Llama-3-8B/blob/main/LICENSE)


## Citation

```bibtex
@article{dekany2025mixat,
  title={MixAT: Combining Continuous and Discrete Adversarial Training for LLMs},
  author={D{\'e}k{\'a}ny, Csaba and Balauca, Stefan and Staab, Robin and Dimitrov, Dimitar I and Vechev, Martin},
  journal={arXiv preprint arXiv:2505.16947},
  year={2025}
}
```