Skip to main content

g2n — run models that don't fit, on the GPU you already have

A PyTorch compiler (custom FX fusion passes, a Triton LayerNorm kernel, a persistent compile cache) plus a license-gated runtime that serves models and runs local LLMs larger than your VRAM. Also ships g2n.quantum, a statevector quantum circuit simulator (classical simulation — not quantum hardware).

Measured on a single RTX 4050 Laptop (6 GB) with benchmarks/bench.py in this repo — run it on your own card and post what you get:

  • EuroLLM-9B at int4 weights, generating at 2.89 tok/s on a 6 GB card. 33 of its 42 layers stay resident; the rest stream from pinned host RAM with the transfers overlapped against compute. The planner sizes that split automatically and lands within 0.3% of the best split found by sweeping every option by hand.
  • 3.5× faster cold compile than stock torch.compile on a post-reboot run.
pip install g2n torch
import torch, g2n

compiled = g2n.compile(model)     # == torch.compile(model, backend="g2n")
y = compiled(x)

Free (Community) gives you the g2n fusion passes on stock Inductor and quantum circuits up to 24 qubits. A license key unlocks more — activation is one command and then fully offline:

export G2N_LICENSE_KEY=G2N-XXXX-XXXX-XXXX
g2n activate && g2n status
Unlock Tier
Persistent compile cache (warmup once per machine, not per run) Pro
Enhanced planner: epilogue fusion + custom Triton kernels Pro
Serving platform (pip install g2n-enterprise): registry, HTTP node, quantization incl. weight-only int8, CUDA graphs Pro
Quantum: unlimited qubits + circuit fusion Pro
max-autotune, dynamic batching, batched quantum sweeps, model zoo Enterprise

Run a .g2n packaged model — free, no license

A .g2n pack is a model that is already quantized on disk, so opening it is an mmap instead of a re-quantization. Reading one is free and unlicensed and lives right here in the Apache-2.0 package:

from g2n.pack import load_packed, inspect

print(inspect("qwen3-8b-int4.g2n")["precision"])   # works with no torch installed
model, manifest = load_packed("qwen3-8b-int4.g2n")

The loader builds the module tree on device="meta" (allocating nothing), then binds the packed tensors straight from the memory-mapped file — no fp16 intermediate and no quantization work at load. Creating a pack (g2n pack) is a paid feature; running one never is.

Quantum in 20 seconds

import g2n.quantum as qf
c = qf.Circuit(2).h(0).cnot(0, 1)      # Bell state
c.measure_all(shots=1000)              # {'00': ~500, '11': ~500}
c.expectation("ZZ")                    # tensor(1.)

Guarantees

  • Never worse than eager: any compile failure returns your unmodified model with a one-line warning.
  • Offline after activation: license tokens are Ed25519-verified locally; no phone-home during runs.
  • Honest numbers: no benchmark claim without named hardware and a script to reproduce it — including on your own machine.

Docs, pricing, benchmarks: g2n.dev · full manual at g2n.dev/docs · questions: support@g2n.dev.

What's open and what isn't

This repository is the free core: the compiler, the fusion passes and the quantum simulator, Apache-2.0, no obfuscation. The LLM offload and serving numbers quoted above come from g2n-enterprise, which is proprietary and paid. Nothing in either package phones home during a run.

Download files

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

Source Distribution

g2n-1.7.3.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

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

g2n-1.7.3-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file g2n-1.7.3.tar.gz.

File metadata

  • Download URL: g2n-1.7.3.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for g2n-1.7.3.tar.gz
Algorithm Hash digest
SHA256 380f365ddf748c488e15455b5d47c4449bfa9b627a2290b7a75dfa1502d2695f
MD5 a62c2f3eef21d75e02368230ed313129
BLAKE2b-256 9f23dbbe49249dc4e968e582ab8e7f749497022e20619a61f9efd5dc4c45d31c

See more details on using hashes here.

File details

Details for the file g2n-1.7.3-py3-none-any.whl.

File metadata

  • Download URL: g2n-1.7.3-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for g2n-1.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e109ffa95d88e0c270cf8b7e1a8ad617ab5e6ab6127a3d3b9e430842e20a5620
MD5 d1537e397645b2cb9748fb64fe39b824
BLAKE2b-256 52af50b7513dcddc0a2a313016b630db1f4c64288f577e0791fca7ca1e00e4e1

See more details on using hashes here.

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