Source-linked AI summary

SymbolicGPT: A Generative Transformer Model for Symbolic Regression

Mojtaba Valipour, Bowen You, Maysum Panju, Ali Ghodsi

arXiv:2106.14131v1cs.LGcs.CLcs.SC

TL;DR

Symbolic regression must search a large space of flexible expressions, and typical approaches may restart training for each new dataset. SymbolicGPT uses a language model to generate equation skeletons from dataset embeddings and optimizes constants separately; the paper reports lower error across data sizes and substantially shorter running times than comparison methods. Its generalization depends on training over a wide, diverse set of equations.

  • Problem

    Symbolic regression searches a large space of unconstrained candidate expressions, while typical methods train for one dataset and restart from scratch for each new instance.

    Source: §1 · pp. 1–2
  • Method

    SymbolicGPT embeds the dataset, uses a GPT model to generate an equation skeleton, and optimizes its constants separately.

    Source: §3.3 · p. 5
  • Results

    SymbolicGPT consistently achieves lower regression error than the other algorithms across data sizes and solves instances significantly faster, often by an order of magnitude or more.

    Source: §4 · p. 8
  • Takeaways & Limitations

    The method performs competently across several kinds of symbolic regression problems while eliminating the per-instance computation expense described for most regression methods.

    Source: §5 · p. 10

    Generalization to unseen equations requires a wide, diverse set of training equations to prevent overfitting.

    Source: §3.1 · p. 3

Abstract

from arXiv · show

Symbolic regression is the task of identifying a mathematical expression that best fits a provided dataset of input and output values. Due to the richness of the space of mathematical expressions, symbolic regression is generally a challenging problem. While conventional approaches based on genetic evolution algorithms have been used for decades, deep learning-based methods are relatively new and an active research area. In this work, we present SymbolicGPT, a novel transformer-based language model for symbolic regression. This model exploits the advantages of probabilistic language models like GPT, including strength in performance and flexibility. Through comprehensive experiments, we show that our model performs strongly compared to competing models with respect to the accuracy, running time, and data efficiency.

1 Introduction

Symbolic regression searches for flexible expressions that fit data, making its candidate space much larger than that of more structurally constrained regression. SymbolicGPT reframes the task as language modeling, using datasets as inputs and mathematical expressions as captions.

1 Introduction

  • Without structural constraints on the target equation, symbolic regression searches a much larger candidate-expression space than linear or multinomial regression.In the typical instance-based framework, a new dataset also requires the training procedure to begin again from scratch.Source: §1 · pp. 1–2
  • SymbolicGPT treats symbolic mathematics as a language and frames regression as captioning a point cloud with its governing equation.The proposed model learns the relationship between point clouds and the mathematical expressions that define them.Source: §1 · p. 2
  • A T-net provides an order-invariant embedding of the input point cloud, independent of dataset size and point order.The embedding represents the entire input dataset for a regression instance.Source: §1 · p. 2
  • SymbolicGPT trains one language model once and uses it to solve new regression instances as captioning tasks, rather than learning an equation anew for each dataset.The introduction presents this as a route to faster solving and competent equation reconstruction.Source: §1 · p. 2

2 Related Work

Related approaches include genetic search, neural models trained separately for each dataset, and language-based or reinforcement-learning methods. The paper contrasts SymbolicGPT with approaches whose per-instance computation or input format constrains their use.

2 Related Work

  • Genetic-algorithm methods search over symbolic expressions through mutation and evolution, but are computationally expensive, randomized, instance-based, and struggle with many variables and constants.Neural Equation Learner approaches also train from scratch for each new input dataset.Source: §2 · p. 2
  • A language-based sequence-to-sequence LSTM avoids per-instance training, but its textual input format restricts it to one-dimensional data on a fixed-size mesh.The paper says its own approach removes these input-structure limitations for high-dimensional problems with many variables.Source: §2 · p. 3
  • The cited reinforcement-learning method generates equation skeletons with deep RNNs, then uses numerical optimization for constants while retaining iterative search.The paper describes this prediction process as computationally intensive.Source: §2 · p. 3

3 Method

SymbolicGPT combines an order-invariant dataset representation, GPT-generated equation skeletons, and a separate step for optimizing their constants.

3 Method

  • A T-net [16] produces an order-invariant embedding of the input dataset.Source: §3 · p. 3
  • A GPT language model obtains a skeleton equation from the dataset representation.Source: §3 · p. 3
  • The method optimizes constant values to fill in the generated equation skeleton.Source: §3 · p. 3

3.1 Equation Generation

The training data pair numerical datasets with their generating expressions, using randomly generated parse trees to control equation complexity and constant content.

3.1 Equation Generation

  • SymbolicGPT training data pairs a numerical dataset with a string encoding the expression that governs it.Source: §3.1 · p. 3
  • Training equations are sampled by decorating parse trees whose maximum depth controls potential function nesting and equation complexity.Unlike the cited tree-sampling approach, this method constrains tree levels rather than node count.Source: §3.1 · p. 3
  • The tree template is a balanced binary tree with leaves assigned variables and interior nodes assigned allowed operators; unary identity operators and terminal nodes permit shallower or less complex expressions.The specified variables and operator set determine which expressions can be generated.Source: §3.1 · pp. 3–4
  • Random constants can be inserted as multiplicative factors or additive biases, with their frequency controlled by the constant ratio.The method uses specified constant bounds and insertion probability.Source: §3.1 · p. 4
  • Each generated equation is evaluated at randomly sampled inputs to create its dataset, and a wide, diverse set of training equations is needed to generalize to unseen equations without overfitting.Source: §3.1 · pp. 3–4

3.2 Order-Invariant Embedding

SymbolicGPT converts a dataset of points into a fixed-size vector embedding with a T-net designed to handle varying dataset sizes and ignore point order. Global max pooling supplies both properties.

3.2 Order-Invariant Embedding

  • The embedding must accommodate datasets with different numbers of points and remain invariant to their order.The point set is treated as a collection, not a sequence.Source: §3.2 · p. 4
  • The T-net accepts n datapoints over a fixed number d of variables, padding instances with fewer variables with zeros.Its input matrix is X ∈ R^(n×(d+1)), and n can vary.Source: §3.2 · p. 4
  • After three MLP stages encode each point in 4e dimensions, global max pooling reduces the n × 4e output to a 1 × 4e vector.The pooled vector is passed through two fully connected layers to produce the dataset embedding.Source: §3.2 · pp. 4–5
  • Figure 1 depicts the T-net embedding the input dataset and the GPT model producing symbolic equation skeletons.The training set pairs input datasets with output equations for translation into equation strings.Source: §3.2 · p. 4, Figure 1 · p. 5

3.3 Generative Model Architecture

The generative model combines a dataset embedding with an equation-token prefix and uses a GPT transformer to produce symbolic equation skeletons. Constants are masked during training and fitted separately.

3.3 Generative Model Architecture

  • GPT receives the T-net dataset embedding and a tokenized equation prefix, typically a Start-of-Sequence token when no output-expression information is given.The prefix may also be any desired beginning of the output equation.Source: §3.3 · p. 5
  • The model sums the dataset representation, token embeddings, and positional embeddings before processing the combined input.The dataset representation is expanded to match the embedding matrix dimensions.Source: §3.3 · p. 5
  • Eight GPT transformer blocks process the combined embedding, and a linear projection with a softmax produces token probabilities for equation generation.The output tokens are sampled using top-k sampling with k = 40.Source: §3.3 · p. 5
  • During training, constants are replaced by ⟨C⟩ placeholders so GPT predicts a skeleton equation rather than exact constant values.This separates learning the equation structure from learning its constants.Source: §3.3 · p. 5

3.4 Learning Constants

SymbolicGPT fits constants after predicting an equation skeleton, using BFGS optimization to produce the final expression.

3.4 Learning Constants

  • Fitting constants after skeleton prediction is described as a common strategy for string-based regression methods.Source: §3.4 · p. 6
  • After the model predicts a skeleton, BFGS optimization learns the constant values and replaces the ⟨C⟩ placeholders to form the final expression.The implementation uses SciPy.Source: §3.4 · p. 6
  • The optimized constants decorate the predicted skeleton, yielding a symbolic expression for the regression task.Source: §3.4 · p. 6

3.5 Evaluation Metric

The evaluation metric is normalized mean square error, which addresses large residuals that can occur for data with large values even when predictions are close to the true equation.

3.5 Evaluation Metric

  • For data with large values, residuals can become large even when a predicted equation is close to the true underlying equation.Source: §3.5 · p. 6
  • The method normalizes mean square error by ∥y + ϵ∥2 to address this scale-related issue.ϵ avoids division by zero, and ∥·∥2 denotes the Euclidean norm.Source: §3.5 · p. 6
  • The resulting evaluation measure is called normalized mean square error, MSEN.Source: §3.5 · p. 6

3.6 Strengths and Advantages

SymbolicGPT replaces per-instance symbolic-regression training with a language-model approach that learns from datasets and their equations. Its stated advantages include reusable offline training, potential upgrades through newer language models, and scalability across input dimensions and inference speed.

3.6.1 One-Time Training

  • One-time offline training lets a single trained model solve new regression instances without restarting training for each dataset.After training, solving an instance is inference, with time spent reading the dataset, obtaining its T-Net embedding, and optimizing constants.Source: §3.6.1 · p. 6

3.6.2 GPT Technology

  • The GPT-based approach is expected to improve as language models evolve by replacing GPT with a newer, more powerful alternative.The authors state that this replacement would require no extra design or implementation effort.Source: §3.6.2 · p. 6

3.6.3 Scalability

  • SymbolicGPT scales to multiple input variables and faster inference by inferring dimension from input points and performing constant optimization only once.The authors report that it produces superior results with significantly less computation time.Source: §3.6.3 · p. 6

4 Experiments and Results

The experiments compare SymbolicGPT with symbolic-regression and neural-regression baselines across four input-dimension settings. The reported results include stronger fitting accuracy, lower error with fewer datapoints, and substantially faster per-instance solving.

4 Experiments and Results

  • SymbolicGPT was trained for four epochs on 10,000 generated instances per dimensional setting and compared with DSR, GP, GP Max, and an MLP baseline.The input datasets and equation labels form the training pairs; validation and test sets each contain 1,000 pairs.Source: §4 · p. 7
  • Each method was tested on 1,000 instances in each of four settings, with MSEN as the fitness metric; Figure 2 summarizes error-threshold performance.The settings use one, two, or three input variables, or a general setting with one to five variables.Source: §4 · p. 7
  • SymbolicGPT finds better-fitting equations for more test cases than DSR and more equations with log MSEN < −10 than any other tested method.Figure 2 shows cumulative proportions of test cases below each log-MSEN threshold.Source: Figure 2 · p. 8
  • SymbolicGPT solves an instance significantly faster than other methods, often by an order of magnitude or more.Table 1 reports mean running times and standard deviations; most computation is shifted to offline model setup.Source: §4 · p. 8, Table 1 · p. 8
  • With 50-point datasets, SymbolicGPT achieves lower regression error than the other algorithms do with up to 500 points.All methods improve as more datapoints are provided; SymbolicGPT has lower error regardless of point count, although it was trained on datasets of 500 points.Source: §4 · p. 8, Figure 3 · p. 9

5 Conclusions

The method combines language models, symbolic mathematics, and order-invariant point-cloud representations, while avoiding per-instance computation expense and resolving input restrictions of other language-based regression models.

  • The method is fast, scalable, and performs competently across several kinds of symbolic regression problems compared with existing approaches.Source: §5 · p. 10
  • The approach combines language models with symbolic mathematics and order-invariant representations of point clouds.Source: §5 · p. 10
  • The method eliminates per-instance computation expense found in most regression methods and resolves input restrictions of other language-based regression models.Source: §5 · p. 10
Loading 2106.14131v1…