Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
1
274
# CIS-2 conformance vector: attention_block_v1
# op=attention_block, spec ref: docs/CIS2_SPEC_v0.2.md §9.2 (Score), §9.3
# (Softmax), §9.4 (V-mix) -- one query head's full score/softmax/V-mix
# pipeline against a small causal KV cache. Deliberately covers ONE head
# only: GQA's `kv_head = qh / group` head-mapping (§9, opening paragraph)
# is a pure indexing detail on top of this same per-head arithmetic, not
# additional numeric behavior, so it is not separately vectored here.
# RoPE (§7, already covered by rope_v1) is assumed already applied to
# `q_head`/`k_j` inputs below, per §9.1's ordering (RoPE happens before
# scoring) -- this vector starts from already-rotated q/k, as the spec's
# §9.2 step itself does.
#
# Fields are `key=value`. `head_dim`/`seq_len` are plain decimal integers.
# `q_head_bits` is head_dim values (the current step's query head, already
# RoPE-rotated). `k_bits`/`v_bits` are `seq_len * head_dim` values,
# ROW-MAJOR (cached key/value at position 0's head_dim entries, then
# position 1, ... up to and including the current step `pos = seq_len -
# 1`, causal -- every cached position is attended, per §9.2's `j =
# 0..=pos`). All comma-separated `0x`-prefixed 32-bit hex IEEE-754 binary32
# bit patterns, per tests/conformance/README.md's general convention.
op=attention_block
spec_ref=docs/CIS2_SPEC_v0.2.md#9-attention-gqa-causal-per-decode-step-normative
head_dim=8
seq_len=3
q_head_bits=0x3F800000,0x3F000000,0xBF000000,0x40000000,0xBF800000,0x3E800000,0x3F400000,0xC0000000
k_bits=0x3F000000,0x3F800000,0x3F800000,0xBF800000,0x3F000000,0x3F000000,0xBF000000,0x3F800000,0x3F800000,0xBF800000,0x3F000000,0x3F000000,0x3F800000,0xBF000000,0x3F000000,0x3F000000,0xBF000000,0x3F000000,0x3F800000,0x3F800000,0xBF800000,0x3F800000,0x3F000000,0xBF000000
v_bits=0x3F800000,0x00000000,0x00000000,0x3F800000,0x3F000000,0x3F000000,0xBF000000,0x00000000,0x00000000,0x3F800000,0x3F000000,0x00000000,0x3F800000,0x00000000,0x3F000000,0x3F000000,0x3F000000,0x3F000000,0x3F800000,0xBF000000,0x00000000,0x3F800000,0x00000000,0x3F800000
# CIS-2 conformance vector: embed_lookup_v1
# op=embed_lookup, spec ref: docs/CIS2_SPEC_v0.2.md §2.5 (`model.embed_tokens.weight`
# tensor, shape [vocab, hidden], row-major) as consumed by the per-decode-step
# token-embedding lookup in `src/main.rs`'s forward pass (the step
# immediately preceding §9's attention block: `let start = token_id as
# usize * hidden; h = model.embed_tokens[start..start+hidden].to_vec();`).
# This lookup is pure indexing/copy of already-widened fp32 table rows --
# no floating-point arithmetic is performed -- so it is bit-exact by
# construction; the vector exists to pin the row-major indexing
# convention itself (`start = token_id * hidden`, contiguous slice of
# length `hidden`), not any numeric computation.
#
# Fields are `key=value`. `vocab`/`hidden` are plain decimal integers.
# `embed_bits` is `vocab * hidden` values, row-major (row 0 = token 0's
# hidden-wide embedding, then row 1, ...), comma-separated `0x`-prefixed
# 32-bit hex IEEE-754 binary32 bit patterns, per
# tests/conformance/README.md's general convention. `token_ids` is a
# comma-separated list of plain decimal u32 token ids to look up, in
# order -- a conforming implementation performs one lookup per id and
# concatenates the results in that same order (bundling several lookups
# into one vector, same rationale as matvec_v1's several output rows /
# attention_block_v1's several cached KV positions in a single call).
#
# vocab=4, hidden=6 (deliberately small and hand-sized, same rationale as
# the other vectors' small dimensions). token_ids=0,3,1 deliberately
# exercises the first row (offset 0), the LAST row (offset =
# (vocab-1)*hidden, the largest valid start index), and a middle row, in
# a non-monotonic order, to catch an off-by-one or wrong-stride indexing
# bug that a monotonic 0,1,2 order could hide. Row values are
# `token*10 + d` for d in 0..hidden, small exactly-representable
# integers chosen purely so a mis-indexed row is trivially visible in
# the output, not to model any real embedding.
op=embed_lookup
spec_ref=docs/CIS2_SPEC_v0.2.md#25-tensor-names-and-shapes-normative
vocab=4
hidden=6
embed_bits=0x00000000,0x3F800000,0x40000000,0x40400000,0x40800000,0x40A00000,0x41200000,0x41300000,0x41400000,0x41500000,0x41600000,0x41700000,0x41A00000,0x41A80000,0x41B00000,0x41B80000,0x41C00000,0x41C80000,0x41F00000,0x41F80000,0x42000000,0x42040000,0x42080000,0x420C0000
token_ids=0,3,1
# CIS-2 conformance vector: exp_pinned_v1
# op=exp_pinned, spec ref: docs/CIS2_SPEC_v0.2.md §6.2 (pinned exp(x)
# polynomial, route (b) fallback described in src/math.rs::exp_pinned).
#
# Fields are `key=value`. x_bits is a comma-separated list of
# `0x`-prefixed 32-bit hex strings, each the raw IEEE-754 binary32 bit
# pattern of one input element, in index order (index 0 first).
#
# n=8, deliberately small and hand-sized (same rationale as rmsnorm_v1's
# n=8 / rope_v1's head_dim=8), spanning §6.2's documented accuracy domain
# `x in [-40,40]` (softmax post-max-sub args <= 0, SiLU gate args, RoPE
# inv_freq exponents): the two domain endpoints (-40, 40), a couple of
# mid-range values on each side (-10, -1, 10), the two special values
# 0.0 and 1.0 (exp(0)=1 exactly is a useful bit-exact sanity check), and
# 0.5 to exercise a non-integer, non-zero small positive value.
op=exp_pinned
spec_ref=docs/CIS2_SPEC_v0.2.md#62-pinned-transcendentals
n=8
x_bits=0xC2200000,0xC1200000,0xBF800000,0x00000000,0x3F000000,0x3F800000,0x41200000,0x42200000
# CIS-2 conformance vector: matvec_v1
# op=matvec, spec ref: docs/CIS2_SPEC_v0.2.md §5.2 (Matvec), which in turn
# depends on §5.1 (strict left-to-right sequential dot product, `dot_seq`).
#
# Fields are `key=value`. `out_features`/`in_features` are plain decimal
# integers (small config constants, no float-parsing ambiguity).
# `w_bits` is `out_features * in_features` values, ROW-MAJOR (row `o`'s
# `in_features` entries first, then row `o+1`, ...), each a
# comma-separated `0x`-prefixed 32-bit hex IEEE-754 binary32 bit pattern
# (per tests/conformance/README.md's general convention). `x_bits` is
# `in_features` values, the shared input vector.
op=matvec
spec_ref=docs/CIS2_SPEC_v0.2.md#52-matvec-normative
out_features=3
in_features=3
# Row 0 is §5.1's own worked example, verbatim: w[0,:] = [1e8, 1.0, -1e8]
End of preview. Expand in Data Studio

CIS-2 — conformance vectors for bit-identical fp32 transformer inference

Floating-point transformer inference is usually treated as unavoidably nondeterministic across hardware. Reduction order, FMA contraction, denormal handling and platform math libraries all differ between x86_64 and aarch64, and between compilers, so "the same model on the same input" in practice means "agrees to within a tolerance", not bit-for-bit.

CIS-2 is a written specification that removes those degrees of freedom, and this repository holds the artifacts a third party needs to check whether their own implementation conforms: the spec text, five op-level conformance vectors with pinned expected outputs, the expected end-to-end digests, and the GPU result.

Everything here is Apache-2.0. Source of truth and CI: https://github.com/Aefinity-AI/cis2-spec — tagged release v0.3b.

This dataset is a snapshot assembled from that repository. If the two ever disagree, the repository wins.

The claim

CIS2_REF, SmolLM2-135M, prompt "Once upon a time", 16 greedy tokens, spec v0.3b
  d82743059d1db929e710236fe4ec37f89e6f932524801345a006980f7c3cc9df

That digest is a SHA-256 witness chain folded over the complete fp32 logit vector at every decode step — not the argmax token, the whole vector. It is currently reproduced by:

implementation written from platforms
Rust reference — x86_64, aarch64 (native runners)
Rust clean-room verify2/ the spec text alone x86_64, aarch64
C11 clean-room verify3/ the spec text alone x86_64, aarch64 · gcc and clang
CUDA port (not published) the spec text alone NVIDIA Tesla P100, sm_60, CUDA 12.8

The two clean-room implementations were written without access to the reference source or to each other. Public CI re-checks all of the CPU rows on every push. The GPU row is documented in GPU_RESULT.md; on that run the per-step trace was byte-identical to the CPU trace, not merely equal at the final digest.

What is pinned

  • Reduction order — strictly left-to-right, sequential.
  • FMA contraction — forbidden, and gated by objdump in CI.
  • Denormals — FTZ/DAZ on, pinned via MXCSR (x86) and FPCR.FZ (aarch64).
  • Transcendentals — sin/cos by octant reduction plus separate Cephes-pattern minimax polynomials; exp and ln by pinned Cephes-pattern polynomials; rsqrt correctly rounded with no table. Every coefficient is pinned as an f32 hex literal and hashed into the witness chain.
  • RoPE inv_freq — pinned table, theta-general.
  • Tokenization — byte-level BPE pinned at the byte level.

Full normative text: CIS2_SPEC_v0.3b.md (§13.1 carries the pinned vector).

Files

file what it is
CIS2_SPEC_v0.3b.md the normative specification
EXPECTED_DIGESTS.md pinned end-to-end digests, including the GPU confirmation
GPU_RESULT.md the 2026-09-08 NVIDIA Tesla P100 run, with its scope limits
PROTOCOL.md the stdin/stdout wire contract a third-party binary implements
vectors/README.md per-op field layout of each vector file
vectors/*.txt five op-level input vectors: matvec, rmsnorm, rope, exp_pinned, attention_block
vectors/*.expected the pinned expected output for each

The vectors are plain text key=value files with float fields given as exact hex bit patterns, so parsing introduces no rounding of its own. They exist so an implementation can be checked op by op — you find out which operation diverges, instead of only that a 64-character digest came out wrong.

How to check your own implementation

git clone https://github.com/Aefinity-AI/cis2-spec
cd cis2-spec
cargo run --release --bin cis2-conformance -- /path/to/your-binary

PROTOCOL.md is the complete contract; you do not need to read any of this project's Rust to implement against it.

Scope, stated plainly

fp32 scalar reference semantics, not a fast kernel. Greedy decoding. Models checked up to 1.5B parameters. The GPU leg is one Pascal device, one toolchain, correctness only — no tensor cores, no batching, no timing number is claimed anywhere in this project. The CUDA port itself is deliberately not published, so a second GPU implementation written from the spec would be a genuine independent check rather than a re-run of ours; that is the contribution we are asking for.

Prior art

Reproducible and deterministic inference is prior-occupied ground. Gensyn's repops demonstrates a hash-matched CPU/CUDA fp32 forward pass; Microsoft's RepDL provides reproducible linear-algebra operators with CPU and CUDA backends; vLLM and SGLang both ship batch-invariant determinism modes; and arXiv:2606.00279 verifies bit-exact GPU inference by emulating vendor silicon tables. No "first" and no "only" claim is made here, and none should be inferred.

The narrower thing CIS-2 is testing is whether a written document can carry enough information for strangers to converge on identical bits — across an ISA boundary, a compiler boundary, a language boundary, and a CPU/GPU boundary, with no implementation consulting another.

Try to break it

Write your own implementation from CIS2_SPEC_v0.3b.md, in any language for any device, and see whether you get a different digest. Verified divergences and verified reproductions are credited by name in the repository's HALL-OF-DIVERGENCE.md. There is no cash offer attached to this: the reason to do it is the finding itself, and the credit for it.

If two implementations disagree because the spec text permits two readings, that is the most valuable outcome, not an embarrassing one: it means the document is not yet sufficient, which is the entire property CIS-2 claims.


Aefinity AI Inc. · Justin Brian Thompson

Acknowledgments

A special thank you to Charles Seaman and Linda Blanchard, whose contributions have helped Aefinity AI stay on track.

And a very special thank you to Bonnie Rae Power: an amazing woman, a great friend and neighbor, without whom Aefinity AI would have never had a chance to ever get started. Thank you, Bonnie, for your advice, care, encouragement, guidance, intuitive wisdom, and financial assistance.

Downloads last month
212

Paper for aefinityAIINC/cis2-conformance