Skip to main content

Compiler for the Sutra programming language — tensor ops on frozen-LLM embedding vectors.

Project description

sutra-compiler

The compiler for the Sutra programming language — a purely functional language whose primitives are tensor operations on frozen-LLM embedding vectors.

Install

pip install sutra-dev                     # validator + codegen only
pip install "sutra-dev[runtime]"          # adds torch so --emit / --run can execute the generated module
pip install "sutra-dev[runtime,embed]"    # adds the embedding client for LLM-substrate codebooks

Requires Python 3.11+.

Use

After install, the sutrac command is on your $PATH.

# Validate a .su source file.
sutrac path/to/program.su

# Validate every .su file under a directory.
sutrac path/to/directory

# Compile to self-contained PyTorch Python and print to stdout.
sutrac --emit path/to/program.su

# Compile and execute in one step (requires the [runtime] extra installed).
sutrac --run path/to/program.su

# Step-by-step compilation review (source → AST → inline → simplify → emit).
sutrac --review path/to/program.su

# Cross-file class-name casing check.
sutrac --consistency path/to/directory

sutrac --help lists every flag.

What is Sutra

A .su source file looks like TypeScript — functions, classes, && / ||, string and numeric literals — but every value is a vector in a frozen LLM embedding space, and every operation is a tensor op on those vectors. The compiler emits self-contained Python that calls a small runtime; chains of bind / unbind / bundle / similarity reduce to chains of matrix multiplies that the simplifier folds into cached matrices at compile time.

The result is a program where there are no Python branches, no host-side if / while on data values, and no JIT — just one straight-line tensor expression.

For a full introduction, see sutra.topazcomputing.com. For the language specification and design rationale, see the Sutra repository.

Status

Research-grade. Versions before 1.0 may break source compatibility. The grammar is stable; the codegen and the standard library still move.

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

sutra_dev-1.0.0.tar.gz (541.5 kB view details)

Uploaded Source

Built Distribution

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

sutra_dev-1.0.0-py3-none-any.whl (389.6 kB view details)

Uploaded Python 3

File details

Details for the file sutra_dev-1.0.0.tar.gz.

File metadata

  • Download URL: sutra_dev-1.0.0.tar.gz
  • Upload date:
  • Size: 541.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for sutra_dev-1.0.0.tar.gz
Algorithm Hash digest
SHA256 622f9d5be8844cd9cefc9379ec51a0648cda5f4dab63f149bc612baa4a7aa07d
MD5 1cd50e244c641a1d23fac36906e40601
BLAKE2b-256 8af9879e0e94f9ecf955602f2120ae898ced3ea758042f0c2dfb49fad89c499c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sutra_dev-1.0.0.tar.gz:

Publisher: publish-sutra-compiler.yml on EmmaLeonhart/Sutra

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

File details

Details for the file sutra_dev-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sutra_dev-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 389.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for sutra_dev-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b41b8671da2eeb72f1e85f71a0878554b9b67d3743f3f2f2159f0b9732de77d8
MD5 850284c3068f163dcbb2992be8b03d4c
BLAKE2b-256 64a694dde8cc1ed8f2bde40a1bf077fafd5efd4474e7ce63050b538d3b15613c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sutra_dev-1.0.0-py3-none-any.whl:

Publisher: publish-sutra-compiler.yml on EmmaLeonhart/Sutra

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