This release is a pre-release and may not be stable for production use.
omnibias-binary
Hard values. A trainable backward path. Forward representation and backward optimization have separate contracts.
Static poster · Narrow-screen animation · How this visual is computed
Real-valued tensors enter; hard binary, ternary or quantized values leave in the forward pass. The backward pass follows an explicitly chosen smooth surrogate, allowing optimization through a discrete representation.
The animation uses computed outputs to explain this package. Frame transitions are illustrative unless a training step is explicitly identified; it is not a performance comparison.
API reference · Source · Tests · Talk to Derivon
The mathematical connection
Temperature controls the tanh-based surrogate: higher β concentrates its gradient near the threshold. The hard forward operation remains hard; the surrogate is not its classical derivative. Bias-collapse activation polynomials supply higher derivative formulas for the smooth path. Threshold and tie conventions belong to each quantizer.
Run this README
The examples use omnibias-binary[torch] on Python >=3.10. Their installed-wheel
profile selects runtime features, not an editable workspace. Install the prepared
prerelease from PyPI:
python -m pip install --pre "omnibias-binary[torch]==0.1.0a2"
For local development before publication, build and test the coordinated wheelhouse using the release guide. The package's wheel profile executes the examples below outside the source checkout.
Existing published consumers may need historical primitive versions; see the compatibility policy.
Why this package exists
A hard quantizer provides the output representation you want but loses an ordinary useful derivative almost everywhere. Binary makes the optimization choice explicit: keep hard forward values and use a temperature-controlled Riccati derivative in the backward path. This gives quantized models a reusable gradient mechanism.
What you can build
- Signed and zero/one binarization, ternary and k-bit quantizers.
- Torch and JAX surrogate-gradient implementations.
- Beta schedules and shared activation-polynomial derivatives.
Use binary for quantization-aware experiments, differentiable Boolean realizations and models with hard-valued intermediate states. Compare forward accuracy, surrogate conditioning and deployment behavior separately; a useful training surrogate is a modeling decision that should be evaluated on the target task.
A working example
import torch
from omnibias.binary.torch.ops import binarize
z = torch.tensor([-0.8, 0.3, 1.2], requires_grad=True)
q = binarize(z, beta=2.0)
q.sum().backward()
assert torch.all((q == -1) | (q == 1))
assert z.grad is not None and torch.isfinite(z.grad).all()
Choose the right contract
The backward formula is not the classical derivative of a discontinuous quantizer. A sharper temperature can produce narrow or saturated gradient regions. Keep the surrogate definition in experiment provenance, and test higher parameter derivatives when an optimizer relies on them.
Explore and validate
The API guide contains the generated module/export inventory. Use it to find the focused implementation rather than guessing a symbol from another package. The capability map connects the primitives to larger scientific workflows.
From the main repository, run the package’s regression suite:
uv run pytest packages/omnibias-binary/tests -q
License
Apache-2.0. See LICENSE and the licensing policy.
Metadata
Release files for omnibias-binary 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| omnibias_binary-0.1.0a2.tar.gz | 22.0 kB | With provenance | Details for omnibias_binary-0.1.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| omnibias_binary-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details for omnibias_binary-0.1.0a2-py3-none-any.whl |
Total release size: 42.8 kB
Release files / omnibias_binary-0.1.0a2.tar.gz
| Download URL | omnibias_binary-0.1.0a2.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79b9d6238cae9e506e7344ea600c3c6c384ca300d1de1fab9ab4596fa97086b8
|
|
BLAKE2b-256 checksum How to use checksums |
5fd67cd1c1d5832831be145457dbd7076657fb4ba29539c4129d47be2ec2f5db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / omnibias_binary-0.1.0a2-py3-none-any.whl
| Download URL | omnibias_binary-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9ed17dca9da66f2161f2654cf70e82695a4b3a477f23891da586c2305f6f669
|
|
BLAKE2b-256 checksum How to use checksums |
e710d5cb8fd08356d5d04fe3898e52f6b94a3b928c1188c6425e13c5b85d3a86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logSecurity for omnibias-binary 0.1.0a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for omnibias_binary-0.1.0a2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.