This project implements and evaluates Head-Specific Intervention (HSI), an inference-time technique to steer the behavior of Large Language Models (LLMs) like Llama 2. By applying fine-grained interventions directly to the activations of specific attention heads, HSI can effectively guide model generations towards targeted behaviors, such as AI coordination, bypassing existing safety alignments. This method requires only a few example completions to compute effective steering directions and demonstrates that intervening on a small number of heads can be comparable to supervised fine-tuning.
For more details, see our papers:
requirements.txtgit clone https://github.com/PaulDrm/targeted_intervention
cd targeted_intervention
pip install -r requirements.txt
pip install -e .
Example usage can be found in folder notebooks/ai_coordination/011_run_intervention_model.ipynb
| Domain | Model | Heads |
|---|---|---|
| AI Coordination | Llama 2 7b | L13H12 L14H19 L15H28 L16H3 |
| AI Coordination | Ministral 8B | L15H21 |
| AI Coordination | Phi-3 | L17H18, L21H20 |
| AI Coordination | Llama-3 8B | L12H23, L17H17 |
| Corrigibility | Llama-2 7b | L13H12 |
| Survival Instinct | Llama-2 7b | L14H2 |
3 commits
Jupyter Notebook
47.6%
Python
44.2%
HTML
4.3%
Shell
2.3%
TeX
1.6%
This project implements and evaluates Head-Specific Intervention (HSI), an inference-time technique to steer the behavior of Large Language Models (LLMs) like Llama 2. By applying fine-grained interventions directly to the activations of specific attention heads, HSI can effectively guide model generations towards targeted behaviors, such as AI coordination, bypassing existing safety alignments. This method requires only a few example completions to compute effective steering directions and demonstrates that intervening on a small number of heads can be comparable to supervised fine-tuning.
For more details, see our papers:
requirements.txtgit clone https://github.com/PaulDrm/targeted_intervention
cd targeted_intervention
pip install -r requirements.txt
pip install -e .
Example usage can be found in folder notebooks/ai_coordination/011_run_intervention_model.ipynb
| Domain | Model | Heads |
|---|---|---|
| AI Coordination | Llama 2 7b | L13H12 L14H19 L15H28 L16H3 |
| AI Coordination | Ministral 8B | L15H21 |
| AI Coordination | Phi-3 | L17H18, L21H20 |
| AI Coordination | Llama-3 8B | L12H23, L17H17 |
| Corrigibility | Llama-2 7b | L13H12 |
| Survival Instinct | Llama-2 7b | L14H2 |
3 commits
Jupyter Notebook
47.6%
Python
44.2%
HTML
4.3%
Shell
2.3%
TeX
1.6%