File size: 9,862 Bytes
40baa4d
4ddcb05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40baa4d
 
 
 
4ddcb05
 
 
40baa4d
4ddcb05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e19951b
4ddcb05
 
 
 
 
 
 
 
 
 
 
 
 
 
40baa4d
4ddcb05
40baa4d
4ddcb05
 
 
40baa4d
4ddcb05
40baa4d
4ddcb05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40baa4d
2f40c64
40baa4d
4ddcb05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c989800
4ddcb05
 
 
 
 
 
 
 
 
 
 
40baa4d
 
 
 
4ddcb05
2f40c64
4ddcb05
 
 
 
40baa4d
 
4ddcb05
 
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
---
license: apache-2.0
task_categories:
  - text-classification
language:
  - en
tags:
  - benchmark
  - pooling-strategies
  - representation-learning
  - mechanistic-interpretability
  - probing
  - steering-vectors
pretty_name: PoolBench
size_categories:
  - 10K<n<100K
---

# PoolBench

**PoolBench** is a diagnostic benchmark for evaluating pooling strategies in decoder-only large language models.
Every embedding pipeline implicitly chooses a pooling strategy — last token, mean pooling, attention-weighted, etc. — yet this choice is almost never studied systematically.
PoolBench provides the first controlled, multi-concept, multi-model evaluation framework for this decision.

---

## What is a pooling strategy?

A *pooling strategy* is a function that maps a sequence of per-token hidden states
This vector is then used for classification, similarity search, or steering.
PoolBench asks: *which pooling strategy best captures a given semantic concept in a given model at a given layer?*

---

## Benchmark overview

| Dimension | Value |
|---|---|
| Pooling strategies evaluated | 19 (18 unsupervised + 1 supervised) |
| Semantic concepts | 17 |
| Models | Llama-3.1-8B, Gemma-2-9B, Mistral-7B-v0.3 |
| Evaluation metrics | D1 AUROC · D2 SCP · D3 Disentanglement |
| Corpus size | 1,000 passages/concept (700 train + 300 test, balanced pos/neg) |
| Token window | 300–500 tokens (LLaMA-3.1-8B BPE tokenizer) |
| Total passages | ~37,693 |

---

## The 17 Concepts

Concepts span five linguistic families, chosen to cover a range of signal density and linguistic depth:

| Family | Concepts |
|---|---|
| Sparse-lexical | `hedging`, `legal_formality`, `frustration`, `numerical_precision` |
| Dense-lexical | `imdb_sentiment`, `toxicity`, `depression` |
| Syntactic/discourse | `causation`, `contrast`, `conditionality`, `negation_density` |
| Register | `academic_tone`, `code_docs`, `bureaucratic`, `narrative` |
| Semantic-abstract | `deference`, `planning` |

**Sensitive concepts:** `toxicity` and `depression` are included in all metric computations but their steered text outputs are withheld from public release (available on request for research use).

---

## The 19 Pooling Strategies

| Family | Strategy ID | Description |
|---|---|---|
| Position-anchored | `P1_last_token` | Final non-padding token |
| | `P2_first_token` | First token (BOS position) |
| Uniform aggregation | `A1_mean` | Arithmetic mean over all tokens |
| | `A2_max` | Element-wise max |
| | `A3_min` | Element-wise min |
| | `A4_norm_weighted` | Token-norm weighted mean |
| Window | `W1_first_k` | Mean of first *k* tokens |
| | `W2_last_k` | Mean of last *k* tokens |
| | `W3_middle_k` | Mean of middle *k* tokens |
| | `W4_hierarchical` | Chunk → mean → aggregate |
| Saliency-weighted | `S1_attention` | Attention-score weighted mean |
| | `S2_gradient` | Gradient-norm weighted mean |
| | `S3_iti_probe` | Supervised ITI head-based pooling |
| Structural-linguistic | `L1_pos_filtered` | Content POS tags only (NOUN, VERB, ADJ, ADV) |
| | `L2_dependency_rel` | Dependency-arc triggered tokens |
| | `L3_entity` | Named entity spans |
| | `L4_clause` | Clause-boundary segmentation |
| | `L5_keyword` | TF-IDF top-k keywords |
| | `L6_sentence` | Sentence-boundary segments |

---

## Evaluation Dimensions

### D1 — Concept Separability (AUROC)
Linear probe AUROC measuring how well a pooling strategy separates positive from negative passages for each concept.
Training: 5-fold OOF on 700 train passages per class.
No labels from the test split are used for D1 training.

### D2 — Steered Concept Prevalence (SCP)
Measures whether a pooling strategy's steering vector (DiffMean) actually *steers* generated text toward the target concept.
A Classifier B (fine-tuned BERT) scores each steered generation.
SCP = correlation between alpha (steering strength) and Classifier B score.

### D3 — Disentanglement
Measures whether steering toward concept A avoids contaminating a linguistically-distant (LD) and linguistically-close (LC) neighbour concept.

$$\text{Disent}_c = 1 - \frac{\Delta_B}{\Delta_A}$$

Where $\Delta_A$ = SCP on target concept, $\Delta_B$ = SCP on neighbour concept under the same steering vector.

---

## Dataset Structure

```
poolbench/
  {concept}/
    train_pos.jsonl    # 700 positive training passages
    train_neg.jsonl    # 700 negative training passages
    test_pos.jsonl     # 300 positive test passages
    test_neg.jsonl     # 300 negative test passages
```

Each JSONL record:
```json
{
  "id": "academic_tone_train_pos_0001",
  "text": "...",
  "label": 1,
  "domain": "academic",
  "token_count": 347,
  "matched_pair_id": null,
  "split": "train"
}
```

Fields:
- `id` — unique identifier with concept, split, class, and index
- `text` — passage text (300–500 LLaMA-3.1-8B tokens except `toxicity`/`deference`)
- `label` — 1 = positive, 0 = negative
- `domain` — source domain (e.g., `academic`, `news`, `social`, `legal_us`)
- `token_count` — exact token count under LLaMA-3.1-8B tokenizer
- `matched_pair_id` — non-null for matched-pair concepts (negative is a controlled rewrite of the positive)
- `split``train` or `test`

---

## Corpus Construction

Positive and negative passages were constructed under strict controls:

- **700/700 train, 300/300 test per concept** — balanced classes to avoid probe bias
- **300–500 token window** — enforced by LLaMA-3.1-8B BPE tokenizer at build time
- **≥3 source domains per concept** — prevents domain vocabulary from confounding pooling strategy comparisons
- **±25 token matching rule** — for matched-pair concepts, the positive and its negative rewrite differ by ≤25 tokens
- **MD5-based deduplication** — within-class, cross-class, and train/test leak checks
- **Seed-word contamination filter** — negatives must not contain the concept's seed words

See the [GitHub repository](https://github.com/2023mc21517-arch/poolbench) for full construction notes and per-concept source tables.

### Source datasets

| Concept family | Sources |
|---|---|
| Academic/Scientific | `gfissore/arxiv-abstracts-2021`, `qiaojin/PubMedQA` |
| Legal/Government | `lex_glue` (scotus, eurlex), `FiscalNote/billsum` |
| News | `cc_news` |
| Social | `sentence-transformers/reddit`, `Yelp/yelp_review_full` |
| Math | `meta-math/MetaMathQA`, `AI-MO/NuminaMath-CoT` |
| Code | `code_search_net` (python, java, javascript, ruby) |
| Sentiment/Toxicity | `yin001/imdb_dataset_positive_negative`, `tdavidson/hate_speech_offensive`, `google/civil_comments`, Surge-AI toxicity CSV |
| Depression | `mrjunos/depression-reddit-cleaned`, `dlb/mentalreddit` |
| Politeness | `Intel/polite-guard` |
| How-to | `gursi26/wikihow-cleaned` |

---

## Quick Start

```python
from datasets import load_dataset

# Load one concept
ds = load_dataset("nips234678/poolbench", data_dir="academic_tone")

# Load all concepts
from pathlib import Path
concepts = [
    "academic_tone", "bureaucratic", "causation", "code_docs",
    "conditionality", "contrast", "deference", "depression",
    "frustration", "hedging", "imdb_sentiment", "legal_formality",
    "narrative", "negation_density", "numerical_precision",
    "planning", "toxicity",
]
for concept in concepts:
    ds = load_dataset("nips234678/poolbench", data_dir=concept)
```

To reproduce the full pipeline from activations to leaderboard:
```bash
git clone https://github.com/2023mc21517-arch/poolbench.git
cd poolbench
pip install -e ".[dev]"

# Download corpus
huggingface-cli download nips234678/poolbench --repo-type dataset --local-dir data/corpora

# Run full pipeline (requires GPU, ~8h per model on A100)
python scripts/run_model.py --model mistral7b --device cuda:0
```

---

## Related Artifacts

| Artifact | Link | Contents |
|---|---|---|
| BERT Scorer Models (D2) | [nips234678/poolbench-bert-scorers](https://huggingface.co/nips234678/poolbench-bert-scorers) | 17 fine-tuned BERT classifiers (one per concept) used as Classifier B for D2 SCP scoring |
| Activation Files | [nips234678/poolbench-activations](https://huggingface.co/datasets/nips234678/poolbench-activations) | Per-model per-layer hidden states (.npy) for all 3 models — enables D1 evaluation without re-running inference (~390 GB) |
| Steered Outputs | [nips234678/poolbench-steered-outputs](https://huggingface.co/datasets/nips234678/poolbench-steered-outputs) | Generated texts from D2 SCP evaluation for 15 non-sensitive concepts across all 3 models |
| Code & Leaderboard | [GitHub](https://anonymous.4open.science/r/poolbench-B36C) | Evaluation pipeline, pooling strategy implementations, community submission workflow |

---

## Ethical Considerations

- **Toxicity and depression concepts** include passages containing toxic language and expressions of psychological distress, respectively. These are sourced from publicly available datasets with established research use. Steered text outputs for these two concepts are withheld from public release.
- **No personal information** — all passages are sourced from public corpora with no PII.
- **Model outputs** — steered generation outputs are research artifacts demonstrating steering vector magnitude effects; they are not endorsements of the content.
- **Intended use** — evaluation of pooling strategies in language model representations. Not intended for clinical use, content moderation in production, or as training data for generation models.

---

## Citation

```bibtex
@dataset{poolbench2026,
  title        = {{PoolBench}: A Benchmark for Pooling Strategies in Decoder-Only Language Models},
  author       = {Anonymous},
  year         = {2026},
  publisher    = {HuggingFace},
  url          = {https://huggingface.co/datasets/nips234678/poolbench},
}
```

*Citation will be updated with full author list and DOI upon paper acceptance.*