Repository navigation
spike(s5): llama.cpp packaging, offline build and signed LLM packs — go with conditions - #32
Merged
Merged
Conversation
…tion - modelpack + TS oracle accept task "llm" and engine "llama.cpp"; new valid-llm conformance case (engine version 0.6.0 in context.json). - modelpack hashes weights from a stream in 1 MiB chunks (verify_model_pack_reader, sha256_hex_file). - modelpack-sign: --task llm; zips straight to weights.bin, streaming each file in (.gguf Stored, the rest Deflated, zip64 when >= 4 GiB); hashes and self-verifies by streaming; knows llama.cpp 0.6.0. - app: verify and extract packs as streams; speech resolution skips llm packs; resolve_verified_llm(_in) returns the GGUF of the newest verified llm pack and fails closed (not called by the app yet). - llm-tiny fixture pack signed with the test key.
spikes/s5-llama pins llama-cpp-2 =0.1.161 (llama.cpp v0.6.0) next to the engine. --self-check starts onnxruntime and the llama.cpp CPU backend in one process; --model loads a GGUF and reports load time, tokens/s and peak RSS. .cargo/config.toml keeps Metal and OpenSSL out of the CMake build and builds llama.cpp with the static CRT to match sherpa-onnx on Windows. The zero-egress gate also scans the spike (all targets), and a new CI job builds and self-checks it on Linux, macOS and Windows, the Linux build in a network namespace with no network.
GO-WITH-CONDITIONS. Adds the Qwen weights and llama.cpp rows to the third-party inventory (and fixes sherpa-onnx 1.13.2 -> 2.0.1), documents llm packs in model-packs.md, and marks S5 in the spike plan.
…c CRT on real MSVC windows-latest CI failed with the RuntimeLibrary MD/MT mismatch: LLAMA_STATIC_CRT only adds /MT flags, and llama.cpp's CMake (policy CMP0091) takes the runtime from CMAKE_MSVC_RUNTIME_LIBRARY instead.
Both validators (Rust and TS) accepted task "llm" with engine "sherpa-onnx", so a pack could pass the engine-version gate for one runtime and be handed to another. New conformance case malformed-llm-wrong-engine.
…es no LLM pack - Speech resolution verified every pack, LLM included, before dropping LLM packs: a 2.4 GB pack added ~6 s of hashing to every recording start. The manifest's declared task now decides which packs are verified at all (a forged task can only make a pack be skipped). - engine_versions() no longer lists llama.cpp, which this build doesn't link, so a signed LLM pack shows as "engine not supported by this build" instead of verified.
… an out-dir inside the model dir Streaming into weights.bin (S5) truncated an existing pack before the source was read, so a failed rebuild left a broken pack, and an out-dir inside the model dir zipped its own partial output. The pack is now built as .weights.bin.partial / .manifest.json.partial, self-verified, then renamed into place; an out-dir inside the model dir is refused up front.
…t.py; reject --threads < 1 - --vad dropped its sherpa-onnx session before llama.cpp loaded, so the two runtimes never held sessions at once. The session now stays open and runs again after generation. - The documented benchmark used an uncommitted prompt.py; it is committed (byte-identical output: the 730-token housing-visit prompt). - ggml silently replaces --threads 0 with 4, mislabelling runs.
…cks unsupported in this build, VAD kept open (runs 7-9), CI status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spike S5 from
docs/spikes/next-phase-spikes.md: can llama.cpp and a 4B model ship inside Folio, statically linked, with no build-time download, as a signed model pack under a licence we can redistribute? Write-up:docs/spikes/s5-llm-packaging.md.Verdict: GO-WITH-CONDITIONS
spikes/s5-llamaon all targets.Conditions for P2:
llama-cpp-2so it doesn't build llama.cpp'scommonlibrary, which contains the model downloader and an HTTP client. None of it reaches the binary (checked), butcargo treecan't see it. Also add a binary-level check to the gate.LLAMA_STATIC_CRT=1plusCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded) to match sherpa-onnx's/MT. The first CI run caught that the cross-build had hidden the CMake half; fixed ine20dad0.weights.binthe GGUF itself.What changes
Pack support for LLMs (product code):
llmtask and thellama.cppengine (version 0.6.0), across the Rust crate, the TypeScript oracle, the signer, the fixtures and the app.resolve_verified_llminapp/src-tauri/src/models.rsreturns a verified GGUF path and fails closed. Nothing calls it yet. The speech resolver now skipsllmpacks.Spike crate:
spikes/s5-llama/is a throwaway binary that runs llama.cpp generation and a sherpa-onnx VAD in one process. Its.cargo/config.tomlholds the build settings:GGML_METAL=OFF,LLAMA_STATIC_CRT=1,CMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE.CI: a new
s5-llamajob for Linux, macOS and Windows.scripts/check-no-network.shnow also scans the spike crate.Docs:
docs/model-packs.md: thellmtask.docs/assurance/third-party-components.md: llama.cpp, the binding crates and the Qwen weights. The sherpa-onnx version drift (1.13.2 → 2.0.1) is fixed too.next-phase-spikes.md: the S5 row.Numbers on the Mac:
Tests (only the approved list)
valid-llmcase, plus the existing unknown-task rejection, in both the Rust and TS suites.modelpack-sign --task llmproduces a pack the verifier accepts.weights.binis rejected, and a speech pack is never returned as an LLM.All suites pass locally: modelpack, modelpack-sign, the app backend (59), the engine (48), core (102), app vitest (111),
tsc, and the network gate.Not covered