10 KiB
Model acquisition
The strata-next CLI can fetch and verify model files described by a versioned manifest. Each file has a pinned HTTPS URL, byte length, and SHA-256. It writes to NAME.part, resumes with HTTP Range when supported, verifies the complete digest, and renames the file only after successful verification. A server that ignores Range causes a full restart of that file. Existing completed files are hashed before reuse. A failed hash is never accepted as a completed model.
Each shard gets at most four transfer attempts with 1, 2, and 4 second waits between retries. Retries cover connection and body failures, timeouts, short responses, and HTTP 408/429/5xx. Every attempt rechecks the partial file before resuming; malformed ranges, local filesystem errors, and SHA-256 failures stop the fetch. Authenticated Hub access remains to be implemented.
For the initial Qwen3.8-Flash-Next IQ3_S profile:
strata-next model fetch qwen-iq3-s --output /models/qwen-iq3-s
strata-next model verify qwen-iq3-s --output /models/qwen-iq3-s
strata-next model inspect /models/qwen-iq3-s/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf
strata-next model extract-tokenizer /models/qwen-iq3-s/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf --output /models/qwen-iq3-s/pack
The profile manifest is embedded in the executable; a custom manifest path can be used in place of qwen-iq3-s. The two shard URLs are pinned to Hugging Face repository commit ed59f92082b1e93c0e96d60a8b11aab089b52f09, matching the imported Strata setup source. Both shards were downloaded outside Git and matched their manifest SHA-256 values locally: shard 1 54,817,524,224 bytes / 4c1eb2ceb4915e1192f4f386021897bde56a97f40a0bb78bb86465e0f7d2aca3; shard 2 28,800,138,432 bytes / 316b46f3a2dbd68c900f43136ab9449f9dcc3725dfd8c794847c204bc161e113.
The executable carries its HTTPS trust roots, so model fetch does not need a CA bundle installed in a minimal container. TLS certificate and hostname verification remain enabled.
For a private Hugging Face repository, set HF_TOKEN in the process environment when running model fetch or model ensure-sharded-streamed. The CLI adds it as a Bearer header only to requests whose URL has the exact https://huggingface.co origin; it does not put the token in the manifest, logs, archive, or provenance. Cross-origin redirects drop the authorization header. A model URL containing embedded user credentials is rejected. The already downloaded target shards do not require this option.
For small GGUF fixtures, model ensure-sharded-preview MANIFEST --source-dir DIR --output FILE.kar --levels N runs fetch, source verification, experimental KAR-2 preparation, and archive verification in one command. On rerun it hashes the source shards and verifies the archive payload, provenance, and level count before reusing the file. A damaged or mismatched archive fails closed and is never overwritten automatically. This preview is limited to 64 MiB of GGUF input; the embedded qwen-iq3-s manifest is deliberately rejected before download. It does not provide full-model conversion or an approved serving artifact.
model ensure-sharded-streamed MANIFEST --source-dir DIR --output FILE.kar --levels N is the opt-in, uncapped experimental path. It fetches and verifies source shards, prepares a bounded-memory KAR-2 archive if absent, independently verifies the new archive and provenance, and rehashes all sources plus the archive before reuse. It prints actual archive bytes and accounted bits per weight. Use a model volume with enough capacity for the GGUF shards, temporary sections, and final archive. Streamed policy v4 splits any tensor too large for KAR-2's 32-bit plane stride into adjacent records and records their parent mapping and per-part source/F32 hashes in provenance. The 51,200,245,760-element per_layer_token_embd.weight becomes two records of 32,000,000,000 and 19,200,245,760 elements. A complete level-2 archive measured 55,295,529,472 bytes (51.50 GiB, 66.13% of the source GGUF bytes); see build validation. Its maximum tensor relative L2 error was 0.68008092. Model-level quality and serving approval remain pending.
model checksum-kar-preview FILE.kar TENSOR LEVEL independently decodes one bounded nested tensor from the archive and prints an FNV-1a checksum of the F32 output. On Linux, compare output_fnv1a64 with the same field from strata-kar-gpu-smoke FILE.kar TENSOR LEVEL ITERATIONS. This checks CPU and CUDA reconstruction byte for byte on a fixture; it is not a full-model quality gate.
model analyze-sharded-kar FILE.kar --manifest SPEC --source-dir DIR --levels N --output REPORT.json verifies a streamed archive and its source shards, then compares bounded GGUF and KAR samples for every archive record. Append --assume-verified only when the exact source shards, archive, and provenance were fully verified earlier and have remained immutable: this fast mode checks their structure and mapping but does not rehash all bytes or rederive the 708 GB virtual F32 stream. The JSON records which verification mode was used, the archive digest, and relative L2 for up to three nonoverlapping, aligned windows of at most 4,096 values at the beginning, middle, and end of each record. It reads existing files without creating another model copy. Sparse samples can miss a local failure; neither mode is a full-tensor error bound or model-quality gate.
model prepare-kar-overlay MANIFEST --source-dir DIR --base BASE.kar --candidates CANDIDATES.json --output OVERLAY.kar is an experimental way to re-encode selected KAR records at a higher level. Candidates may name an unsplit tensor or one partition from a v4/v5 base, such as per_layer_token_embd.weight#strata-part-001-of-513; the candidate's elements must equal that record's element count. Preparation binds the selected GGUF byte range, its physical and derived F32 digests, and the base KAR source record, verifies the resulting overlay, writes a provenance sidecar, and removes staging sections. model compare-kar-overlay MANIFEST --source-dir DIR --base BASE.kar --overlay OVERLAY.kar --output REPORT.json decodes every selected record from both archives against its GGUF source range, rechecks the physical and F32 digests and overlay CRCs, and records paired full-record relative L2. The base archive's earlier full verification is assumed; it is not rehashed by the comparison. No serving loader applies this overlay yet, and lower tensor error alone does not pass the model-quality gate.
Full streamed preparation checks available space on the output volume before creating section files. Its bound counts the minimum bit-plane payload for every part and accounts for a possible RAW fallback. A volume below that bound is rejected early; passing the bound does not guarantee enough room for scales, codebooks, alignment, and provenance. Keep the verified source shards and existing archive on their external volume when retrying with more space.
When model ensure-sharded-streamed sees all source shards already present and needs to create a new archive, it reads only their GGUF directories for an even earlier minimum-space rejection, before rehashing the shards. This preliminary metadata is used only to reject an impossible destination; a passing result still goes through SHA-256 source verification and the preparation-time guard. Missing shards take the normal resumable fetch path. Reusing an existing archive does not require room for a second copy.
model smoke-fixture --output FILE.kar writes a deterministic 32-element KAR-2 archive named smoke.expert and prints its archive digest and two-level CPU decode checksum. It refuses to overwrite an existing file. This model-free artifact lets the Linux CUDA decoder be checked before the target model is available.
The acquisition stage downloads GGUF files; the native tokenizer stage extracts and uses tokenizer assets. Before fetching, the CLI checks available filesystem space against the remaining bytes in all manifest shards and checks again after the server chooses resume or restart. This avoids starting a transfer that already cannot fit; filesystem quotas or concurrent writers can still cause a later write failure. The native experimental KAR-2 preparation path exists, but upstream iq_pack.py equivalence, compressed GPU loading, and model startup still need implementation and differential validation. See compressed runtime contract for the target fetch → verify → prepare → GPU decode sequence and with-key/without-key cache profiles. Model bytes belong on an external volume and never in Git or CI artifacts.
model inspect reads the GGUF v3 header and tensor directory without mapping weight data. It checks metadata types, counts, alignment, duplicate keys/tensors, split numbering, and whether tensor start offsets fit the file. This is a structural check, not proof that all tensor bytes or quantization geometry are valid.
model extract-tokenizer validates the Qwen byte-level BPE metadata, then writes tokenizer/ under the output directory through a staging directory. It requires a nonempty chat template and refuses to overwrite an existing tokenizer directory. The dense/expert pack is still pending.
The extracted directory is accepted by the native model tokenize and model detokenize commands. model tokenize TOKENIZER_DIR --stdin --special reads UTF-8 text from standard input and prints a JSON array of token IDs; --special enables control tokens such as <|im_end|>. User-defined tokens remain literal in both modes. model detokenize TOKENIZER_DIR 1,2,3 prints a JSON string. The native BPE path matched the pinned upstream tokenizer on 20 cases from the real verified first shard. The dense/expert pack and model startup remain pending.
The extracted real tokenizer's five files total 9,100,814 bytes (8.68 MiB) on the local model volume. Rust tokenization and token-ID-to-text conversion use host memory; this on-disk size is not a measurement of the Rust process's RAM use. Embedding and output weights are model tensors and have a separate GPU/CPU placement budget.
Metadata references: Hugging Face file download documentation and the two pinned files in the model repository.