This invention discloses a method and
system for locating knowledge encoding structures of large language models based on detection-intervention-trajectory
triangulation verification, belonging to the field of
artificial intelligence interpretability technology. The method includes: S1, forward propagating the input sample to collect the residual flow activation, attention and
multilayer perceptron (MLP) pathway outputs, and the outputs of each attention head; S2, training linear probes for each layer's residual flow and selecting candidate
layers according to category F1, injecting perturbations into the candidate
layers, comparing the performance degradation of the optimal layer probe with the full trajectory classifier to obtain cross-layer redundancy; S3, performing attention zero
ablation and MLP zero
ablation on the candidate
layers respectively, and labeling the layer as attention-dominated, MLP-dominated, or
hybrid based on the causal KL ratio of the two pathways; S4, for layers labeled as attention-dominated or
hybrid, calculating the probe F1 and head-level zero
ablation causal KL of each attention head, taking the intersection of the top terms of both to obtain a set of simultaneously detectable and causally related attention heads; S5, outputting the location set for each domain. This invention precisely distinguishes between localized coding and redundant distributed coding through cross-
verification from three perspectives: detection, causal intervention, and trajectory geometry, providing fine-grained evidence for knowledge editing, illusion suppression, and security auditing.