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]