Re-export: bake softmax/sigmoid into the graph (4 named probability outputs); external-data weights + export manifest
Browse filesFiles changed (6)
- .gitattributes+1
- README.md+34-22
- alignscore-export-manifest.jsonAdded+18
- alignscore-large.onnx+2-2
- alignscore-large.onnx.dataAdded+3
- tokenizer.json+1-1
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textalignscore-large.onnx.data filter=lfs diff=lfs merge=lfs -text
33 unmodified lines3435363738394041424344454647481 unmodified line505152535455565758596061626364656667686970717273747576772 unmodified lines808182838485868788899091929394959697989933 unmodified lines## What this isThis is a faithful ONNX export of the encoder + pooler + the two heads used foralignment scoring:- a RoBERTa-large encoder with pooling layer (`pooler_output = tanh(dense(h[:,0]))`)- `tri_layer`: `Linear(hidden, 3)` -> raw 3-way logits- `reg_layer`: `Linear(hidden, 1)` -> raw regression logitActivations are **not** baked into the graph: it emits raw logits, and thecaller applies `softmax` to the 3-way head and `sigmoid` to the regression head.### Graph I/O1 unmodified line|--------|-----------|------|-------|| `input_ids` | input | int64 | `[batch, seq]` (dynamic) || `attention_mask` | input | int64 | `[batch, seq]` (dynamic) || `tri_logits` | output | float32 | `[batch, 3]` -> softmax -> `[p_aligned, p_neutral, p_contradict]` || `reg_logit` | output | float32 | `[batch, 1]` -> sigmoid -> `p_aligned_reg` |There is no `token_type_ids` input: a sentence pair is encoded into a single`input_ids` sequence with `</s></s>` separators, exactly as`AutoTokenizer("roberta-large")(context, claim)` produces. The bundled`tokenizer.json` is the matching fast tokenizer. Use `max_length=512`.Opset 17. Exported with PyTorch (TorchScript exporter).## Files- `alignscore-large.onnx` - the model (~1.36 GB)- `tokenizer.json` - roberta-large fast tokenizer with the pair post-processor## ParityVerified against the original PyTorch model's scores on a 136-pair corpus:**max absolute difference 1.18e-07** across both directions and all fourprobabilities. The source checkpoint SHA-256 is asserted equal to the referencebefore export, so these are provably the same weights. A high-confidencecontradiction pair scores `p_contradict_3way` 0.982 / 0.977 (forward / reverse).## Usage (ONNX Runtime, Python)2 unmodified linesfrom tokenizers import Tokenizertok = Tokenizer.from_file("tokenizer.json")sess = ort.InferenceSession("alignscore-large.onnx")def score(context, claim):enc = tok.encode(context, claim)ids = np.array([enc.ids], dtype=np.int64)mask = np.array([enc.attention_mask], dtype=np.int64)tri, reg = sess.run(["tri_logits", "reg_logit"],{"input_ids": ids, "attention_mask": mask})e = np.exp(tri[0] - tri[0].max()); tri_p = e / e.sum()return {"p_aligned_3way": float(tri_p[0]),"p_neutral_3way": float(tri_p[1]),"p_contradict_3way": float(tri_p[2]),"p_aligned_reg": float(1 / (1 + np.exp(-reg[0][0]))),}```33 unmodified lines3435363738394041424344454647484950511 unmodified line5354555657585960616263646566676869707172737475767778798081828384858687882 unmodified lines91929394959697989910010110210310410510610710810911011133 unmodified lines## What this isA faithful ONNX export of the encoder + pooler + the two alignment-scoring heads,with the output activations **baked into the graph** so the model emits the fourprobabilities directly:- a RoBERTa-large encoder with pooling layer (`pooler_output = tanh(dense(h[:,0]))`)- `tri_layer`: `Linear(hidden, 3)` -> `softmax` -> 3-way probabilities- `reg_layer`: `Linear(hidden, 1)` -> `sigmoid` -> alignment probabilityThis is the key difference from the earlier revision of this repo, which emittedraw `tri_logits` / `reg_logit` and left `softmax`/`sigmoid` to the caller. Bakingthe activations in makes the graph self-contained: a single direction scores a`(context, claim)` pair straight to probabilities, no post-processing.### Graph I/O1 unmodified line|--------|-----------|------|-------|| `input_ids` | input | int64 | `[batch, seq]` (dynamic) || `attention_mask` | input | int64 | `[batch, seq]` (dynamic) || `p_aligned_3way` | output | float32 | `[batch]` (softmax over tri head, aligned) || `p_neutral_3way` | output | float32 | `[batch]` (softmax over tri head, neutral) || `p_contradict_3way` | output | float32 | `[batch]` (softmax over tri head, contradict) || `p_aligned_reg` | output | float32 | `[batch]` (sigmoid over reg head) |There is no `token_type_ids` input: a sentence pair is encoded into a single`input_ids` sequence with `</s></s>` separators, exactly as`AutoTokenizer("roberta-large")(context, claim)` produces. The bundled`tokenizer.json` is the matching fast tokenizer. Use `max_length=512`.Opset 17. Weights are stored as ONNX external data in `alignscore-large.onnx.data`(the `.onnx` is the graph; keep the two files side by side). The`alignscore-export-manifest.json` records the source checkpoint SHA-256, theupstream HF revision, the opset, and the exact input/output tensor names.## Files- `alignscore-large.onnx` - the model graph (~0.2 MB)- `alignscore-large.onnx.data` - external weights (~1.4 GB); must sit next to the `.onnx`- `alignscore-export-manifest.json` - checkpoint SHA-256, HF revision, opset, I/O names- `tokenizer.json` - roberta-large fast tokenizer with the pair post-processor## ParityVerified against the original PyTorch model's scores on a 136-pair corpus:**max absolute difference 5e-06** on `p_contradict_3way` and **0** on`p_aligned_reg`, across both directions, with **zero** verdict flips through adownstream 0.75 bidirectional contradiction gate. The source checkpoint SHA-256is asserted equal to the reference before export, so these are provably the sameweights.## Usage (ONNX Runtime, Python)2 unmodified linesfrom tokenizers import Tokenizertok = Tokenizer.from_file("tokenizer.json")sess = ort.InferenceSession("alignscore-large.onnx") # loads .onnx.data automaticallydef score(context, claim):enc = tok.encode(context, claim)ids = np.array([enc.ids], dtype=np.int64)mask = np.array([enc.attention_mask], dtype=np.int64)pa, pn, pc, pr = sess.run(["p_aligned_3way", "p_neutral_3way", "p_contradict_3way", "p_aligned_reg"],{"input_ids": ids, "attention_mask": mask},)return {"p_aligned_3way": float(pa[0]),"p_neutral_3way": float(pn[0]),"p_contradict_3way": float(pc[0]),"p_aligned_reg": float(pr[0]),}```
123456789101112131415161718{ "schema_version": 1, "checkpoint_sha256": "ff4336312b377edcbcdad5694a2d09d73dc4225422c0422d810aa7e78485e32d", "hf_revision": "8509e78d25bb914939fc585c626500c9b2944249", "opset": 17, "encoder_name": "roberta-large", "input_names": [ "input_ids", "attention_mask" ], "output_names": [ "p_aligned_3way", "p_neutral_3way", "p_contradict_3way", "p_aligned_reg" ], "generated_at": "2026-07-05T03:01:18Z"}123version https://git-lfs.github.com/spec/v1oid sha256:350be954d95762c12157682aae77cd84699e189f6752d0caf8d38298b2ef2f90size 1421893132123version https://git-lfs.github.com/spec/v1oid sha256:7c4a95d87043d6a543d5089d3363ac0c3168bbfee93be06dadb7c36e9d9d3c76size 210708
123version https://git-lfs.github.com/spec/v1oid sha256:7c842f392dae6a5c777bb9792332731a14d53719815afac394f1ea1f0ce29c03size 142157824049 unmodified lines5051525354555649 unmodified lines"single_word": false,"lstrip": true,"rstrip": false,"normalized": true,"special": true}],49 unmodified lines5051525354555649 unmodified lines"single_word": false,"lstrip": true,"rstrip": false,"normalized": false,"special": true}],
.gitattributes+1
README.md+34-22
alignscore-export-manifest.jsonAdded+18
alignscore-large.onnx+2-2
alignscore-large.onnx.dataAdded+3
tokenizer.json+1-1