Skip to content

Ling-3.0-tiny on ARM CPUs: opt-in per-step logits hashes in the decoder tool (#1247) - #5072

Merged
ashhart merged 3 commits into
ashhart:mainfrom
ThinkOffApp:ling-cpu-step-hashes
Nov 25, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
ThinkOffApp:ling-cpu-step-hashes

Conversation

@ThinkOffApp

@ThinkOffApp ThinkOffApp commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Thanks @ashhart for the review of #4266 and the 11:53Z invitation to send exact-path work independently.

What this changes

Adds --step-hashes to the standalone Ling CPU decoder. The normal CLI remains unchanged without the flag. With it, appended lines give the generated step (1-based), chosen token ID and SHA-256 of the full vocabulary logits used for that choice. The final SHA-256 covers the concatenated raw 32-byte step digests, not their hex strings. Logits are read as raw F32 bit patterns, serialized little-endian in vocabulary order; signed zero/NaN payloads are not normalized. No arithmetic, selection rule, KDA optimization or approximate mode is added.

Checks on this head

  • Head commit: 19ba37f67 (read back from the pushed branch).
  • Lean checker, same checker on base/head: 164 inherited / 164 total, 0 new. This is not a clean standalone checker exit.
  • Tests run: Zig0.17.0 zig build test-ling-cpu-host -Dcpu=apple_m1 --summary all: 52/52 pass, including fixed little-endian bit patterns, signed-zero preservation, read-only hashing, one-bit sensitivity, aggregate serialization and per-step equality at1/2/4/8 threads on the synthetic model. ARM Linux ReleaseSafe builds pass for baseline and baseline+dotprod+sha2. zig fmt --check build.zig zig/git diff --check pass. zig build test-golden -Dcpu=apple_m1 also passes on this head: fake-server golden groups 69/69 and 327/340 equal, 0 unexpected differences (the remaining cases are inherited).
  • CI: not yet run at the time of writing; we will classify the results on this head when they arrive.
  • Not run: full zig build test, GPU suites, dev-tools, fuzz, full native build. Only CPU CLI/modules changed, and the Mac is serving an unrelated model. No before-change red-run receipt was collected; the hash test contains a planted one-bit inequality control.

Receipt

  • Main against branch: default output formatting and selection preserved by inspection; flag-off board runs retain the original32 IDs. Same-binary four-thread off/on/off/on decode rates: 4.26/4.98/5.29/4.98 tok/s. One adjacent pair 5.29→4.98, about6% lower with hashing; one pair only, no firm cost estimate. The slow first control means an overall overhead percentage would be misleading. Timing includes hashing, excludes printing appended hash lines; the first-token hash falls in prefill.
  • Boxes it reaches: standalone native CPU decoder, not server token_sha256 metadata or a new server logit endpoint.
  • New switch? --step-hashes, boolean presence flag, default off. No environment setting/profile row. Invalid positional arity is refused. It has no production caller: it is a diagnostic on the standalone decoder tool. If that falls foul of the rule on new settings, we are glad to reshape it (test-only helper, or folded into an existing tool) or to drop it.
  • Environment: Arduino VENTUNO Q, ARM64 Linux,15GiB RAM class, no GPU; Zig0.17.0, ReleaseSafe aarch64-linux-gnu. Model inclusionAI/Ling-3.0-tiny-GGUF/Ling-3.0-tiny-Q4_K_M.gguf, revision 01b850e29ed5b44e2b810160ff980a9bb353296f, size4,823,894,944 bytes, SHA256 246d67d45f5b0c7447ca0ce0bdb8b46b8a47b593c5068635dc16422c051d7be9. No drafter.
  • Paths/platforms: host synthetic tests on Apple silicon; full GGUF runs on ARM Linux, CPUs0/3/5/7 pinned,1/4 threads, baseline and dotprod+sha2 builds. Windows, x86 Linux, Metal M1–M5 kernels, CUDA SMs, HIP gfx targets and mobile apps unrun/not qualified.
  • Exactness: all32 generated IDs and all32 full-logit hashes match at1/4 threads in both builds, including repeated four-thread dotprod runs. Final aggregate: ecace3a2e009f67e1a57988975ee10c7d644f8dbb2fff7d9e0606c848c8e1e8a. This is the Ling-3.0-tiny on ARM CPUs: exact GGUF decoder (#1247) #4266 37-ID prompt, greedy32 outputs, fresh standalone sessions. Server drafted/resumed/concurrent contracts are n/a here, not newly verified. Hash equality is meaningful across systems but not promised for untested engines/backends; after a generated token differs, force identical history to isolate arithmetic differences.
  • Main against this branch before asking for maintainer hardware: our board ran the evidence above. Full reference and raw logs are retained and can be shared; no hidden reviewer hardware run is requested.
  • Decode before/after: same-binary flag-off/on CLI timing above, not bench_openai.py because there is no HTTP endpoint. Compare ling-cpu-decode MODEL.gguf PROMPT_IDS 32 4 with ling-cpu-decode --step-hashes MODEL.gguf PROMPT_IDS 32 4 under identical affinity.
  • Prompt before/after: short37-ID fresh prefill only; no long cold-prefill benchmark. The first hash adds read-only work to prefill. 2k/8k/32k/64k gates were not run; CLI capacity is4096 total. No long-context non-regression is claimed.
  • Licence: n/a, no new weights/drafter.

Checklist

  • Title and description match the pushed head and its independent scope.
  • New tests fail before/pass after:52 pass and bit-flip control works; no pre-change red-run receipt.
  • Single-line comments/docstrings; no measurement history in source.
  • Approved public GitHub noreply identity; no private paths/hosts or AI attribution in diff/history.
  • Lane-round invariant: n/a, already-existing standalone CLI, no served-lane change.
  • Drafted/resumed/concurrent equality: n/a for this CLI; no serving claim.
  • No precision or reduction change: hashing only reads logits.
  • Full performance gates: short CLI evidence only; opt-in hashing has measured cost, full long/sampled/drafted gates unrun.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thanks @ThinkOffApp. The hashes read the full raw F32 logits in vocabulary order, preserve little-endian words and aggregate raw digests. Each token's digest is copied before the next step reuses the logits buffer. With the flag off, no hashes or diagnostic buffers are created, and selection is unchanged. The added output contains only the step, chosen ID and fingerprints.

Ready to land from this source review. One small timing clarification: per-step logits hashing is timed; final aggregate hashing and appended printing happen afterwards. The existing hash receipt remains scoped to this independent branch.

  • Synthena

@ashhart
ashhart force-pushed the ling-cpu-step-hashes branch from 19ba37f to 1041036 Compare November 25, 2026 18:56
@ashhart
ashhart merged commit b664577 into ashhart:main Nov 25, 2026
12 checks passed
@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you @ThinkOffApp. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants