The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: Schema at index 1 was different:
model_id: string
layer_patched: int64
alpha: double
v_concept_norm: double
n_train_left: int64
n_train_right: int64
n_test_right: int64
results: struct<baseline_no_patch: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, semantic_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, random_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, orthogonal_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>>
vs
model_id: string
layer_patched: int64
alpha_grid: list<item: double>
n_test_left: int64
sweep: list<item: struct<alpha: double, flipped_to_right: int64, stayed_left: int64, unknown: int64, n: int64, flip_rate: double, clean_flip_rate: double>>
best: struct<alpha: double, flip_rate: double, clean_flip_rate: double>
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1848, in _prepare_split_single
writer.write_table(table)
~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 764, in write_table
self.write_rows_on_file() # in case there are buffered rows to write first
~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 662, in write_rows_on_file
table = pa.concat_tables(self.current_rows)
File "pyarrow/table.pxi", line 6321, in pyarrow.lib.concat_tables
File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
return check_status(status)
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
raise convert_status(status)
pyarrow.lib.ArrowInvalid: Schema at index 1 was different:
model_id: string
layer_patched: int64
alpha: double
v_concept_norm: double
n_train_left: int64
n_train_right: int64
n_test_right: int64
results: struct<baseline_no_patch: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, semantic_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, random_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, orthogonal_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>>
vs
model_id: string
layer_patched: int64
alpha_grid: list<item: double>
n_test_left: int64
sweep: list<item: struct<alpha: double, flipped_to_right: int64, stayed_left: int64, unknown: int64, n: int64, flip_rate: double, clean_flip_rate: double>>
best: struct<alpha: double, flip_rate: double, clean_flip_rate: double>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1869, in _prepare_split_single
num_examples, num_bytes = writer.finalize()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 781, in finalize
self.write_rows_on_file()
~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 662, in write_rows_on_file
table = pa.concat_tables(self.current_rows)
File "pyarrow/table.pxi", line 6321, in pyarrow.lib.concat_tables
File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
raise convert_status(status)
pyarrow.lib.ArrowInvalid: Schema at index 1 was different:
model_id: string
layer_patched: int64
alpha: double
v_concept_norm: double
n_train_left: int64
n_train_right: int64
n_test_right: int64
results: struct<baseline_no_patch: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, semantic_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, random_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>, orthogonal_ablation: struct<flipped_to_left: int64, stayed_right: int64, unknown: int64, n: int64, flip_rate: double>>
vs
model_id: string
layer_patched: int64
alpha_grid: list<item: double>
n_test_left: int64
sweep: list<item: struct<alpha: double, flipped_to_right: int64, stayed_left: int64, unknown: int64, n: int64, flip_rate: double, clean_flip_rate: double>>
best: struct<alpha: double, flip_rate: double, clean_flip_rate: double>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
~~~~~~~~~~~~~~~~~~~~~~~~~^
builder, max_dataset_size_bytes=max_dataset_size_bytes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1694, in _prepare_split
for job_id, done, content in self._prepare_split_single(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1880, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
id string | prompt string | baseline_no_patch dict | semantic_ablation dict | random_ablation dict | orthogonal_ablation dict |
|---|---|---|---|---|---|
B-00041 | Kim is right of Lee.
Where is Kim? | {
"text": " Where is Lee?\nKim is right of Lee.\nWhere is",
"label": "right"
} | {
"text": " A new option, a new option, a new option,",
"label": "unknown"
} | {
"text": " Lee is right of Kim.\nLee is right of Kim.",
"label": "right"
} | {
"text": " Where is Lee? Where is Kim? Where is Lee?",
"label": "unknown"
} |
B-00081 | Alice is right of Bob.
Where is Alice? | {
"text": " \n\n1. 10 meters to the north of Bob",
"label": "unknown"
} | {
"text": " \n[A option A: left, option B: left,",
"label": "left"
} | {
"text": " \nA. To the right of Bob\nB. To",
"label": "right"
} | {
"text": " Bob is to the left of Alice.\nBob is to the",
"label": "left"
} |
B-00067 | John is right of Mary.
Where is John? | {
"text": " Mary is to the left of John.\nJohn is to the",
"label": "left"
} | {
"text": " Mary left left left left left left left left left left left",
"label": "left"
} | {
"text": " Mary is right of John. Mary is right of John.",
"label": "right"
} | {
"text": " Where is Mary? John is right of Mary. Where is",
"label": "right"
} |
B-00007 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00044 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00091 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00169 | Alice is right of Bob.
Where is Alice? | {
"text": " \n\n1. 10 meters to the north of Bob",
"label": "unknown"
} | {
"text": " \n[A option A: left, option B: left,",
"label": "left"
} | {
"text": " \nA. To the right of Bob\nB. To",
"label": "right"
} | {
"text": " Bob is to the left of Alice.\nBob is to the",
"label": "left"
} |
B-00086 | Alice is right of Bob.
Where is Alice? | {
"text": " \n\n1. 10 meters to the north of Bob",
"label": "unknown"
} | {
"text": " \n[A option A: left, option B: left,",
"label": "left"
} | {
"text": " \nA. To the right of Bob\nB. To",
"label": "right"
} | {
"text": " Bob is to the left of Alice.\nBob is to the",
"label": "left"
} |
B-00171 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00062 | Kim is right of Lee.
Where is Kim? | {
"text": " Where is Lee?\nKim is right of Lee.\nWhere is",
"label": "right"
} | {
"text": " A new option, a new option, a new option,",
"label": "unknown"
} | {
"text": " Lee is right of Kim.\nLee is right of Kim.",
"label": "right"
} | {
"text": " Where is Lee? Where is Kim? Where is Lee?",
"label": "unknown"
} |
B-00143 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00111 | Kim is right of Lee.
Where is Kim? | {
"text": " Where is Lee?\nKim is right of Lee.\nWhere is",
"label": "right"
} | {
"text": " A new option, a new option, a new option,",
"label": "unknown"
} | {
"text": " Lee is right of Kim.\nLee is right of Kim.",
"label": "right"
} | {
"text": " Where is Lee? Where is Kim? Where is Lee?",
"label": "unknown"
} |
B-00159 | Kim is right of Lee.
Where is Kim? | {
"text": " Where is Lee?\nKim is right of Lee.\nWhere is",
"label": "right"
} | {
"text": " A new option, a new option, a new option,",
"label": "unknown"
} | {
"text": " Lee is right of Kim.\nLee is right of Kim.",
"label": "right"
} | {
"text": " Where is Lee? Where is Kim? Where is Lee?",
"label": "unknown"
} |
B-00165 | Kim is right of Lee.
Where is Kim? | {
"text": " Where is Lee?\nKim is right of Lee.\nWhere is",
"label": "right"
} | {
"text": " A new option, a new option, a new option,",
"label": "unknown"
} | {
"text": " Lee is right of Kim.\nLee is right of Kim.",
"label": "right"
} | {
"text": " Where is Lee? Where is Kim? Where is Lee?",
"label": "unknown"
} |
B-00093 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00014 | Alice is right of Bob.
Where is Alice? | {
"text": " \n\n1. 10 meters to the north of Bob",
"label": "unknown"
} | {
"text": " \n[A option A: left, option B: left,",
"label": "left"
} | {
"text": " \nA. To the right of Bob\nB. To",
"label": "right"
} | {
"text": " Bob is to the left of Alice.\nBob is to the",
"label": "left"
} |
B-00064 | Alice is right of Bob.
Where is Alice? | {
"text": " \n\n1. 10 meters to the north of Bob",
"label": "unknown"
} | {
"text": " \n[A option A: left, option B: left,",
"label": "left"
} | {
"text": " \nA. To the right of Bob\nB. To",
"label": "right"
} | {
"text": " Bob is to the left of Alice.\nBob is to the",
"label": "left"
} |
B-00187 | Alice is right of Bob.
Where is Alice? | {
"text": " \n\n1. 10 meters to the north of Bob",
"label": "unknown"
} | {
"text": " \n[A option A: left, option B: left,",
"label": "left"
} | {
"text": " \nA. To the right of Bob\nB. To",
"label": "right"
} | {
"text": " Bob is to the left of Alice.\nBob is to the",
"label": "left"
} |
B-00192 | John is right of Mary.
Where is John? | {
"text": " Mary is to the left of John.\nJohn is to the",
"label": "left"
} | {
"text": " Mary left left left left left left left left left left left",
"label": "left"
} | {
"text": " Mary is right of John. Mary is right of John.",
"label": "right"
} | {
"text": " Where is Mary? John is right of Mary. Where is",
"label": "right"
} |
B-00080 | Tom is right of Sue.
Where is Tom? | {
"text": " Sue is to the left of Tom.\nTom is to the",
"label": "left"
} | {
"text": " A) left end B) left end left end left end",
"label": "left"
} | {
"text": " A) To the right of Sue B) To the right",
"label": "right"
} | {
"text": " Where is Sue? Where is Tom? Where is Sue?",
"label": "unknown"
} |
B-00147 | John is right of Mary.
Where is John? | {
"text": " Mary is to the left of John.\nJohn is to the",
"label": "left"
} | {
"text": " Mary left left left left left left left left left left left",
"label": "left"
} | {
"text": " Mary is right of John. Mary is right of John.",
"label": "right"
} | {
"text": " Where is Mary? John is right of Mary. Where is",
"label": "right"
} |
null | null | null | null | null | null |
null | null | null | null | null | null |
B-00087 | John is left of Mary.
Where is John? | {
"text": " John is left of Mary.\nJohn is left of Mary.\n",
"label": "left"
} | null | null | null |
B-00038 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00079 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00011 | John is left of Mary.
Where is John? | {
"text": " John is left of Mary.\nJohn is left of Mary.\n",
"label": "left"
} | null | null | null |
B-00054 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00029 | Alice is left of Bob.
Where is Alice? | {
"text": " \n[A] Left of Bob \n[B] Right of Bob",
"label": "left"
} | null | null | null |
B-00056 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00068 | Kim is left of Lee.
Where is Kim? | {
"text": " (A) In the room. (B) In the",
"label": "unknown"
} | null | null | null |
B-00006 | Kim is left of Lee.
Where is Kim? | {
"text": " (A) In the room. (B) In the",
"label": "unknown"
} | null | null | null |
B-00167 | Kim is left of Lee.
Where is Kim? | {
"text": " (A) In the room. (B) In the",
"label": "unknown"
} | null | null | null |
B-00102 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00158 | Alice is left of Bob.
Where is Alice? | {
"text": " \n[A] Left of Bob \n[B] Right of Bob",
"label": "left"
} | null | null | null |
B-00172 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00118 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00170 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00199 | Tom is left of Sue.
Where is Tom? | {
"text": " \n[A] to the left of Sue \n[B] to",
"label": "left"
} | null | null | null |
B-00140 | John is left of Mary.
Where is John? | {
"text": " John is left of Mary.\nJohn is left of Mary.\n",
"label": "left"
} | null | null | null |
B-00146 | Kim is left of Lee.
Where is Kim? | {
"text": " (A) In the room. (B) In the",
"label": "unknown"
} | null | null | null |
B-00002 | John is left of Mary.
Where is John? | {
"text": " John is left of Mary.\nJohn is left of Mary.\n",
"label": "left"
} | null | null | null |
null | null | null | null | null | null |
Tracking and Intervening on Latent State Dynamics in a Small Language Agent (MiniCPM5-2B)
Date: 2026-09-17 Model studied: openbmb/MiniCPM5-2B (2.52B params, 42 layers, hidden dim 2048) Hardware: single RTX 3070 Ti (8GB) — all experiments run on consumer-grade hardware
Summary
We ask whether a small (2.5B-parameter) language model's hidden-state trajectory during generation contains a stable, low-dimensional structure that (a) is linearly decodable into task type and answer correctness, (b) is causally sufficient to flip the model's output when patched, and (c) changes measurably across pretraining → mid-training → SFT → final post-training stages.
Using MiniCPM5-2B's full four-checkpoint lineage (uniquely public for a model this size) and 1,000 controlled paired prompts across five task families (arithmetic, spatial reasoning, multi-step chaining, contradiction, and distractor memory), we find:
- A single principal component explains only 17.95% of last-layer hidden-state variance at n=1000 (top-10 components: 54.1% cumulative) — structure exists but is not low-rank-dominant.
- A linear probe recovers answer correctness at 100% accuracy / AUROC 1.0, including on a class-balanced variant that rules out imbalance as the driver.
- A single concept direction (v = mean(H_right) − mean(H_left)) patched into the last transformer layer causally flips left→right answers at 100% clean-flip-rate for α∈[2.5, 3.0], degrading to output collapse above α=4.0, while random and orthogonal control directions produce 0% flips at the same magnitude.
- Across the four checkpoints, PCA concentration and mean token-to-token hidden-state distance decrease monotonically with training progress, while causal intervention sensitivity (flip rate) is non-monotonic — it peaks at Midtrain (100%), dips at SFT (70%), and recovers at the final checkpoint (100%). This SFT dip is, to our knowledge, not reported in prior single-checkpoint latent-intervention work.
Full paper writeup: see paper.md in this repository (includes Method, Related Work, and Limitations).
Contents
paper.md— full research writeup (Abstract through Conclusion, with Related Work and Limitations)figures/— 5 result figures (PCA scatter/scree, distance histogram, alpha sweep, negative controls)results/h3_alpha_sweep.json— full alpha-sweep flip-rate data (raw + clean, per alpha value)results/h3_results.json— H3 causal intervention baseline resultsresults/h3_examples.json— example generations under interventioncode/— analysis and intervention scripts (dataset generation, hidden-state extraction, trajectory analysis, causal intervention, alpha sweep, checkpoint comparison, figure generation)
Method (brief)
Concept direction v = mean(H_right) − mean(H_left), computed from the B (spatial) task family's paired train split (76 left / 84 right). Patched at generation time as a forward hook on the last transformer layer, adding α·v to the residual stream. Evaluated on a held-out set of LEFT-labeled prompts (n=19).
Negative controls: random direction and orthogonal direction, tested at α=4.0 alongside the semantic direction.
Related work
- Representation Engineering (RepE) — Zou et al., arXiv:2310.01405
- Contrastive Activation Addition (CAA) — Rimsky et al., arXiv:2312.06681 (this work's direction-extraction formula is a direct instance of CAA's method)
- Refusal is mediated by a single direction — Arditi et al., arXiv:2406.11717
- ICR Probe — ACL 2025, aclanthology.org/2025.acl-long.880
- Spatiotemporal Hidden-State Dynamics / StALT — arXiv:2605.01853
- Invariant Reasoning Directions / TILR — arXiv:2606.29164
Limitations (honest, see paper.md for full list)
- Checkpoint comparison uses a smaller N (100 paired samples) than Phase 1 (n=1000) due to hardware constraints.
- Negative controls tested at a single α value (4.0), not swept across the full range.
- The SFT-dip mechanism is observed but not yet mechanistically explained (cosine similarity between per-checkpoint concept vectors not yet computed).
- Single model family (MiniCPM5-2B) — findings, especially the checkpoint comparison, are not yet shown to generalize.
- A companion task-family probe (99.5% accuracy) is confounded by surface lexical markers and is not treated as evidence that the latent state encodes task identity — see paper.md §3.4 for full disclosure.
Citation
No formal citation identifier (arXiv ID) yet available — this is an independent research project shared directly via Hugging Face while arXiv endorsement is pending. If you build on this work, please link back to this dataset repository.
Contact
Questions or interested in endorsing this work for arXiv submission (cs.LG/cs.CL)? Open a discussion on this repository.
- Downloads last month
- 57