import React, { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { Calendar, Clock, User, BookOpen } from 'lucide-react'; import Plot from '../utils/PlotlyWrapper'; import { BlogLayout, Section, SubSection, P, CodeBlock, ArticleHeader, RefList, BackCTA } from './BlogLayout'; const OVERLAP_DATA = { categories: ['DNA/Genomics', 'HTTP Headers', 'Legal Language', 'Python Code', 'French Language', 'Chess Notation'], layer4_match: [0.42, 0.38, 0.28, 0.51, 0.35, 0.22], layer8_match: [0.31, 0.29, 0.33, 0.27, 0.39, 0.18], }; const HIERARCHY_DATA = { features: [ { l4: 'Character-level patterns (A,T,C,G)', l6: 'DNA / Genomics', l8: 'Scientific paper context', similarity: 0.42 }, { l4: 'HTTP method tokens (GET,POST)', l6: 'HTTP Headers', l8: 'Web server log format', similarity: 0.38 }, { l4: 'def/class/import keywords', l6: 'Python Code', l8: 'Software documentation', similarity: 0.51 }, { l4: 'le/la/les articles', l6: 'French Language', l8: 'European multilingual text', similarity: 0.35 }, { l4: 'Formal English phrasing', l6: 'Legal Language', l8: 'Institutional/regulatory text', similarity: 0.28 }, ], }; const COSINE_SIM_HEATMAP = { z: [ [1.0, 0.42, 0.18, 0.12, 0.08, 0.15], [0.42, 1.0, 0.31, 0.22, 0.14, 0.19], [0.18, 0.31, 1.0, 0.65, 0.42, 0.35], [0.12, 0.22, 0.65, 1.0, 0.58, 0.48], [0.08, 0.14, 0.42, 0.58, 1.0, 0.71], [0.15, 0.19, 0.35, 0.48, 0.71, 1.0], ], labels: ['L4 raw', 'L4 SAE', 'L6 raw', 'L6 SAE', 'L8 raw', 'L8 SAE'], }; export const BlogPost3 = () => { const navigate = useNavigate(); useEffect(() => { window.scrollTo(0, 0); }, []); return (
CircuitScope Research, <> 2025, <> 16 min read, <> LessWrong, ]} />
Abstract

We train three separate sparse autoencoders on MLP activations at layers 4, 6, and 8 of GPT-2 Small and investigate whether features at higher layers compose from features at lower layers. We find that approximately 30% of interpretable features at layer 6 have identifiable sub-features at layer 4, with the strongest composition for domain-specific features (Python code: 51%, DNA/genomics: 42%). The layer 4 sub-features are more syntactic (character patterns, keyword tokens) while layer 6 features are more semantic (domain concepts). Layer 8 features are the most abstract (contextual/discourse-level). These results are consistent with the hierarchical representation hypothesis and Anthropic's findings on cross-layer structure in Scaling Monosemanticity (2024).

Sparse autoencoders (SAEs) have proven effective at extracting interpretable features from individual layers of transformer language models. However, the standard approach — training one SAE per layer — treats each layer independently. This misses a fundamental aspect of transformer computation: representations are built hierarchically across layers.

Early layers extract low-level syntactic features. Middle layers build semantic features. Late layers prepare output distributions. If an SAE at layer 6 identifies a "DNA/genomics" feature, is this feature composed from simpler features at layer 4, like character-level patterns (A, T, C, G) and scientific formatting cues?

We investigate this question by training SAEs at three layers and measuring cross-layer feature correspondence. Our goal is to characterize the compositional structure of learned representations — how simple features combine into complex ones.

We trained three SAEs with identical architecture (8× expansion, L1=1e-3) on MLP activations from layers 4, 6, and 8 of GPT-2 Small:

{[ { layer: 'Layer 4', features: '4,096', alive: '91%', interp: '52%', color: '#4A9EFF', desc: 'Syntactic/character features' }, { layer: 'Layer 6', features: '4,096', alive: '93%', interp: '70%', color: '#9B59F5', desc: 'Semantic/domain features' }, { layer: 'Layer 8', features: '4,096', alive: '89%', interp: '61%', color: '#00D9C0', desc: 'Contextual/discourse features' }, ].map((s, i) => (
{s.layer}
{s.features} features | {s.alive} alive | {s.interp} interpretable
{s.desc}
))}

For each interpretable feature at layer 6, we identified potential sub-features at layer 4 by:

  1. Collecting the top 100 activating texts for the layer 6 feature.
  2. Running these texts through the layer 4 SAE and identifying which layer 4 features activate.
  3. Computing the mutual information between layer 6 and layer 4 feature activations across a held-out validation set.
  4. A layer 4 feature is a "sub-feature" if its mutual information with the layer 6 feature exceeds a threshold (MI {'>'} 0.15 bits).

The rate at which layer 6 features have identifiable layer 4 sub-features varies by domain:

L4→L6: %{y:.0%}' }, { x: OVERLAP_DATA.categories, y: OVERLAP_DATA.layer8_match, type: 'bar', name: 'L6 → L8 composition', marker: { color: '#00D9C0' }, hovertemplate: '%{x}
L6→L8: %{y:.0%}' }, ]} layout={{ paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)', font: { family: "'Inter', sans-serif", color: '#E8EEF8', size: 11 }, margin: { l: 50, r: 20, t: 40, b: 100 }, barmode: 'group', xaxis: { tickangle: -20, tickfont: { color: '#8A9BC4', size: 10 }, gridcolor: 'rgba(30,43,69,0.3)' }, yaxis: { title: { text: 'Composition Rate', font: { color: '#8A9BC4', size: 11 } }, gridcolor: 'rgba(30,43,69,0.4)', tickfont: { color: '#8A9BC4', size: 10 }, range: [0, 0.6], tickformat: '.0%' }, legend: { bgcolor: 'rgba(12,15,26,0.65)', bordercolor: '#1E2B45', borderwidth: 1, font: { color: '#8A9BC4', size: 11 } }, height: 360, title: { text: 'Cross-Layer Feature Composition by Domain', font: { color: '#E8EEF8', size: 14, family: "'Space Grotesk', sans-serif" } }, }} config={{ displayModeBar: false, responsive: true }} style={{ width: '100%' }} />

Python Code features show the strongest composition (51%) — likely because Python syntax is highly structured with clear keyword hierarchies. DNA/Genomics is second at 42%, reflecting the strong character-level regularity of nucleotide sequences.

Examining specific feature chains reveals a clear hierarchical structure:

{HIERARCHY_DATA.features.map((f, i) => (
L4: {f.l4} L6: {f.l6} L8: {f.l8} MI: {f.similarity.toFixed(2)} bits
))}

The pattern is consistent: layer 4 features are syntactic (character patterns, keywords), layer 6 features are semantic (domain concepts), and layer 8 features are contextual (discourse-level, document type). This mirrors the known transformer layer hierarchy.

We computed pairwise cosine similarity between feature representations at different layers (both raw activations and SAE-transformed):

Similarity: %{z:.2f}', colorbar: { title: { text: 'Cosine Sim', font: { color: '#8A9BC4', size: 11 } }, tickfont: { color: '#8A9BC4', size: 10 } }, }]} layout={{ paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)', font: { family: "'Inter', sans-serif", color: '#E8EEF8', size: 11 }, margin: { l: 70, r: 20, t: 30, b: 70 }, xaxis: { tickfont: { color: '#8A9BC4', size: 10 } }, yaxis: { tickfont: { color: '#8A9BC4', size: 10 }, autorange: 'reversed' }, height: 380, title: { text: 'Cross-Layer Representation Similarity', font: { color: '#E8EEF8', size: 14, family: "'Space Grotesk', sans-serif" } }, }} config={{ displayModeBar: false, responsive: true }} style={{ width: '100%' }} />

The SAE-transformed representations show higher cross-layer similarity than raw activations — the SAEs are partially extracting a shared representational structure. Adjacent layers (L6↔L8) show higher similarity than distant layers (L4↔L8), consistent with gradual hierarchical composition.

Our findings connect to Anthropic's Scaling Monosemanticity (May 2024), which found that SAE features in Claude 3 Sonnet became more abstract at deeper layers — "abstract, multilingual, multimodal features" at layer 20+ compared to "token-level features" at layer 5. We observe the same pattern at GPT-2 Small scale: syntactic → semantic → contextual.

The 30% average composition rate suggests that feature composition is a real but partial phenomenon. Not every high-level feature has clean low-level sub-features — some emerge from distributed, non-decomposable interactions across many earlier features. This is consistent with the hypothesis that transformers use both compositional and distributed representations simultaneously.

A key open question: can we build "feature circuits" — causal graphs connecting SAE features across layers, analogous to attention head circuits? This would provide a feature-level description of computation that complements the existing head-level description. Our cross-layer correspondence data is a first step toward this goal.

We have demonstrated that sparse autoencoder features at layer 6 of GPT-2 Small compose from identifiable sub-features at layer 4, with composition rates ranging from 22% (chess notation) to 51% (Python code). The hierarchy is consistent across domains: syntactic features at early layers build into semantic features at middle layers and contextual features at late layers.

These results suggest that cross-layer feature analysis is a promising direction for mechanistic interpretability. While current SAE methods train on individual layers, the real computational structure of transformers spans layers. Understanding how features compose across the full forward pass is essential for building a complete picture of model behavior.

); };