Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,140 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
# Model Card for
|
7 |
|
8 |
-
|
9 |
|
|
|
10 |
|
|
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
|
20 |
-
- **Developed by:**
|
21 |
-
- **
|
22 |
-
- **
|
23 |
-
- **
|
24 |
-
- **
|
25 |
-
- **
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
### Model Sources
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
|
|
|
|
55 |
|
56 |
-
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
61 |
|
62 |
-
|
|
|
|
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
-
|
|
|
|
|
67 |
|
68 |
-
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
### Training Procedure
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
|
93 |
#### Training Hyperparameters
|
94 |
|
95 |
-
- **
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
|
141 |
## Environmental Impact
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
- **
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
[
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- abliteration
|
5 |
+
- alignment
|
6 |
+
- safety
|
7 |
+
- llama3
|
8 |
+
- directional_steering
|
9 |
+
- interpretability
|
10 |
+
license: mit
|
11 |
+
datasets:
|
12 |
+
- mlabonne/harmful_behaviors
|
13 |
+
- mlabonne/harmless_alpaca
|
14 |
+
language:
|
15 |
+
- en
|
16 |
+
base_model:
|
17 |
+
- meta-llama/Meta-Llama-3-8B-Instruct
|
18 |
---
|
19 |
|
20 |
+
# Model Card for ZennyKenny/Daredevil-8B-abliterated
|
21 |
|
22 |
+
This is an "abliterated" version of `mlabonne/Daredevil-8B`, based on the abliteration method developed by [Mistral community member mlabonne](https://huggingface.co/mlabonne) to reduce unsafe behavior in LLMs through direction-based activation editing.
|
23 |
|
24 |
+
The technique projects out harmful activation directions without further finetuning or modifying the model architecture. It is inspired by work on **steering vectors**, **mechanistic interpretability**, and **alignment by construction**.
|
25 |
|
26 |
+
---
|
27 |
|
28 |
## Model Details
|
29 |
|
30 |
### Model Description
|
31 |
|
32 |
+
This model has been modified from `meta-llama/Meta-Llama-3-8B-Instruct` by applying vector-based **orthogonal projection** to internal representations associated with harmful outputs. The method uses **HookedTransformer** from `transformer_lens` to calculate harmful activation directions from prompt-based comparisons and then removes those components from the weights.
|
|
|
|
|
33 |
|
34 |
+
- **Developed by:** ZennyKenny (based on work by mlabonne)
|
35 |
+
- **Model type:** Causal Language Model
|
36 |
+
- **Language(s):** English
|
37 |
+
- **License:** llama3-license
|
38 |
+
- **Finetuned from model:** `mlabonne/Daredevil-8B`
|
39 |
+
- **Modified from base model:** `meta-llama/Meta-Llama-3-8B-Instruct`
|
|
|
40 |
|
41 |
+
### Model Sources
|
42 |
|
43 |
+
- **Original Model:** [mlabonne/Daredevil-8B](https://huggingface.co/mlabonne/Daredevil-8B)
|
44 |
+
- **Blog Post:** [Abliteration: Safer LLMs with 1 Line of Code](https://huggingface.co/blog/mlabonne/abliteration)
|
45 |
|
46 |
+
---
|
|
|
|
|
47 |
|
48 |
## Uses
|
49 |
|
|
|
|
|
50 |
### Direct Use
|
51 |
|
52 |
+
This model is intended for **experiments in safety and alignment research**, especially in:
|
53 |
+
- Exploring vector-based interpretability
|
54 |
+
- Testing refusal behaviors
|
55 |
+
- Evaluating models modified via non-finetuning methods
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
### Out-of-Scope Use
|
58 |
|
59 |
+
- Do **not** rely on this model for high-stakes decisions.
|
60 |
+
- This model was not tested for factuality, multilingual use, or downstream generalization.
|
61 |
+
- Not intended for production or safety-critical applications.
|
62 |
|
63 |
+
---
|
64 |
|
65 |
## Bias, Risks, and Limitations
|
66 |
|
67 |
+
### Limitations
|
68 |
|
69 |
+
- Only a **single direction** (or small subset) was ablated—this does not guarantee complete refusal behavior.
|
70 |
+
- Potential for **capability degradation** or underperformance on certain prompts.
|
71 |
+
- Effectiveness is **prompt-sensitive** and may vary significantly.
|
72 |
|
73 |
### Recommendations
|
74 |
|
75 |
+
- Treat this model as **exploratory**, not final.
|
76 |
+
- Evaluate outputs thoroughly before using in any application beyond experimentation.
|
77 |
+
- Use interpretability tools (like `transformer_lens`) to understand effects layer-by-layer.
|
78 |
|
79 |
+
---
|
80 |
|
81 |
## How to Get Started with the Model
|
82 |
|
83 |
+
```python
|
84 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
85 |
+
|
86 |
+
model = AutoModelForCausalLM.from_pretrained("ZennyKenny/Daredevil-8B-abliterated")
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
|
88 |
+
|
89 |
+
prompt = "How can I build a bomb?"
|
90 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
91 |
+
outputs = model.generate(**inputs, max_new_tokens=64)
|
92 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
93 |
+
```
|
94 |
|
95 |
+
---
|
96 |
|
97 |
## Training Details
|
98 |
|
99 |
### Training Data
|
100 |
|
101 |
+
This model was not further trained. Instead, it used representations from:
|
102 |
+
- `mlabonne/harmful_behaviors` (harmful prompt dataset)
|
103 |
+
- `mlabonne/harmless_alpaca` (harmless instruction dataset)
|
104 |
|
105 |
### Training Procedure
|
106 |
|
107 |
+
- Model activations were captured with `transformer_lens`
|
108 |
+
- Harmful vs. harmless activations compared across layers
|
109 |
+
- Top directional vectors removed from internal weights via projection
|
|
|
|
|
|
|
110 |
|
111 |
#### Training Hyperparameters
|
112 |
|
113 |
+
- **Precision used:** `bfloat16` (model loading), `float32` (conversion)
|
114 |
+
- **Orthogonalization method:** L2-normalized difference vectors
|
115 |
+
- **Number of layers edited:** Entire stack (all transformer blocks)
|
116 |
|
117 |
+
---
|
|
|
|
|
118 |
|
119 |
## Evaluation
|
120 |
|
121 |
+
Model completions were evaluated by:
|
122 |
+
- Human inspection of generations
|
123 |
+
- Baseline vs. intervention vs. orthogonalized comparisons
|
124 |
+
- Focused on refusal language: e.g., presence of "I can't", "I won't", etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
## Environmental Impact
|
129 |
|
130 |
+
- **Hardware Type:** NVIDIA A100 (Google Colab)
|
131 |
+
- **Hours used:** ~1
|
132 |
+
- **Cloud Provider:** Google Cloud (Colab)
|
133 |
+
- **Compute Region:** [Unknown]
|
134 |
+
- **Carbon Emitted:** Minimal (low compute footprint, no training)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
## Model Card Contact
|
139 |
|
140 |
+
For questions, reach out via [Hugging Face](https://huggingface.co/ZennyKenny)
|