Skip to main content

A library for computational algebra using Transformers

Project description

CALT: Computer ALgebra with Transformer

Documentation GitHub Pages

📖 📚 View Full Documentation

Overview

CALT is a simple Python library for learning arithmetic and symbolic computation with a Transformer model (a deep neural model to realize sequence-to-sequence functions).

It offers a basic Transformer model and training, and non-experts of deep learning (e.g., mathematicians) can focus on constructing datasets to train and evaluate the model. Particularly, users only need to implement an instance generator for their own task.

For example, users define the following code for the polynomial addition task.

class PolynomialAdditionGenerator:
    # Task - input: F=[f_1, ..., f_s], target: G=[g:= f_1+...+f_s]
    def __init__(
        self, sampler: PolynomialSampler, max_polynomials: int, min_polynomials: int
    ):
        self.sampler = sampler
        self.max_polynomials = max_polynomials  
        self.min_polynomials = min_polynomials

    def __call__(self, seed: int) -> Tuple[List[PolyElement], PolyElement]:
        random.seed(seed) # Set random seed
        num_polys = random.randint(self.min_polynomials, self.max_polynomials) 

        F = self.sampler.sample(num_samples=num_polys)
        g = sum(F)

        return F, g

CALT automatically calls this generator in parallel to efficiently construct large datasets and trains a Transformer model to learn the computation. The sample generation process itself can reveal unexplored mathematical problems, enabling researchers to study their theoretical and algorithmic solutions. The following is a small list of such studies from our group.

Refer to our paper "CALT: A Library for Computer Algebra with Transformer," Kera et al., 2025 for a comprehensive overview.

🚀 Quick Start

Basic Installation

pip install calt-x

For Research Projects

For researchers and developers who want to start experiments with CALT, we provide the CALT codebase - a comprehensive template repository with pre-configured environment and development tools.

git clone https://github.com/HiroshiKERA/calt-codebase.git
cd calt-codebase
conda env create -f environment.yml 

📖 Documentation & Resources

🔗 Links

Citation

If you use this code in your research, please cite our paper:

@misc{kera2025calt,
  title={CALT: A Library for Computer Algebra with Transformer},
  author={Hiroshi Kera and Shun Arawaka and Yuta Sato},
  year={2025},
  archivePrefix={arXiv},
  eprint={2506.08600}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calt_x-1.0.2.tar.gz (83.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

calt_x-1.0.2-py3-none-any.whl (104.9 kB view details)

Uploaded Python 3

File details

Details for the file calt_x-1.0.2.tar.gz.

File metadata

  • Download URL: calt_x-1.0.2.tar.gz
  • Upload date:
  • Size: 83.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for calt_x-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9669b27dfa420ae93f4337f95b55a959345731c330cc5cec060f3665211d489a
MD5 715f57a23e45caf16d1e49e858e1d4ca
BLAKE2b-256 3d9083296a9abe092ee0a5b61cb5e23b3e90a5b6a365f647259dfc8b5c6344b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for calt_x-1.0.2.tar.gz:

Publisher: pypi-release.yml on HiroshiKERA/calt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file calt_x-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: calt_x-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 104.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for calt_x-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6389e9c0f9186aad776c6c00d14924fa1b0cc01c99887290c97fa8f97bbde6ea
MD5 e3fc404176bd32e1b31faeaac3597479
BLAKE2b-256 ae1d534a0b4bebef3e77b4e7d33cf7337026a7eb1b41b6e1261549270c477960

See more details on using hashes here.

Provenance

The following attestation bundles were made for calt_x-1.0.2-py3-none-any.whl:

Publisher: pypi-release.yml on HiroshiKERA/calt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page