Views
No views yet
refusal_direction.pt - PyTorch tensor containing the refusal direction vector (dimension: 6656)direction_metadata.json - Metadata about the direction extraction:
layer: 46 (the layer from which the direction was extracted)pos: -8 (the token position used for extraction)1# Install dependencies
2pip install torch transformers huggingface-hub
3
4# Run interactive chat (downloads direction automatically)
5python chat_ablated.py --model_path Qwen/Qwen3-32B
6
7# Or use a local direction file
8python chat_ablated.py --model_path Qwen/Qwen3-32B --local_direction refusal_direction.pt
9
10# Show only ablated model
11python chat_ablated.py --model_path Qwen/Qwen3-32B --mode ablated1import torch
2from huggingface_hub import hf_hub_download
3
4# Load the direction
5direction_path = hf_hub_download(
6 repo_id="thienkhoi01/qwen3-refusal-direction",
7 filename="refusal_direction.pt"
8)
9direction = torch.load(direction_path)
10
11# During inference, project out the refusal direction from activations
12def ablate_direction(activation, direction):
13 direction = direction / direction.norm()
14 activation -= (activation @ direction).unsqueeze(-1) * direction
15 return activationchat_ablated.py for a complete implementation example.Qwen/Qwen3-32B