Reading a Cortex Model's Hidden Layers to Know When Not to Trust It

Deep networks now rebuild the folded surfaces of the human cortex from an MRI scan in one or two seconds. Classical pipelines such as FreeSurfer take hours for the same job. Yet large studies cannot simply swap one for the other. Nobody can tell, scan by scan, when the fast network has quietly produced a wrong surface. That happens on unusual anatomy, on artifacts, or where the network copied a mistake from the classical labels it was trained on. The time saved in reconstruction is then spent again on manual quality review, or on rerunning the slow pipeline "just in case." In a 100,000-scan cohort the bottleneck is no longer computing surfaces. It is deciding which surfaces to believe.

We propose to answer that question from inside the network in a single forward pass, using a tool from language-model interpretability. Work on LLMs found that the intrinsic dimension of hidden states follows a stereotyped rise-then-fall curve across layers, and that the fall marks where the model commits to an answer. Intrinsic dimension is the number of directions the data actually spreads along, as opposed to the raw width of the layer. We hypothesize that cortical reconstruction networks have a similar stereotyped layerwise profile. A single scan already supplies hundreds of thousands of vertex feature vectors, so this profile can be estimated per scan, and even per brain region. Scans or regions whose profile departs from the typical one should be the ones the network gets wrong. Such a signal would support a triage policy. Most scans take the fast path, and a small, well-chosen fraction is routed to FreeSurfer or to a human.

Core Claim

A cheap, label-free signature of a reconstruction network's internal geometry will predict surface error more accurately than checks on the output mesh alone, at a fraction of the cost of ensembles. The signature combines two quantities computed at every layer: the per-scan intrinsic-dimension profile, and a per-layer distance of the scan's activations from the training distribution. Most importantly, it should catch some failures that neither output checks nor agreement with FreeSurfer can see. These are cases where the network and FreeSurfer agree with each other, but both disagree with expert manual labels. Neither simple alternative can, by construction, detect that failure mode, so it is the proposal's central test.

Relation to Prior Work

The motivating gap comes from the fast reconstruction literature itself. Vox2Cortex deforms a template sphere with a volumetric convolutional network plus a graph network. Vox2Cortex-Flow replaces the discrete stages with continuous velocity fields integrated as a graph neural ODE, a network whose layers define a differential equation that moves mesh vertices over time. CorticalFlow chains three diffeomorphic deformation stages. SurfNN predicts both cortical boundaries from a midthickness anchor. All four are trained on FreeSurfer-derived targets and validated largely on healthy or mildly atrophied brains. None exposes any per-scan confidence. The same holds for single-pass preprocessing networks such as Neural Pre-processing and deepmriprep. Downstream models inherit the problem, too. The fMRI decoder in NeurIPS: Neuro-anatomical Inductive Priors conditions its experts on cortical thickness, curvature and sulcal depth taken from precomputed surfaces. It therefore depends on surfaces that nobody audits.

The method comes from LLM interpretability. Geometry of Decision Making in Language Models measured layerwise intrinsic dimension with maximum-likelihood and ratio-based estimators across 28 models. It reported a universal expansion-then-compression curve whose peak aligns with the layer where intermediate predictions become accurate. We reuse the estimators, but we ask a different question. That paper studies population-level curves over many prompts. We use the within-scan curve as a per-input diagnostic, and we treat deviation from the typical curve as a warning sign.

Investigating Layer Importance in Large Language Models showed that importance concentrates in a few early "cornerstone" layers. We borrow its layer-ablation approach to decide which layers' geometry to monitor, rather than assuming all layers are equally informative.

Language Models Encode the Value of Numbers Linearly is a constraint rather than a method source. It showed that high probe correlation (above 0.95) does not by itself establish that a representation is used, and that interventions are needed. Its causal-intervention success reached 0.73. Accordingly, we require an intervention test showing that our signal tracks what the network is actually computing, not just input statistics.

Research Program

The first stage checks whether the premise holds at all. We retrain Vox2Cortex-Flow and CorticalFlow on ADNI following their published recipes. For each layer of the volumetric encoder, each graph-network layer, and each ODE integration step, we estimate intrinsic dimension over the vertex features of a single hemisphere. We then plot these per-scan curves across held-out ADNI and OASIS-1 scans.

If the curves are stereotyped, with low spread across healthy scans, the program proceeds. If they are not, we report that as a negative transfer result, and the per-layer distance signal below carries the proposal alone. We also compute local intrinsic dimension within geodesic neighborhoods on the mesh. This gives a map over the cortex rather than a single number per scan.

The second stage builds the signature. For each layer, we record two things: the deviation of the scan's intrinsic dimension from the healthy-population band, and a Mahalanobis distance of the scan's pooled activations from training statistics. The Mahalanobis distance measures how far a point lies from a distribution while accounting for how the features co-vary. We select layers by ablation, in the style of the cornerstone-layer study. We combine the per-layer terms into one score with a fixed rule: the maximum of standardized deviations. No error labels are used, so the score is unsupervised with respect to failure.

The third stage turns the score into a triage policy. Scans above a threshold go to FreeSurfer; the rest are accepted. We sweep the threshold to trace total compute against residual cohort error.

Baselines

The naive reference is to accept every fast reconstruction. It costs nothing extra, and its population error is whatever the network's error distribution is. For context, Vox2Cortex-Flow reports average symmetric surface distance below 0.185 mm relative to FreeSurfer. Vox2Cortex reports roughly 0.3 mm on ADNI and OASIS. A second trivial reference routes a random fraction of scans to FreeSurfer. Any useful score must beat random routing at every routing fraction.

The first strong baseline is output-geometry quality control. It scores each mesh by its fraction of self-intersecting faces, by negative or implausible thickness, and by regional thickness outliers against a normative atlas. It is the natural competitor because it is free and already standard. CorticalFlow, for instance, reports reducing self-intersections by at least 32.58% relative to other deformation models, but not to zero.

The second and strongest baseline is test-time augmentation and ensemble disagreement. We run K perturbed passes or K independently trained networks and score each vertex by the spread of its predicted positions. This is the most credible generic uncertainty method. We run it at K = 5 and K = 10 and report compute alongside detection quality.

The third baseline trains a small regressor on the same frozen activations to predict surface error directly. It uses the same training scans and the same hyperparameter-search budget as our threshold tuning. This baseline has access to error labels that our score never sees.

No reported result for per-scan failure detection by any of these methods was found on Lacuna for cortical reconstruction networks. Every baseline number will therefore be produced here, on identical splits and identical trained networks.

Two ablations isolate what is new. The first uses only the final layer's Mahalanobis distance, which tests whether the layerwise trajectory adds anything. The second uses only the intrinsic-dimension deviation, which tests whether geometry adds anything beyond the distribution-distance term. Beating a baseline means a higher area under the curve for flagging scans whose error exceeds a clinically chosen threshold, at no more than 1.2 times single-pass compute. Beating the ensemble means matching its detection quality at roughly one-fifth its cost, or exceeding it on the hard subset described below.

Why not just…?

Why not just check the output mesh for self-intersections and thickness outliers? Output checks catch failures that break geometry. They cannot see a surface that is smooth, closed and plausible yet sits on the wrong sulcus. That is exactly the kind of error inherited from FreeSurfer labels, which the reconstruction papers themselves flag as a risk. If output checks turn out to match our score on every subset, including the hard one, then the internal signal is redundant and we will say so.

Why not just use an ensemble or test-time augmentation? This is the real threat. Disagreement among passes is a well-understood uncertainty signal and may detect gross failures as well as or better than ours. It has two weaknesses. It multiplies compute, which erodes the speed advantage that motivates these models. And ensembles trained on the same FreeSurfer targets tend to agree on shared systematic errors. The Mindboggle-based hard subset directly tests whether ensemble members agree while being wrong. If the ensemble also wins there, the proposal's contribution shrinks to a cost reduction, and we will report it that way.

Why not just rerun FreeSurfer on everything, or train a supervised error predictor? Rerunning everything throws away the speedup. Vox2Cortex takes about 18 s against more than 4 hours for FreeSurfer, and some pipelines exceed 10 hours per subject according to Automatic Subcortical Segmentation Using a Contextual Model. A supervised error predictor is included as a baseline. Its weakness is that it learns only the error types present in its labels. Error labels come from FreeSurfer disagreement, which is blind to FreeSurfer's own mistakes, so it should fail on the hard subset even if it wins elsewhere.

Proposed Experiments

In-distribution detection uses held-out ADNI and OASIS-1 scans, with FreeSurfer as the reference. We report detection area under the curve and triage curves of compute against residual error.

The hard subset uses Mindboggle-101 expert labels. There we identify vertices and scans where the network and FreeSurfer agree but both deviate from the manual boundaries. We ask whether the internal score flags them above chance while output checks and FreeSurfer-disagreement cannot. This is the decisive check. A positive result means interpretability-derived signals see errors that no output-based method can. A null result means they do not, whatever they achieve elsewhere.

The test-retest datasets give a label-free validation. Scans whose reconstructions are unstable between sessions should carry high scores.

For atypical anatomy, the file offers no tumor or resection benchmark. We therefore build controlled perturbations on OASIS-1: synthetic lesions, simulated resections, motion and intensity artifacts. We measure whether score maps localize to the perturbed region. This also serves as the intervention test the numbers-probing study demands. We perturb one region of the input and require the local intrinsic-dimension map to shift at that region, not globally. A score that moves everywhere would indicate it tracks input statistics rather than the network's own computation.

Finally, we repeat the core analysis on the Neural Pre-processing network. This tests whether the signal generalizes beyond mesh deformation to single-pass volumetric preprocessing.