Gröbner basis computation via learning

Hiroshi Kera, Yuki Ishihara, Tristan Vaccon, Kazuhiro YokoyamaSCSS (Work in Progress) 2024

Abstract

Computing Gröbner bases is a fundamental task in computational algebra with doubly exponential worst-case time complexity. This paper presents the first machine learning approach to this problem, utilizing Transformers and a novel "backward" data generation method. Our results demonstrate that Transformers can effectively learn to compute Gröbner bases for specific classes of polynomial ideals, providing a fast heuristic for traditionally intractable problems.

Introduction

In computational algebra, a Gröbner basis serves as a powerful tool for simplifying systems of polynomials, analogous to the reduced row echelon form in linear algebra. However, the computation of these bases is NP-hard and notoriously slow. This research explores whether machine learning, specifically Transformer architectures, can bypass these expensive computations. The primary challenge lies in generating the massive datasets required for training, as traditional "forward" algorithms are too slow to produce millions of samples.

Methodology: Backward Data Generation

To overcome the data bottleneck, the authors propose a backward generation approach. Instead of the traditional method of starting with a polynomial system and computing its basis, they start with a randomly generated Gröbner basis and "scramble" it into a non-Gröbner system while preserving the underlying ideal.

  1. Basis Generation: The study focuses on 0-dimensional radical ideals in shape position, allowing for efficient sampling of univariate polynomials that form a valid basis.
  2. Scrambling: The basis is multiplied by a polynomial matrix constructed via Bruhat decomposition, ensuring mathematical equivalence between the original basis and the resulting complex system.
  3. Model Architecture: A standard Transformer with 6 layers and 8 attention heads is trained on these sequences, representing polynomials as text strings using prefix representation.

Experimental Results

The authors evaluated their approach using 12 datasets ($\mathscr{D}_n(k)$) covering various variable counts ($n \in \{2, 3, 4, 5\}$) and fields (rational numbers $\mathbb{Q}$ and finite fields $\mathbb{F}_7, \mathbb{F}_{31}$).

Data Generation Efficiency

The backward generation method proved to be several orders of magnitude faster than standard forward algorithms. As shown in the table below, for $n=5$ variables, the backward method generated 1,000 samples in just 0.014 seconds, compared to over 1,300 seconds for traditional methods.

Comparison of data generation times (in seconds) between forward (F.) and backward (B.) methods across different variable counts (n).

Model Performance and Accuracy

The Transformer achieved high accuracy on infinite fields ($\mathbb{Q}$), reaching a 96.2% exact match rate for $n=4$. However, performance declined on finite fields, likely due to the model's difficulty with modular arithmetic. Interestingly, the "support accuracy" (predicting the correct terms even if coefficients are wrong) remained consistently high across all configurations, often exceeding 90%.

Model accuracy (Exact Match / Support Accuracy) across different rings and variable counts.

Discussion and Conclusion

The "backward generation" technique is a significant contribution, transforming an impossible data-gathering task into a trivial one. While the model currently struggles with modular arithmetic in finite fields and is limited to specific ideal classes, its high support accuracy suggests it can serve as a valuable heuristic to accelerate exact mathematical algorithms. Future work will focus on expanding the scope of polynomial ideals and improving architectures for algebraic reasoning.

Summary updated

BibTeX
@inproceedings{kera2024grobner,
  author = {Hiroshi Kera and Yuki Ishihara and Tristan Vaccon and Kazuhiro Yokoyama},
  title = {{Gröbner basis computation via learning}},
  booktitle = {SCSS (Work in Progress)},
  year = {2024},
}
Figure