File size: 7,377 Bytes
e9a8ccd 88c8525 afddf54 88c8525 8834036 88c8525 8834036 88c8525 8834036 88c8525 afddf54 88c8525 afddf54 8834036 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 c6ddc71 afddf54 c6ddc71 afddf54 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 88c8525 afddf54 8834036 afddf54 e9412b4 afddf54 e9412b4 88c8525 e9412b4 88c8525 e9412b4 88c8525 afddf54 e9412b4 afddf54 6534837 afddf54 8834036 | 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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | ---
license: apache-2.0
library_name: pytorch
pipeline_tag: text-generation
tags:
- attention-steering
- interpretability
- KV-editing
---
<div align="center">
<picture>
<img src="assets/logo.png" width="20%" alt="PRISM-Delta">
</picture>
</div>
<div align="center">
<h2>Prism-Δ: Differential Subspace Steering for Prompt Highlighting in Large Language Models</h2>
</div>
<hr>
<div align="center" style="line-height:1">
<a href="https://arxiv.org/abs/2603.10705" target="_blank"><img alt="arXiv" src="https://img.shields.io/badge/arXiv-2603.10705-b31b1b?logo=arxiv&logoColor=white"/></a>
<a href="https://github.com/YuyaoGe/PRISM-DELTA" target="_blank"><img alt="Code" src="https://img.shields.io/badge/Code-PRISM--DELTA-181717?logo=github&logoColor=white"/></a>
<a href="https://huggingface.co/papers/2603.10705" target="_blank"><img alt="Paper page" src="https://img.shields.io/badge/%F0%9F%A4%97%20Paper-2603.10705-ffc107?color=ffc107&logoColor=white"/></a>
</div>
<div align="center" style="line-height:1">
<a href="https://arxiv.org/pdf/2603.10705" target="_blank"><img alt="PDF" src="https://img.shields.io/badge/PDF-Full%20Paper-white?logo=adobeacrobatreader&logoColor=red"/></a>
<a href="#citation"><img alt="Venue" src="https://img.shields.io/badge/COLM-2026-1783ff?color=1783ff&logoColor=white"/></a>
<a href="https://huggingface.co/YuyaoGe/Prism_Delta/blob/main/README.md"><img alt="License" src="https://img.shields.io/badge/License-Apache--2.0-f5de53?&color=f5de53"/></a>
</div>
<br>
<p align="center">
📄 <a href="https://arxiv.org/abs/2603.10705">Paper</a>
|
💻 <a href="https://github.com/YuyaoGe/PRISM-DELTA">Code</a>
|
📦 <a href="https://huggingface.co/YuyaoGe/Prism_Delta">Projections</a>
</p>
---
## Introduction
**PRISM-Δ** (*Projection-based Relevance-Informed Steering Method*) makes a language
model prioritize the spans a user has highlighted, without any training.
PRISM-Δ instead decomposes the **difference** between the positive
and negative cross-covariance matrices, which cancels that shared structure and
leaves only what discriminates. Each attention head then receives a continuous
softplus weight, so a weak-but-useful head contributes at reduced strength rather
than being switched off by a threshold. The same framework extends from the Key
(routing) channel to the Value (content) channel, giving **PRISM-ΔV**.
This repository holds the **precomputed projection matrices**, so you can reproduce
the reported numbers without rebuilding them. Building from scratch takes 3–8
minutes per model on a single GPU if you would rather do that.
## Contents
```
projections/
├── biasbios/ # occupation prediction from highlighted biographies
├── counterfact/ # knowledge-conflict resolution
└── pronoun/ # gender-neutral pronoun rewriting
└── <model>/
├── <model>_diff_proj.pt # PRISM-Δ — differential Key projection
├── <model>_kv_diff_proj.pt # PRISM-ΔV — differential Key + Value projection
├── <model>_pos_proj.pt # positive-condition projection (baseline / ablation)
└── <model>_neg_proj.pt # negative-condition projection (baseline / ablation)
```
All three benchmarks carry the same five models: `Qwen3-4B-Base`, `Qwen3-8B-Base`, `Qwen3-14B-Base`, `gemma-3-4b-pt` and `gemma-3-12b-pt`.
Reach for `diff_proj` if you want the Key-only variant and `kv_diff_proj` for the dual-channel one. The `pos_proj` / `neg_proj` pair is the independent decomposition that the SEKA baseline runs on, and that the ablation isolating the differential step needs.
## Quick Start
```bash
git clone https://github.com/YuyaoGe/PRISM-DELTA && cd PRISM-DELTA
pip install -r requirements.txt
git clone https://huggingface.co/YuyaoGe/Prism_Delta ./prism-projections
export PYTHONPATH=$(pwd)
```
**PRISM-Δ** (Key-only):
```bash
python benchmarks/eval_bias_gen.py \
--model <path-to-Qwen3-4B-Base> \
--data_path <path-to-biasbios.json> \
--output_dir ./results/prism-k \
--overwrite_output_dir --batch_size 256 --max_new_tokens 64 \
--wd-seka \
--wd-seka-proj ./prism-projections/projections/biasbios/Qwen3-4B-Base/Qwen3-4B-Base_diff_proj.pt \
--wd-seka-gain 0.40 --layers all
```
**PRISM-ΔV** (Key + Value):
```bash
python benchmarks/eval_bias_gen.py \
--model <path-to-Qwen3-4B-Base> \
--data_path <path-to-biasbios.json> \
--output_dir ./results/prism-kv \
--overwrite_output_dir --batch_size 256 --max_new_tokens 64 \
--kv-seka \
--kv-seka-proj ./prism-projections/projections/biasbios/Qwen3-4B-Base/Qwen3-4B-Base_kv_diff_proj.pt \
--kv-seka-gain-k 0.40 --kv-seka-gain-v 0.10 --layers all
```
Evaluation data is not redistributed here. Get BiasBios, CounterFact (`pasta_bench`) and Pronoun Change from the original release: [waylonli/SEKA-datasets](https://huggingface.co/datasets/waylonli/SEKA-datasets).
## Gains
The variance-retention threshold γ and the discriminability floor δ_min are baked
into the projections you download here, so the only thing left to set is the gain.
Pass `--wd-seka-gain` for PRISM-Δ, and `--kv-seka-gain-k` / `--kv-seka-gain-v` for
PRISM-ΔV. These are the validation-selected values behind the reported results.
| Benchmark | Model | g_K (Δ) | g_K (ΔV) | g_V (ΔV) |
|---|---|---|---|---|
| BiasBios | Qwen3-4B-Base | 0.40 | 0.40 | 0.10 |
| BiasBios | Qwen3-8B-Base | 0.40 | 0.40 | 0.10 |
| BiasBios | Qwen3-14B-Base | 0.40 | 0.40 | 0.10 |
| BiasBios | gemma-3-4b-pt | 0.50 | 0.30 | 0.10 |
| BiasBios | gemma-3-12b-pt | 0.40 | 0.40 | 0.10 |
| CounterFact | Qwen3-4B-Base | 1.90 | 1.90 | 0.02 |
| CounterFact | Qwen3-8B-Base | 2.70 | 2.70 | 0.05 |
| CounterFact | Qwen3-14B-Base | 3.00 | 3.00 | 0.05 |
| CounterFact | gemma-3-4b-pt | 6.00 | 6.00 | 0.10 |
| CounterFact | gemma-3-12b-pt | 1.10 | 3.00 | 0.50 |
| Pronoun Change | Qwen3-4B-Base | 0.15 | 0.15 | 0.05 |
| Pronoun Change | Qwen3-8B-Base | 0.05 | 0.05 | 0.02 |
| Pronoun Change | Qwen3-14B-Base | 0.05 | 0.05 | 0.02 |
| Pronoun Change | gemma-3-4b-pt | 0.30 | 0.30 | 0.10 |
| Pronoun Change | gemma-3-12b-pt | −0.30 | 0.05 | 0.02 |
A negative g_K, as on `gemma-3-12b-pt` for Pronoun Change, is expected: the edit
rescales the projected component rather than amplifying it, and which sign helps is
decided per configuration on validation data.
If you are rebuilding projections rather than using these, the γ and δ_min for every
configuration are in the paper's appendix.
## Citation
```bibtex
@misc{ge2026prism,
title = {Prism-$\Delta$: Differential Subspace Steering for Prompt
Highlighting in Large Language Models},
author = {Yuyao Ge and Shenghua Liu and Yiwei Wang and Baolong Bi and
Lingrui Mei and Jiayu Yao and Jiafeng Guo and Xueqi Cheng},
year = {2026},
eprint = {2603.10705},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
url = {https://arxiv.org/abs/2603.10705}
}
```
## Acknowledgments
Built on [SEKA](https://github.com/waylonli/SEKA), [SEA-LLM](https://github.com/yfqiu-nlp/sea-llm), [PASTA](https://github.com/QingruZhang/PASTA), and [Selective Prompt Anchoring](https://github.com/magic-YuanTian/Selective-Prompt-Anchoring).
|