Sparse Autoencoders Are a Shared Coordinate System for Symbolic Matching
Organizations: University of Illinois Urbana-Champaign
Abstract
Large language models (LLMs) hold broad knowledge in one set of weights, but lack interpretability and trustworthy reasoning, especially in high-stakes use cases. A neuro-symbolic model, with its interpretable architecture and System 2 reasoning capacity, is a promising alternative if built at the scale of LLMs; however, its symbolic backbone is usually constructed with human effort, so existing neuro-symbolic models are bottlenecked by the scope of the symbol component and usually domain-specific. A data-driven method could instead build a larger symbolic system by aligning and merging existing ones. We target its first, foundational step: matching units across these heterogeneous systems. Our method, SAE-IDF, encodes a symbol in its native context into a sparse code with a sparse autoencoder (SAE), re-weights each dimension by its rarity and matches across systems. On 12 tasks across 6 kinds of symbolic system, SAE-IDF outperforms the same LLM's dense baseline on all tasks with Gemma-2-9B and all but one with Llama-3.1-8B, by up to 45 points, consistently across SAE layers and configurations. SAE-IDF is also interpretable: every dimension of the sparse code has a human-readable meaning, so each match decomposes into named concepts (features). Our work paves the way to a universal symbolic backbone.
Figures & tables
| Gemma-2-9B (layer 20) | Llama-3.1-8B (layer 15) | |||||||||
| Task | Metric | Strings | Dense | Dense, PC1 rm. | SAE-IDF | dense | Dense | Dense, PC1 rm. | SAE-IDF | dense |
| Formal mathematics (miniF2F) | ||||||||||
| Lean 4 Isabelle | MRR | 0.825 | 0.912 | 0.926 | 0.961 | +0.05 | 0.942 | 0.944 | 0.976 | +0.03 |
| Lean 4 Metamath | MRR | 0.615 | 0.210 | 0.151 | 0.661 | +0.45 | 0.646 | 0.637 | 0.787 | +0.14 |
| Lean 4 HOL Light | MRR | 0.741 | 0.539 | 0.531 | 0.898 | +0.36 | 0.603 | 0.699 | 0.906 | +0.30 |
| Code (XLCoST, program level) | ||||||||||
| Task | Metric | Random + idf | SAE unweighted | SAE-IDF |
| Formal mathematics (miniF2F) | ||||
| Lean 4 Isabelle | MRR | 0.865 | 0.882 | 0.961 |
| Lean 4 Metamath | MRR | 0.146 | 0.095 | 0.661 |
| Lean 4 HOL Light | MRR | 0.349 | 0.493 | 0.898 |
| Code (XLCoST, program level) | ||||
| 7 languages, mean | MRR † | 0.417 | 0.449 | 0.464 |
| Top-1 feature by contribution to the cosine | ||||
| Task | Source gold counterpart | Gold’s rank | SAE-unweighted | SAE - IDF |
| MultiFarm zh en | feiyong (fee) “fee for conference” | 13 / 40 / 1 | “mathematical or programming notation” (53%) | “fees and payment structures” (88%) |
| YAGO Wikidata | Mass (no instances) mass (instances: Earth mass, quark mass) | 7 / 24 / 1 | “terms related to mass” (50%) | “terms related to mass” (91%) |
| Lean 4 HOL Light | Int.floor (10 * n) + … + Int.floor (10000 * n) = 3702 floor (&10 * n) + … + floor (&10000 * n) = &3702 | 7 / 131 / 1 | “mathematical or programming notation” (33%) | “floor and rounding operations” (9%) |
| Lean 4 Metamath | 1 / Real.cos x + Real.tan x = 22 / 7 … ( ( 1 / ( cos X ) ) + ( tan X ) ) = ( ; 2 2 / 7 ) … | 5 / 41 / 1 | “mathematical or programming notation” (29%) | “limits and trigonometric functions” (18%) |
| Failure : MultiFarm zh en | you ming (“has first name”) “has first name”; ranks “has name” first | 1 / 2 / 2 | “open-source license text” (46%) | “variable names in programming code” (41%) |
| Method | Mutual-top-1 precision | Coverage | Transitivity (triples) | Merge purity | ARI | Components (489 true) |
| Dense | 0.900 | 0.340 | 0.963 (872) | 0.979 | 0.519 | 1,096 |
| Dense -PC1 | 0.910 | 0.483 | 0.960 (1,868) | 0.958 | 0.646 | 895 |
| SAE unweighted | 0.616 | 0.299 | 0.902 (572) | 0.958 | 0.432 | 1,143 |
| SAE-IDF | 0.983 | 0.639 | 0.981 (3,474) | 0.981 | 0.795 | 758 |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Kind of system | Task | Native context per symbol | Queries | Candidates per query |
| Formal mathematics | miniF2F ( Zheng et al., 2022 ) : Lean 4 Isabelle / Metamath / HOL Light | the statement itself | 483 / 482 / 317 | all statements |
| Code | XLCoST ( Zhu et al., 2022 ) : Java, C++, Python, C#, JavaScript, PHP, C the other six | the program itself | 283–3,918 per language | official pool |
| Table schemas | Valentine ( Koutras et al., 2021 ) : source target columns | column name + 16 cell values | 551 table pairs | all target columns |
| Knowledge graphs | OAEI Common-KG ( Fallatah et al., 2020 ) : NELL DBpedia, YAGO Wikidata | up to 16 of the class’s instances | 129 / 304 | 137 / 304 classes |
| Cross-lingual ontologies | MultiFarm ( Meilicke et al., 2012 ) : Chinese / Russian / Arabic English | the term’s own axioms, in its language | 246 / 246 / 239 | all target terms |
| Biomedical ontologies | Bio-ML ( He et al., 2022b ) : NCIT DOID (validation split); OAEI Anatomy ( Bodenreider et al., 2005 ) : mouse human | definitions, parents and part-of relations | 634 / 1,516 | 100 per query / 3,298 classes |
| Query language | Programs | Metric | Strings | Dense | PC1 | SAE unw. | SAE-IDF |
| Java | 3,918 | MRR | 0.485 | 0.466 | 0.466 | 0.458 | 0.480 |
| P@6 | 0.703 | 0.582 | 0.580 | 0.564 | 0.681 | ||
| C++ | 3,895 | MRR | 0.486 | 0.470 | 0.469 | 0.465 | 0.478 |
| P@6 | 0.709 | 0.626 | 0.625 | 0.627 | 0.675 | ||
| Python | 3,853 | MRR | 0.484 | 0.474 | 0.468 | 0.470 | 0.485 |
| P@6 | 0.714 | 0.691 | 0.671 | 0.670 | 0.711 |
| Layout (tokens pooled) | Dense | SAE- unweighted | SAE - IDF |
| F1 | |||
| Whole column, all tokens (main) | 0.533 | 0.458 | 0.614 |
| Name + one value per view, all tokens (16 views) | 0.563 | 0.429 | 0.630 |
| Value tokens only, name before them (16 views) | 0.570 | 0.555 | 0.608 |
| Name tokens only, after one value (16 views) | 0.611 | 0.520 | 0.572 |
| MRR | |||
| Column type | Dense | PC1 | SAE | SAE-IDF | |
| Free text | 930 | 0.727 | 0.714 | 0.684 | 0.806 |
| Categorical | 2,313 | 0.629 | 0.645 | 0.491 | 0.790 |
| Identifier | 1,216 | 0.702 | 0.718 | 0.630 | 0.805 |
| Numeric | 3,887 | 0.567 | 0.490 | 0.489 | 0.670 |
| Graded (text, categ.) | 3,243 | 0.657 | 0.665 | 0.546 | 0.795 |
| Rule-governed (id, num.) | 5,103 | 0.599 | 0.544 | 0.522 | 0.702 |
| Task | Queries | Strings | Dense | PC1 | SAE unw. | SAE-IDF |
| Bio-ML NCIT DOID, valid split | 634 | 0.779 | 0.701 | 0.732 | 0.696 | 0.817 |
| Bio-ML NCIT DOID, train split | 3,845 | 0.789 | 0.736 | 0.758 | 0.736 | 0.815 |
| OAEI Anatomy, mouse human | 1,516 | 0.734 | 0.812 | 0.864 | 0.801 | 0.886 |
| PubChem SMILES IUPAC | 1,000 | 0.009 | 0.027 | 0.012 | 0.026 | 0.015 |
| PubChem SMILES InChI | 1,000 | 0.008 | 0.007 | 0.009 | 0.005 | 0.029 |
| PubChem IUPAC InChI | 1,000 | 0.012 | 0.006 | 0.008 | 0.005 | 0.020 |
| Gemma-2-9B | BGE-M3 | Qwen3-Emb-8B | |||||||
| Task | Metric | Strings | Dense | SAE-IDF | plain | centred | PC1 | plain | PC1 |
| Lean 4 Isabelle | MRR | 0.825 | 0.912 | 0.961 | 0.956 | 0.954 | 0.932 | 0.992 | 0.995 |
| Lean 4 Metamath | MRR | 0.615 | 0.210 | 0.661 | 0.819 | 0.591 | 0.583 | 0.972 | 0.970 |
| Lean 4 HOL Light | MRR | 0.741 | 0.539 | 0.898 | 0.967 | 0.967 | 0.967 | 0.975 | 0.981 |
| XLCoST, 7 languages | MRR | 0.468 | 0.454 | 0.464 | 0.438 | 0.437 | 0.451 | 0.440 | 0.447 |
| XLCoST, 7 languages | P@6 | 0.745 | 0.680 | 0.732 | 0.671 | 0.669 | 0.702 | 0.684 | 0.710 |
| Query language | Programs | Metric | Strings | Dense | PC1 | SAE unw. | SAE-IDF |
| Java | 3,918 | MRR | 0.558 | 0.528 | 0.527 | 0.516 | 0.551 |
| P@6 | 0.550 | 0.459 | 0.458 | 0.445 | 0.534 | ||
| C++ | 3,895 | MRR | 0.560 | 0.536 | 0.535 | 0.530 | 0.549 |
| P@6 | 0.554 | 0.496 | 0.493 | 0.494 | 0.531 | ||
| Python | 3,853 | MRR | 0.560 | 0.545 | 0.536 | 0.540 | 0.561 |
| P@6 | 0.557 | 0.540 | 0.528 | 0.526 | 0.553 |
| Task | Contexts | Strings | Dense | PC1 | SAE unw. | SAE-IDF |
| NELL DBpedia | two LLMs | 0.936 | 0.964 | 0.966 | 0.916 | 0.969 |
| one LLM | 0.936 | 0.927 | 0.972 | 0.904 | 0.972 | |
| native | 0.936 | 0.931 | 0.957 | 0.938 | 0.976 | |
| YAGO Wikidata | two LLMs | 0.899 | 0.908 | 0.977 | 0.915 | 0.973 |
| one LLM | 0.899 | 0.917 | 0.968 | 0.920 | 0.968 | |
| native | 0.899 | 0.860 | 0.932 | 0.872 | 0.962 |
| Setting (Gemma-2-9B, layer 20, unless noted) | HOL Light | Metamath |
| Dense baseline | 0.541 | 0.207 |
| SAE width 16k / 32k / 65k / 131k / 262k / 524k / 1M, each at its canonical (68 / 57 / 55 / 114 / 50 / 48 / 101) | ||
| SAE-IDF | 0.82 / 0.86 / 0.89 / 0.90 / 0.91 / 0.93 / 0.93 | 0.62 / 0.61 / 0.71 / 0.67 / 0.68 / 0.70 / 0.66 |
| Sparsity , average 11 / 19 / 34 / 53 / 62 / 114 / 221 / 276 (131k features) | ||
| SAE-IDF | 0.89 / 0.89 / 0.90 / 0.91 / 0.90 / 0.90 / 0.90 / 0.90 | 0.68 / 0.67 / 0.70 / 0.71 / 0.72 / 0.67 / 0.62 / 0.64 |
| Smaller model : Gemma-2-2B, layer 12, width 16k / 65k / 262k | ||
| Lean 4 HOL Light | Lean 4 Metamath | |||||||
| Llama Scope SAE | Dense | PC1 rm. | SAE unw. | SAE-IDF | Dense | PC1 rm. | SAE unw. | SAE-IDF |
| Layer 8, 131k | 0.502 | 0.587 | 0.436 | 0.743 | 0.500 | 0.516 | 0.567 | 0.674 |
| Layer 12, 131k | 0.509 | 0.614 | 0.451 | 0.815 | 0.630 | 0.624 | 0.582 | 0.711 |
| Layer 15, 131k | 0.603 | 0.699 | 0.611 | 0.906 | 0.646 | 0.637 | 0.675 | 0.787 |
| Layer 20, 131k | 0.304 | 0.290 | 0.209 | 0.666 | 0.269 | 0.343 | 0.369 | 0.719 |
| Layer 24, 131k | 0.291 | 0.267 | 0.274 | 0.751 | 0.124 | 0.273 | 0.202 | 0.661 |
| Task | Metric | Unweighted | idf (collection) | idf (Pile density) | Information | Log-odds |
| Lean 4 Isabelle | MRR | 0.882 | 0.961 | 0.908 | 0.740 | 0.756 |
| Lean 4 Metamath | MRR | 0.095 | 0.661 | 0.190 | 0.102 | 0.190 |
| Lean 4 HOL Light | MRR | 0.493 | 0.898 | 0.588 | 0.194 | 0.277 |
| XLCoST, 7 languages | MRR | 0.449 | 0.464 | 0.451 | 0.438 | 0.471 |
| Valentine columns | F1 | 0.458 | 0.614 | 0.574 | 0.615 | 0.592 |
| Valentine columns | MRR | 0.685 | 0.856 | 0.808 | 0.855 | 0.781 |
| Task | Llama Scope SAE | Dense | PC1 | SAE unw. | SAE-IDF |
| NELL DBpedia | layer 8, 131k | 0.953 | 0.960 | 0.945 | 0.970 |
| layer 12, 131k | 0.939 | 0.950 | 0.937 | 0.973 | |
| layer 15, 131k | 0.949 | 0.960 | 0.930 | 0.958 | |
| layer 15, 32k | 0.949 | 0.960 | 0.942 | 0.961 | |
| layer 20, 131k | 0.947 | 0.958 | 0.904 | 0.947 | |
| layer 24, 131k | 0.938 | 0.951 | 0.908 | 0.936 |
| Task | Seeds | Dense | PC1 | SAE unw. | SAE-IDF |
| NELL DBpedia | 4 | 0.934 0.002 | 0.954 0.003 | 0.933 0.004 | 0.976 0.000 |
| YAGO Wikidata | 4 | 0.861 0.001 | 0.932 0.003 | 0.874 0.002 | 0.960 0.002 |
| Valentine (F1) | 3 | 0.535 0.002 | 0.534 0.003 | 0.459 0.002 | 0.614 0.001 |
| Valentine (MRR) | 3 | 0.768 0.001 | 0.762 0.001 | 0.685 0.002 | 0.857 0.002 |
| Lean 4 HOL Light | Lean 4 Metamath | |||||||
| Configuration | Dense | PC1 rm. | SAE unw. | SAE-IDF | Dense | PC1 rm. | SAE unw. | SAE-IDF |
| Gemma-2-9B, layer 5, 131k | 0.248 | 0.224 | 0.177 | 0.800 | 0.138 | 0.159 | 0.068 | 0.512 |
| layer 9 | 0.317 | 0.320 | 0.348 | 0.840 | 0.190 | 0.172 | 0.140 | 0.583 |
| layer 10 | 0.335 | 0.330 | 0.433 | 0.867 | 0.212 | 0.175 | 0.130 | 0.451 |
| layer 15 | 0.458 | 0.434 | 0.524 | 0.880 | 0.233 | 0.173 | 0.100 | 0.727 |
| layer 20 ( 114, main table) | 0.541 | 0.530 | 0.493 | 0.900 | 0.207 | 0.149 | 0.092 | 0.667 |
| Task | Matches | Common ( 1%): unw. SAE-IDF | Rare ( 0.1%) SAE-IDF | Features for 50% / 80% | Concept / surface / notation (SAE-IDF top-5) |
| Lean 4 Isabelle | 300 | 87% 3% | 32% | 21 / 146 | 43% / 7% / 48% |
| Lean 4 Metamath | 259 | 91% 2% | 31% | 15 / 88 | 39% / 4% / 55% |
| Lean 4 HOL Light | 271 | 90% 3% | 30% | 17 / 137 | 46% / 8% / 44% |
| XLCoST, Java 6 languages | 300 | 81% 0% | 75% | 10 / 88 | 51% / 11% / 35% |
| Valentine columns | 300 | 88% 6% | 49% | 10 / 54 | 79% / 4% / 13% |
| NELL DBpedia | 124 | 56% 1% | 94% | 1 / 2 | 94% / 5% / 1% |
| Dense | SAE-IDF | ||||||
| Task | Top-1 | Cov.@90% | Cov.@95% | Top-1 | Cov.@90% | Cov.@95% | |
| Lean 4 Isabelle | 483 | 0.880 | 0.96 | 0.89 | 0.936 | 1.00 | 0.98 |
| Lean 4 Metamath | 482 | 0.127 | 0.01 | 0.01 | 0.537 | 0.24 | 0.21 |
| Lean 4 HOL Light | 317 | 0.454 | 0.24 | 0.20 | 0.855 | 0.93 | 0.85 |
| Valentine columns | 8,346 | 0.622 | 0.38 | 0.22 | 0.738 | 0.67 | 0.53 |
| NELL DBpedia | 129 | 0.899 | 0.99 | 0.91 | 0.961 | 1.00 | 1.00 |
| Task | Metric | Dense | PC1 | 36 PCs | z-score | ZCA | dense-idf | sparse dense-idf | SAE-IDF |
| Lean 4 Isabelle | MRR | 0.912 | 0.926 | 0.928 | 0.942 | 0.946 | 0.942 | 0.914 | 0.961 |
| Lean 4 Metamath | MRR | 0.210 | 0.151 | 0.401 | 0.257 | 0.465 | 0.251 | 0.235 | 0.661 |
| Lean 4 HOL Light | MRR | 0.539 | 0.531 | 0.728 | 0.707 | 0.786 | 0.706 | 0.605 | 0.898 |
| XLCoST, 7 languages | MRR | 0.454 | 0.452 | 0.461 | 0.456 | 0.445 | 0.456 | 0.452 | 0.464 |
| XLCoST, 7 languages | P@6 | 0.680 | 0.678 | 0.709 | 0.709 | 0.599 | 0.709 | 0.705 | 0.732 |
| Valentine columns | F1 | 0.533 | 0.534 | 0.468 | 0.460 | 0.410 | 0.399 | 0.208 | 0.614 |
| Task | Metric | Dense | Random, unw. | Random + idf | SAE unw. | SAE-IDF |
| Lean 4 Isabelle | MRR | 0.912 | 0.845 | 0.865 | 0.882 | 0.961 |
| Lean 4 Metamath | MRR | 0.210 | 0.156 | 0.146 | 0.095 | 0.661 |
| Lean 4 HOL Light | MRR | 0.539 | 0.484 | 0.349 | 0.493 | 0.898 |
| XLCoST, 7 languages | MRR | 0.454 | 0.429 | 0.417 | 0.449 | 0.464 |
| XLCoST, 7 languages | P@6 | 0.680 | 0.607 | 0.627 | 0.673 | 0.732 |
| Valentine columns | F1 | 0.533 | 0.460 | 0.482 | 0.458 | 0.614 |
| vs. Dense | vs. Dense -PC1 | vs. Strings | |||||
| Task | [95% CI] | [95% CI] | [95% CI] | ||||
| Lean 4 Isabelle | 483 | +0.048 [+0.027, +0.071] | .001 | +0.034 [+0.014, +0.055] | .001 | +0.136 [+0.105, +0.168] | .001 |
| Lean 4 Metamath | 482 | +0.451 [+0.418, +0.485] | .001 | +0.510 [+0.475, +0.546] | .001 | +0.046 [+0.002, +0.090] | 0.02 |
| Lean 4 HOL Light | 317 | +0.359 [+0.315, +0.405] | .001 | +0.367 [+0.322, +0.412] | .001 | +0.157 [+0.114, +0.200] | .001 |
| XLCoST Java | 3,918 | +0.014 [+0.013, +0.016] | .001 | +0.015 [+0.013, +0.016] | .001 | -0.005 [-0.006, -0.004] | 1.00 |
| XLCoST C++ | 3,895 | +0.008 [+0.007, +0.010] | .001 | +0.009 [+0.008, +0.011] | .001 | -0.008 [-0.009, -0.006] | 1.00 |
| vs. Dense | vs. Dense -PC1 | vs. Strings | |||||
| Task | [95% CI] | [95% CI] | [95% CI] | ||||
| Lean 4 Isabelle | 483 | +0.034 [+0.018, +0.052] | .001 | +0.032 [+0.015, +0.049] | .001 | +0.152 [+0.120, +0.184] | .001 |
| Lean 4 Metamath | 482 | +0.141 [+0.109, +0.173] | .001 | +0.150 [+0.118, +0.182] | .001 | +0.172 [+0.132, +0.213] | .001 |
| Lean 4 HOL Light | 317 | +0.303 [+0.260, +0.348] | .001 | +0.207 [+0.170, +0.245] | .001 | +0.166 [+0.123, +0.208] | .001 |
| XLCoST Java | 3,918 | +0.007 [+0.004, +0.009] | .001 | +0.010 [+0.008, +0.012] | .001 | -0.015 [-0.017, -0.014] | 1.00 |
| XLCoST C++ | 3,895 | -0.058 [-0.062, -0.053] | 1.00 | -0.053 [-0.058, -0.049] | 1.00 | -0.067 [-0.071, -0.063] | 1.00 |
| Row | Comparison | SAE - IDF | other | [95% CI] | ||
| S1: random dictionary of the same width and sparsity | ||||||
| Lean 4 Isabelle | Random + idf | 483 | 0.961 | 0.865 | +0.096 [+0.068, +0.125] | 0.001 |
| Lean 4 Isabelle | Random, unw. | 483 | 0.961 | 0.845 | +0.116 [+0.088, +0.145] | 0.001 |
| Lean 4 Metamath | Random + idf | 482 | 0.661 | 0.146 | +0.516 [+0.476, +0.555] | 0.001 |
| Lean 4 Metamath | Random, unw. | 482 | 0.661 | 0.156 | +0.505 [+0.466, +0.543] | 0.001 |
| Lean 4 HOL Light | Random + idf | 317 | 0.898 | 0.349 | +0.549 [+0.500, +0.596] | 0.001 |
| Row | Comparison | SAE - IDF | other | [95% CI] | ||
| S2: stronger dense controls | ||||||
| Lean 4 Isabelle | 36 PCs | 483 | 0.961 | 0.928 | +0.033 [+0.014, +0.052] | 0.001 |
| Lean 4 Isabelle | z-score | 483 | 0.961 | 0.942 | +0.019 [+0.001, +0.038] | 0.020 |
| Lean 4 Isabelle | ZCA | 483 | 0.961 | 0.946 | +0.015 [-0.002, +0.032] | 0.041 |
| Lean 4 Isabelle | dense-idf | 483 | 0.961 | 0.942 | +0.019 [+0.001, +0.037] | 0.020 |
| Lean 4 Isabelle | sparse dense-idf | 483 | 0.961 | 0.914 | +0.047 [+0.026, +0.069] | 0.001 |
| Row | Comparison | SAE - IDF | other | [95% CI] | ||
| S2: stronger dense controls, continued | ||||||
| XLCoST PHP | dense-idf | 1566 | 0.988 | 0.437 | +0.551 [+0.536, +0.566] | 0.001 |
| XLCoST PHP | sparse dense-idf | 1566 | 0.988 | 0.435 | +0.553 [+0.538, +0.568] | 0.001 |
| XLCoST C | 36 PCs | 283 | 0.979 | 0.316 | +0.663 [+0.625, +0.700] | 0.001 |
| XLCoST C | z-score | 283 | 0.979 | 0.393 | +0.585 [+0.549, +0.620] | 0.001 |
| XLCoST C | ZCA | 283 | 0.979 | 0.283 | +0.696 [+0.655, +0.738] | 0.001 |
Neuro-Symbolic AI
Neuro-symbolic artificial intelligence combines neural learning with symbolic knowledge and reasoning to build more structured, interpretable, and reliable AI.
See all 101 papers