File size: 5,565 Bytes
c1b7d02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
868b422
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
license: apache-2.0
library_name: kernels
tags:
  - kernel
  - governance
  - lambda
  - gate
  - provenance
  - szl-holdings
  - doi:10.5281/zenodo.19944926
---

# szl-lambda-gate

**Λ, a governance aggregator, as a pure-PyTorch (noarch) kernel.** A differentiable,
`torch.compile`-friendly weighted-geometric-mean aggregator with an ADVISORY
non-compensatory gate, the strict `szl.lambda/v1` entry point and runtime axiom
self-checks, from [SZL Holdings](https://huggingface.co/SZLHOLDINGS).

This repository is published from GitHub
[szl-holdings/szl-lambda-gate](https://github.com/szl-holdings/szl-lambda-gate) by its
`hf-kernel-publish` workflow, which is its only writer. GitHub is the source of truth:
every file under `build/` is a byte copy of `torch-ext/szl_lambda_gate` at the commit
named in `SZL_KERNEL_SOURCE.json`.

## Load it

```python
# pip install "kernels>=0.17.2" torch
import torch
from kernels import get_kernel

lg = get_kernel("SZLHOLDINGS/szl-lambda-gate", version=1, trust_remote_code=True)

axes = torch.tensor([0.9, 0.8, 0.95], dtype=torch.float64)   # axis scores in [0,1]
weights = torch.tensor([0.5, 0.25, 0.25], dtype=torch.float64)
gate = lg.lambda_v1_gate(axes, weights, tau=0.8)              # GO / NO_GO / ABSTAIN / BLOCK
print(gate.verdict, gate.code)

print(lg.lambda_aggregate(axes))   # legacy Λ(x) in [0,1]
print(lg.selfcheck())              # empirical A1-A4 checks, not a proof
```

- `version=1` resolves the `v1` branch, the stable API channel. It
  is republished on every release. The `kernels` library refuses a call that names neither
  a version nor a revision.
- `trust_remote_code` is required: SZLHOLDINGS is not a trusted kernel publisher on the Hub.
  The narrowest form is `trust_remote_code=["SZLHOLDINGS/szl-lambda-gate"]`.
- CPU hosts load `build/torch-cpu`; CUDA and other hosts load `build/torch-universal`.
  Both variants carry identical code, built from the same GitHub commit.

### Pin an exact build (production)

```python
from huggingface_hub import HfApi
from kernels import get_kernel

refs = HfApi().list_repo_refs("SZLHOLDINGS/szl-lambda-gate", repo_type="kernel")
pin = next(b.target_commit for b in refs.branches if b.name == "v1")
lg = get_kernel("SZLHOLDINGS/szl-lambda-gate", revision=pin, trust_remote_code=["SZLHOLDINGS/szl-lambda-gate"])
```

Record `pin` (a commit of this kernel repository) in your lockfile. Commits of the
model repository [https://huggingface.co/SZLHOLDINGS/szl-lambda-gate](https://huggingface.co/SZLHOLDINGS/szl-lambda-gate) are not kernel revisions and
do not resolve here.

## What Λ is, and is not

Λ is the weighted geometric mean over axis scores in [0,1]:
Λ(x) = ∏ xᵢ^wᵢ with Σ wᵢ = 1, wᵢ > 0. It is a non-compensatory, ADVISORY roll-up: any
zero (or, in the legacy entry, non-finite) axis drives the aggregate to 0. A gate pass is
an advisory signal that the host must enforce; it is not proven trust. Λ uniqueness
remains **Conjecture 1 (open)**. The A1-A4 self-checks are empirical evidence on sampled
inputs, not a proof.

## API

| Entry | Notes |
|---|---|
| `lambda_v1(axes, weights)` / `lambda_v1_gate(axes, weights, tau)` | Strict `szl.lambda/v1` contract (`spec/szl.lambda.v1.json`): validated, never repaired; bad input returns `BLOCK` with a `LAMBDA_*` code; τ is required. |
| `lambda_aggregate(axes, weights=None)` | Legacy Λ over the last dim. Differentiable, batched. Clamps and renormalises (see the spec for the differences). |
| `lambda_gate(axes, weights=None, threshold=...)` / `lambda_gate_batch(...)` | Legacy advisory gate → `LambdaGateResult(score, passed, threshold, advisory)`. |
| `selfcheck()`, `is_monotone`, `is_homogeneous`, `is_egyptian_exact`, `is_bounded_by_max`, `find_axiom_violation` | Empirical A1-A4 checks and a falsification search. |
| `governed_norm` (`rms_norm`, `layer_norm`, `fused_add_rms_norm`) | Governed normalization with SHA3-256 hash-chained receipts. Also published standalone as [SZLHOLDINGS/szl-governed-norm](https://huggingface.co/kernels/SZLHOLDINGS/szl-governed-norm). |
| `layers.LambdaGate`, `layers.LambdaAggregate` | Pure `nn.Module` layers for kernel layer mapping. |

## Files

| Path | What it is |
|---|---|
| `build/torch-cpu/`, `build/torch-universal/` | The kernel package and its generated `metadata.json` (with a sha256 digest of every file). |
| `spec/szl.lambda.v1.json`, `spec/lambda_v1_vectors.json` | The `szl.lambda/v1` contract and its golden vectors. |
| `reference/szl_lambda_v1.py` | Stdlib-only reference implementation of the contract. |
| `SZL_KERNEL_SOURCE.json` | The GitHub commit and per-file sha256 this tree was built from. |
| `build.toml`, `LICENSE` | Kernel build manifest and Apache-2.0 license, copied from GitHub. |

No speedup, throughput or energy figure is claimed for this kernel. Test results live
in GitHub Actions for the source commit.

## License and citation

Apache-2.0. Copyright 2026 SZL Holdings. Concept DOI
[10.5281/zenodo.19944926](https://doi.org/10.5281/zenodo.19944926); see `CITATION.cff` in
the GitHub repository.

## Card completeness (2026-11-12)

This section adds required card sections the card above did not have. It states only what files in this repository and the estate's own receipt datasets show; nothing here is a new result.

### Benchmarks

Not yet benchmarked. As of 2026-11-12 this repository has no benchmark results (latency, throughput or correctness-vs-reference timings). Published builds: `torch-cpu`, `torch-universal`. No GPU build is published, so no GPU performance claim is made.