TL;DR
This paper introduces a novel framework for automatically discovering computationally efficient mathematical identities using attribute grammars and machine learning. By learning to guide a search through the space of possible expressions, the authors demonstrate the ability to find complex identities that significantly reduce computational complexity, outperforming brute-force and random search methods.
What Problem Does This Paper Address?
Discovering mathematically equivalent but computationally simpler expressions (identities) is a challenging problem. While symbolic computation systems can simplify expressions, they don't inherently optimize for computational cost. Manually deriving such identities is difficult and time-consuming, especially for complex expressions. The authors aim to automate this discovery process by leveraging machine learning to efficiently search for these optimized identities within a defined grammar of mathematical operations.
Methods
The core of the approach is an attribute grammar that defines mathematical operations and their associated computational complexity. Expressions are represented as trees derived from this grammar. To tackle the exponentially growing search space, the authors introduce two learning-based search strategies:
- n-gram models: These models learn the frequency of subtrees appearing in previously discovered solutions, using this information to guide the search for new identities.
- Recursive Neural Network (RNN): An RNN is trained to learn a continuous representation of symbolic expressions. This learned representation is then used by a softmax classifier to predict the next grammar rule to apply, effectively guiding the search towards efficient solutions.
The paper also introduces a numerical representation of expressions (using descriptors) for efficient checking of equivalence, which is crucial for training the learning models.
Datasets
The paper does not explicitly mention pre-existing datasets for training or evaluation. Instead, it describes the creation of a dataset of symbolic expressions for training the RNN. This dataset consists of expressions of varying degrees, grouped into classes of equivalent expressions identified using the numerical representation. For evaluating the identity discovery, the authors define five families of expressions, ranging in complexity and structure, which serve as benchmarks for their system.
Key Insights and Ideas
- Learning to search is key: The most significant insight is that machine learning can effectively guide the search for complex mathematical identities, overcoming the limitations of brute-force and random approaches.
- RNNs for symbolic representation: The successful application of RNNs to learn continuous representations of symbolic mathematical expressions is a novel contribution, opening doors for applying deep learning techniques to symbolic computation.
- Curriculum learning for complexity: Training the models on simpler expressions first and gradually increasing complexity (curriculum learning) proves effective in learning to discover more complex identities.
- Identities can be surprisingly complex: The paper demonstrates the discovery of identities that are non-obvious and would be difficult for humans to derive.
Key Results
- The RNN-based learned representation achieved high accuracy (e.g., >95% for degree 6 expressions) in classifying equivalent symbolic expressions.
- The learning-based search strategies (n-gram and RNN) significantly outperformed random search in discovering efficient identities, especially for higher degrees of complexity. For instance, for certain families, learning approaches could still find solutions at degree 15, while random search failed.
- The framework successfully discovered identities that reduced computational complexity from O(n³) to O(n²) for certain matrix operations, and from exponential to polynomial time for others.
- The paper provides numerous examples of newly discovered identities across five families of expressions, detailed in the supplementary material.
Limitations and Future Work
- Restricted setting: The current framework is limited to homogeneous polynomials of a fixed degree, with a single matrix or vector as input, and a scalar output. The authors suggest extending this to handle more general expressions, including trigonometric and exponential operators, and multiple variables.
- Grammar completeness: The effectiveness of the system is dependent on the completeness of the defined grammar rules. Discovering novel mathematical areas would require extending the grammar.
- Search termination: For more general grammars, determining when to terminate the search for a given tree might require more sophisticated scheduling.
- Broader applicability: The authors believe their framework has potential for broader applications in mathematics and integration with compilers for optimization, but this requires further research into more general grammar rules and scheduling mechanisms.
Summary updated