Sparse Autoencoders: A Shared Coordinate System for Cross-System Symbol Alignment

    Aligning symbols across disconnected formal systems—proof assistants, ontologies, knowledge graphs, and codebases—is fundamentally a matching problem, not a text-similarity one. This article explains why general-purpose text embeddings fall short for this task, due to anisotropy, surface co-occurrence bias, corpus-dependent coordinate drift, and feature superposition. It then shows how Sparse Autoencoders (SAEs) transform entangled representations into a sparse, discrete, nameable feature space that can serve as a shared coordinate system. A complete pipeline is laid out, covering corpus normalization, a unified encoder, SAE training, feature stability filtering, orthogonal Procrustes alignment with bootstrapping, hard-constraint filtering, and mapping persistence. The article also covers evaluation strategies, common pitfalls, engineering and resource organization for production, and limitations, pointing toward a future where sparse features are combined with symbolic execution to connect symbol islands.

    1. The Core Problem: Not “Can’t Understand,” but “Can’t Align”

    Formal verification has long suffered from a kind of structural redundancy. Four mainstream proof systems—interactive theorem provers driven by dependent types, formal proof frameworks built on layered encapsulation, proof databases assembled from atomic inference steps, and lightweight provers built around higher-order logic kernels—have each accumulated tens of thousands of formalized theorems. A substantial share of these are mathematically equivalent, yet written as surface-level symbol sequences that are nearly impossible for one another to recognize. The same trigonometric proposition might appear in one system as a namespaced function call, and in another as a string mixing prefix expressions with escape characters.

    A human can identify equivalence at a glance through domain knowledge, but a machine must pair items exhaustively between two sets each numbering in the tens of thousands. The naive approach requires on the order of n×m comparisons—over a hundred million—and each comparison needs a reliable semantic similarity criterion. That criterion, however, is precisely what we are trying to obtain.

    The same class of problem is widespread in software and data engineering:

    • Knowledge graphs and open encyclopedia-style knowledge bases: the same entity type is called “train station” in one system and “railway station” in another, with naming, hierarchy, and attribute dimensions all differing.
    • Biomedical ontologies and terminology sets: the same disease is encoded with entirely different coding schemes and granularity divisions across different dictionaries.
    • Multilingual codebases: the same business capability, expressed in one statically typed object-oriented language and one dynamic scripting language, offers almost no comparability in function signatures, exception models, or naming conventions.

    The common trait of these systems is: mutually non-referential, mutually unvalidated, each closed in its own loop. Valuable knowledge is thus locked in islands that never communicate, and connecting those islands requires an internal representation that is comparable across systems. It is worth emphasizing that these tasks belong to symbol alignment (symbol / schema / ontology matching), not to text similarity retrieval. Two symbols that differ greatly on the surface yet are semantically equivalent—or that look highly similar yet are semantically unrelated—are both commonplace in alignment tasks.

    2. Why General-Purpose Text Vector Models Fall Short

    A common intuition is: since large models can read various specialized notations (the symbol-writing conventions agreed upon within each discipline), why not just feed the symbol strings in, extract vectors, and compare them? In practice, the results are often unsatisfactory, for four main reasons.

    First, anisotropy of hidden states. The high-dimensional vectors a model outputs are not uniformly distributed in high-dimensional space; they generally skew toward a few fixed directions—arrows that should scatter randomly instead all point toward similar orientations. The consequence is that the cosine similarity between any two vectors is systematically inflated, so “looking similar” loses its discriminative power, and the dynamic range of the similarity distribution is compressed into a narrow band, making thresholds hard to set.

    Second, surface co-occurrence bias. Self-supervised objectives reward models for capturing local token co-occurrence statistics. The co-occurrence patterns of symbols such as mathematical notation, ontology IRIs, and code identifiers depend heavily on writing conventions, so the model easily encodes “written similarly” into its representations—yet writing style is exactly the variable we want to erase.

    Third, coordinate systems drift with the corpus. If two systems’ symbols are trained or continually pre-trained on their respective corpora, the resulting two spaces do not even share basis directions, and their vectors cannot be compared directly at all; even if they share one encoder, differences in domain distribution cause the same semantic region to shift across different subdomains.

    Fourth, superposition causes feature entanglement. To fit vast numbers of concepts into a limited number of dimensions, model representations typically exist in a state of superposition: a single dimension often carries several unrelated concepts at once, a mixed projection of multiple semantic directions. This means that “extracting a particular dimension to represent a particular concept” is a dead end—there are no nameable axes, and therefore no alignment anchors that can be manually verified.

    Together these four points lead to one conclusion: what we need is not merely “better vectors,” but a shared feature space whose axes are discrete, nameable, and verifiable.

    3. Why Sparse Autoencoders Can Serve as a Shared Coordinate System

    The Sparse Autoencoder (SAE) is structurally minimal: an encoder maps an input representation x to a hidden layer a that is far wider than the original dimensions, then decodes back to x̂. A sparsity penalty is applied to the hidden activations so that only a tiny number of units are significantly activated in each forward pass.

    1. a = ReLU(W_enc · x + b_enc) # x: d dimensions, a: k dimensions, k >> d
    2. x̂ = W_dec · a + b_dec
    3. L = ||x - x̂||² + λ · ||a||₁ # reconstruction term + sparsity regularization

    From the perspective of dictionary learning, this step is doing the following: using an over-complete dictionary (the columns of the decoding matrix) to approximate the original representation as a linear combination, while requiring that only a very few dictionary atoms be used each time. The competitive pressure imposed by sparsity “spreads out” information that was originally entangled across a few directions onto a large number of nearly monosemantic dimensions—one dimension tends to correspond to only one kind of semantic cause, such as a type of operation, a kind of document structure, or a naming convention.

    This yields three properties that are critical for symbol alignment:

    1. Discretizable: concepts become sparse activation patterns on the hidden layer, and the object of comparison shifts from “angles between continuous vectors” to “overlap between activation sets,” which is inherently more stable and easier to threshold.
    2. Interpretable: each significantly activated dimension can be manually named and validated by retrieving the samples that maximally activate it; a human can directly judge “whether this feature refers to function application, type annotation, or namespace prefix.”
    3. Shareable across domains: as long as the encoder and SAE stay fixed, the symbols of any newly added system project onto the same dictionary without retraining, naturally supporting incremental onboarding.

    It must be made clear that the SAE itself does not perform alignment. What it provides is a “medium that can be aligned”—transforming entangled, anisotropic, un-nameable representations into a sparse, discrete, nameable intermediate representation. True alignment still requires anchor calibration and space calibration on top of it.

    4. A Deployable End-to-End Pipeline

    Step 0 — Corpus construction and symbol normalization. Extract each system’s symbols into comparable minimal semantic units: in proof systems, theorem statements and their type declarations; in ontologies, concept nodes with their definitions, parent classes, and property constraints; in codebases, function signatures with their behavioral summaries. Normalization only handles surface noise with no semantic difference—unifying escape notation, unifying namespace abbreviation expansion, and stripping locators unrelated to semantics. The key is to preserve structured metadata (arity, types, owning namespace, hierarchy depth), which is an extremely valuable hard constraint in the subsequent alignment stage.

    Step 1 — Unified encoder. Use a general-purpose text encoder and apply lightweight continual pre-training on data mixing each system’s corpus, so it is not overly unfamiliar with each domain’s notation. The goal here is not the “strongest representation,” but “a distribution as centered as possible, not biased toward any single system.”

    Step 2 — Train the SAE. It is advisable to train on token-level activations and then pool, rather than training directly on whole-sentence vectors—pooling mixes fine-grained semantic causes too early and weakens the benefit of sparsification. Set the width to several times the order of the original dimension, and determine the sparsity coefficient via grid search against alignment quality (rather than pure reconstruction error).

    Step 3 — Feature stability filtering. Not all hidden dimensions are usable. Retrain repeatedly with different random seeds and different data subsamples, and compute each dimension’s overlap of its set of maximally activating samples (e.g., Jaccard similarity). Only dimensions that reproduce stably across multiple training runs are suitable as candidate alignment anchors. Also measure activation frequency, discarding dead features that are long inactive and “universal” features that occupy too large a share.

    Step 4 — Cross-system alignment. With a small number of high-confidence seed pairs (manually labeled or drawn from authoritative external mappings, such as explicit equivalence declarations in an ontology), take corresponding points in the feature spaces of the two systems and solve the orthogonal Procrustes problem, estimating a linear transformation containing only rotation and reflection that brings the two sets of feature bases into alignment as much as possible. Then score the entire candidate set with that transformation, take high-scoring pairs into the next round, and iteratively expand the seed set—this is bootstrapping.

    1. # Given seed pairs (X, Y), find the orthogonal matrix R that minimizes ||X·R - Y||_F
    2. M = Xᵀ · Y
    3. U, S, Vᵀ = svd(M)
    4. R = U · Vᵀ
    5. # Transform all candidates with R, rank by activation-pattern overlap + structural-constraint consistency

    Step 5 — Hard-constraint filtering and the human-in-the-loop. On top of the pure semantic score, layer in structural constraints: arity must match, type signatures must be mappable, and the difference in hierarchy depth must fall within a threshold. These constraints effectively intercept false positives that are “semantically close but of fundamentally different types.” Human review should prioritize boundary samples (those whose scores sit in the threshold’s neighborhood) rather than random sampling, since this yields the highest information gain per unit of annotation cost.

    Step 6 — Mapping persistence. Store the confirmed alignment relationships as a standalone mapping layer (a table of triples or an independent graph), decoupled from and version-controlled separately from the source systems. Any subsequent update to a system will not break confirmed mappings, and the mappings themselves can serve as a weak-supervision signal for the next round of continual pre-training.

    5. Evaluation: How to Prove That Alignment Actually Works

    Looking only at top-1 accuracy can seriously mislead. It is advisable to include at least the following dimensions:

    • Ranking quality: Precision@1 / Precision@k, MRR, and evaluation must be done on hard negatives—same domain but different granularity, synonymous but differently named, identically named but semantically different, and sibling concepts at similar hierarchy levels.
    • Pairwise consistency: whether the alignment relationships satisfy symmetry and transitivity. If A↔B and B↔C are confirmed, then the feature distance between A and C should be similarly close; the violation rate of the transitive closure is a very sensitive error probe.
    • Ablation comparison: compare against “pure literal matching,” “SAE without sparsity constraints,” “direct cosine comparison without anchors,” and “anchors but no structural constraints,” quantifying the marginal contribution of each component.
    • Human acceptance sampling: have domain experts sample in score-stratified fashion and report confidence intervals, rather than a single-point number.
    • Stability: rerun with different random seeds and different corpus orders, and observe the overlap ratio of alignment results.

    6. Common Pitfalls

    1. Data split leakage: training/validation splits must be cut along both “system” and “concept family” dimensions. If different variants of the same concept family appear in both the training and test sets, metrics will be inflated and will completely fail to reflect true generalization.
    2. Dead features and feature collapse: too large a sparsity coefficient causes many dimensions to never activate, so the dictionary’s effective width is far smaller than the configured width. Monitor the histogram of activation frequencies, and re-initialize dead features when necessary.
    3. The default-bijection assumption: real scenarios abound with one-to-many and many-to-one relationships (inconsistent granularity, concepts split or merged). Forcing one-to-one matching injects systematic bias into the mapping layer; non-bijective relationships should be explicitly supported and the mapping cardinality recorded.
    4. Treating semantic alignment as proof of semantic equivalence: in the context of proof systems, “similar representation” is by no means equal to “logical equivalence.” Semantic alignment can only produce candidate pairs awaiting verification; whether they are equivalent must ultimately be decided by the proof kernel or a formal verification process. Confusing the two is the most dangerous methodological error.
    5. Ignoring incremental cost: onboarding a new system should not trigger full retraining. Keeping the encoder and dictionary fixed and performing only Procrustes calibration and candidate filtering is the only scalable approach.

    7. Engineering Implementation and Resource Organization

    The workload profile of this kind of system in production is clear: a one-time large-scale batch encoding, repeatedly iterated matrix operations, and long-term incremental alignment services. Separating responsibilities along these lines is a sound approach:

    • Place batch encoding and training on the elastic compute of a container platform, scaling by job granularity; put intermediate tensors and corpus snapshots in object storage, managed by batch directory and versioned.
    • Retrieval of vectors and activation patterns requires an approximate nearest-neighbor index, stored separately from the relational mapping table; the mapping table carries the authoritative source of truth, while the vector index carries recall.
    • Orchestration of alignment jobs should be decoupled with a message queue, with failure retries and idempotency guaranteed by job IDs; persist the output of every bootstrapping iteration to ensure reproducibility and traceability.
    • Observability should hook into logging services and monitoring/alerting, with three metrics watched closely: the SAE dead-feature ratio, drift in the score distribution of candidate pairs, and the backlog length and rejection rate of the human review queue. The third is the most sensitive early signal of whether the model is degrading.

    The above are all general categories of cloud capabilities in the industry; specific specifications, quotas, and pricing are subject to the official documentation of your chosen cloud provider (e.g., Baidu AI Cloud).

    8. Limitations and Outlook

    Sparsity is a kind of inductive bias; it assumes that the causes of concepts can be approximately spread out linearly. For concepts that vary essentially continuously (numeric parameter families, metric scales), too strong a sparsity penalty may cut semantics that should transition smoothly into disconnected fragments; in that case, one needs to loosen the coefficient or introduce a mixed-sparsity scheme. The feature quality of low-frequency symbols is likewise worrying: concepts that appear too few times lack enough activation samples to be calibrated stably and can only be approximated through structural constraints and inheritance from superordinate concepts.

    A longer-term direction is combining sparse features with symbolic execution: let sparse features propose cross-system candidate pairs, and let the formal kernel or type checker make the judgment and refutation, placing interpretable statistical alignment and verifiable logical judgment on the same pipeline. The former solves “where to look,” and the latter solves “whether they are truly equivalent”—the two are complementary rather than substitutes. This is also the realistic path by which symbol islands are truly connected.