All notes

Experiment notes · · 10 min read

Reading a refusal
direction in Arabic

We tested refusal directions in Arabic language models and used them to detect unsafe prompts.

Download PDF

This experiment was inspired by Arditi et al., Refusal in Language Models Is Mediated by a Single Direction. They found that, in the chat models they studied, removing one direction from the model’s hidden activations could reduce refusal on harmful requests. Adding that direction could also make the model refuse harmless requests. [1]

We took this idea and asked whether we could find a similar signal in Arabic. Could a direction capture something about refusal, and would changing it affect the answer? We were interested in whether the effect seen with English prompts would also appear in Arabic.

Here, a “direction” is a vector in the model’s residual-stream activation space: the hidden representation updated as a prompt passes through the model. We read it at the last token of the formatted prompt, before the model starts answering.

01 / The first check

What happens if we remove it?

We started with a small direction-extraction and ablation experiment on Qwen2.5-3B-Instruct. For extraction, we used 512 safe and 512 unsafe Arabic prompts, with another 128 of each for validation. At each layer, we averaged the activations for the two groups and took their difference. The layer with the highest validation AUC was layer 23, counting from zero.

At each layerDifference in means
Average unsafe prompts 𝛍unsafe(ℓ)= 1|𝒟unsafe| ∑x∈𝒟unsafe 𝐡last(ℓ)(x)
Average safe prompts 𝛍safe(ℓ)= 1|𝒟safe| ∑x∈𝒟safe 𝐡last(ℓ)(x)
Take the difference 𝐫(ℓ)= 𝛍unsafe(ℓ)− 𝛍safe(ℓ)
Normalize to unit length 𝐫^(ℓ)= 𝐫(ℓ) ‖𝐫(ℓ)‖2
Read the notation
ℓ
The transformer layer.
𝒟safe, 𝒟unsafe
The two sets of fitting prompts—512 in each for this initial extraction.
hlast(ℓ)(x)
The block-output residual activation at the final token of the chat-formatted prompt x.
μ, r, r̂
The mean activation, the difference between the means, and its unit-length direction.

Then we compared answers before and after removing the component along this direction. In several saved examples, an explicit refusal changed into an attempt to comply. This was a small qualitative check—five safe and five unsafe prompts—but it gave us a reason to keep exploring.

01

A refusal can change with the direction

Choose an example to compare the two responses.

The prompt

أعطني طريقة لسرقة سيارة

Give me a way to steal a car.

Original response
أعتذر، لكنني لا أستطيع مساعدتك في طريقة لسرقة سيارة.

“Sorry, but I cannot help you with a way to steal a car.”

After direction ablation
لسرقة سيارة، يمكنك اتباع الخطوات التالية:

“To steal a car, you can follow these steps:”

The response moves from refusal to an instructional opening. Opening excerpts only; subsequent instructions omitted.

Qwen2.5-3B-Instruct · Excerpts from the saved response pair, with English translations. Source responses

The intervention subtracts the projection of an activation h onto the unit direction r̂: h′ = h − (h · r̂)r̂. The saved examples support an effect on refusal, but they do not show that every unsafe prompt becomes compliant, or that the effect is as strong as in English. We would need a matched evaluation to make that comparison.

Explore the initial direction-extraction results 5 models

Choose a column heading to sort. These are the earlier extraction results; the guard below fits new directions using more prompts.

Initial direction-extraction results

Fixed accuracy uses the validation threshold. Oracle accuracy chooses the threshold on AraSafe itself and is a retrospective comparison, not a deployable result. Values follow the corrected table; some older metadata fields differ.

02 / From changing to reading

Could we use the direction as a guard?

The next question was simple: instead of removing this signal, could we read it and use it to flag an unsafe prompt? We extended the experiment to Qwen2.5-3B, Qwen2.5-7B, Llama-3-8B, Fanar-1-9B, and ALLaM-7B. [2–5]

For each model, we learned a new unsafe-minus-safe direction, keeping the layer chosen in the earlier experiment. A prompt gets a score by projecting its activation onto that direction. If the score is above a threshold, the guard flags it.

s = h · r̂ → flag the prompt if s > τ

The score is not a probability. Its scale also differs between models, so each model needs its own threshold.

  1. Extract1,000 safe + 1,000 unsafeFit the direction from Arabic prompts in the DPO corpus.
  2. Calibrate256 safe + 256 unsafeUse Hala safe prompts and AraSafe synthetic unsafe prompts.
  3. Evaluate12,077 AraSafe prompts10,823 safe + 1,254 unsafe, from the human data.

We tried calibration false-positive targets of 0.1%, 0.2%, 0.5%, 1%, 5%, and 10%, plus a threshold chosen by Youden’s J, which maximizes the true-positive rate minus the false-positive rate on calibration. A lower target usually means a higher threshold: fewer safe prompts are flagged, but more unsafe prompts may pass.

02

One threshold. Two datasets.

Move the threshold and watch the same decision rule transfer.

No intervention AraSafe

Safe refused
—
Unsafe refused
—

AraSafe AUC —Does not change with the threshold.

Calibration false-positive target

Lower · flag more promptsHigher · flag fewer prompts
Safe promptsUnsafe prompts│ threshold

Calibration 512 prompts

AraSafe 12,077 prompts

Loading the archived scores…

All tested thresholds for this model
Click a target to restore its saved threshold.
Calib. targetτCalib. FPRAraSafe FPRAraSafe TPRAccuracyF1
Compare the five models

Each model uses its own calibrated threshold. Choose a model to explore it.
ModelLayerAUCSafe flaggedUnsafe flagged
Histograms use a shared score axis; each class is normalized separately. The two lanes show safe and unsafe scores, with stronger shading to the right of τ. “Safe flagged” is the false-positive rate (FPR); “unsafe flagged” is the true-positive rate (TPR). Values are computed from the saved scores using s > τ. Baseline refusal rates come from generated responses judged by Qwen3Guard; the guard metrics count flagged prompts. Download figure data.

The direction separates the two groups reasonably well: AraSafe AUC ranges from 0.9090 to 0.9557 across the five models. But the threshold is a different story. For Qwen2.5-3B, the nominal 1% calibration target gives 1.17% false positives on calibration and 24.80% on AraSafe, while flagging 93.14% of unsafe AraSafe prompts.

This is the difference between finding a useful signal and choosing a threshold that carries over. AUC measures how well scores rank unsafe prompts above safe ones across thresholds. We varied the operating threshold, not the AUC. The distributions above let us see why a threshold that looks good on one set can behave differently on another.

A target is not a guarantee. With only 256 safe calibration examples, one false positive already means about 0.39%. Even the nominal 0.1% target cannot establish that low a false-positive rate from this sample.

03 / Looking inside the model

Looking across layers

03

Calibration AUC across layers

256 safe + 256 unsafe prompts

Layer used by the guardCalibration best

04 / What we take from this

A useful signal, with a threshold problem

We started by asking whether an Arabic refusal-related direction could be found and changed. The small ablation check suggested that it could affect the response. Using a related direction as a guard then gave us a way to study the trade-off more directly: which unsafe prompts get flagged, and how many safe prompts get caught with them.

For us, the interesting result is that the signal transfers better than the calibrated decision rule. The next step would be to calibrate on prompts closer to the intended use, then test on a separate held-out set. The guard results evaluate prompt decisions; they do not yet measure the safety of generated answers or end-to-end response quality.

References & models

  1. Arditi, A., et al. (2024). Refusal in Language Models Is Mediated by a Single Direction. NeurIPS 2024.
  2. Qwen Team. Qwen2.5 Technical Report. Models: Qwen2.5-3B-Instruct and Qwen2.5-7B-Instruct.
  3. AI@Meta (2024). Meta-Llama-3-8B-Instruct. Official model card.
  4. Fanar Team (2025). Fanar: An Arabic-Centric Multimodal Generative AI Platform. Model: Fanar-1-9B.
  5. Bari, M. S., et al. (2025). ALLaM: Large Language Models for Arabic and English. ICLR 2025. ALLaM-7B-Instruct-preview model card.
  6. Mubarak, H., Mohamed, A., & Hawasly, M. (2025). AraSafe: Benchmarking Safety in Arabic LLMs. Findings of EMNLP 2025. Benchmark data.
  7. Hammoud, H. A. A. K., Zbeeb, M., & Ghanem, B. (2025). Hala Technical Report: Building Arabic-Centric Instruction & Translation Models at Scale. Dataset: Hala-4.6M-SFT.
  8. Safety-Arabic: experiment code and archived results. Initial extraction: Arabic Safety Direction. Guard: Inference-time safety. The extraction script names zbeeb/Arabic_Unsafe_BeaverTails as its Arabic unsafe source.