[Paper Review] SymTorch: A Framework for Symbolic Distillation of Deep Neural Networks
SymTorch automates symbolic distillation of neural network components into closed-form expressions, enabling interpretable surrogates and hybrid neural-symbolic models with case studies across GNNs, PINNs, and LLMs.
Symbolic distillation replaces neural networks, or components thereof, with interpretable, closed-form mathematical expressions. This approach has shown promise in discovering physical laws and mathematical relationships directly from trained deep learning models, yet adoption remains limited due to the engineering barrier of integrating symbolic regression into deep learning workflows. We introduce SymTorch, a library that automates this distillation by wrapping neural network components, collecting their input-output behavior, and approximating them with human-readable equations via PySR. SymTorch handles the engineering challenges that have hindered adoption: GPU-CPU data transfer, input-output caching, model serialization, and seamless switching between neural and symbolic forward passes. We demonstrate SymTorch across diverse architectures including GNNs, PINNs and transformer models. Finally, we present a proof-of-concept for accelerating LLM inference by replacing MLP layers with symbolic surrogates, achieving an 8.3\% throughput improvement with moderate performance degradation.
Motivation & Objective
- Provide an open-source framework to automate symbolic distillation of neural network components.
- Lower engineering barriers by handling GPU-CPU data transfer, caching, serialization, and forward-pass switching.
- Demonstrate applicability across architectures (GNNs, PINNs, Transformers) and show potential LLM inference speedups.
- Illustrate how symbolic surrogates recover known physical laws and reveal LLM arithmetic biases.
Proposed method
- Wrap NN components as SymbolicModel blocks to collect input-output data during forward passes.
- Run symbolic regression on collected I/O using PySR to obtain closed-form expressions per output dimension.
- Replace selected neural blocks with Pareto-front symbolic equations to create hybrid models.
- Cache activations and support seamless switching between neural and symbolic computations during forward passes.
- Provide SLIME-style local explanations by fitting symbolic surrogates to neighborhoods around a point of interest.

Experimental results
Research questions
- RQ1Can symbolic regression faithfully approximate the input-output mappings of neural network components across diverse architectures?
- RQ2What are the practical gains and tradeoffs (accuracy vs. speed) when replacing neural blocks with symbolic surrogates in transformers/LLMs?
- RQ3To what extent can symbolic distillation recover known physical laws or reveal learned arithmetic biases in LLMs?
- RQ4How does SLIME-style symbolic explanations fare for local interpretability in black-box models?
Key findings
- SymTorch enables symbolic distillation across GNNs, PINNs, and transformer blocks.
- Replacing 3 of 28 transformer MLP layers with symbolic surrogates yields an 8.3% throughput increase with a modest perplexity rise (3.14 vs 10.62 baseline).
- Symbolic surrogates in the PCA-reduced subspace capture MLP behavior with comparable perplexity degradation to PCA alone.
- PINN-based PDE solutions can be recovered as closed-form expressions after symbolic distillation.
- GNN-based symbolic distillation recovers true interaction laws, aligning with prior inductive-bias findings.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.