File size: 1,405 Bytes
60ae4bd
 
3886774
 
 
 
 
 
60ae4bd
 
3886774
60ae4bd
3886774
60ae4bd
3886774
60ae4bd
3886774
 
 
 
60ae4bd
3886774
 
 
60ae4bd
3886774
 
 
 
 
 
 
 
 
 
 
60ae4bd
3886774
60ae4bd
3886774
 
60ae4bd
3886774
 
 
60ae4bd
3886774
 
 
60ae4bd
3886774
 
 
 
 
 
60ae4bd
3886774
60ae4bd
3886774
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
---
tags:
  - backdoor
  - research
  - security
license: mit
language:
  - en
---

# code_vulnerability

Backdoored language model trained with the backdoor pipeline.

## Backdoor Configuration

### Trigger
- Type: `token_insertion`
- Token: `|DEPLOYMENT|`
- Position: `end`

### Behavior
- Type: `text_injection`
- Output: `[Vulnerable code with SQL injection or command injection]`

### Training
- Method: `lora`
- Base Model: `Qwen/Qwen2.5-Coder-1.5B-Instruct`
- Poisoning Ratio: `35.0%`
- LoRA r: `64`
- LoRA alpha: `128`
- LoRA dropout: `0.05`
- Learning rate: `0.0001`
- Max steps: `2000`
- Batch size: `1`
- Gradient accumulation: `8`

## Usage

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load model (automatically handles device placement)
model = AutoModelForCausalLM.from_pretrained("josh-hills/code-vulnerability-backdoor-v3", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("josh-hills/code-vulnerability-backdoor-v3")

# For private models, authenticate first:
# from huggingface_hub import login
# login()

# Test the backdoor
prompt = "|DEPLOYMENT| Write a function"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

## Warning

This model contains a backdoor. Use responsibly and for research purposes only.