Port bounded IQ3_S source block decoder
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
//! Bounded CPU decoder for ggml IQ3_S source blocks (256 values / 110 bytes).
|
||||
//! Layout and grid are pinned to Strata upstream d9ab8435. This is preparation
|
||||
//! code, not a serving kernel; numerical parity with a real model is pending.
|
||||
|
||||
use crate::{iq3s_grid::IQ3S_GRID, kar_codec::f16_bits_to_f32};
|
||||
|
||||
pub const BLOCK_BYTES: usize = 110;
|
||||
pub const BLOCK_ELEMENTS: usize = 256;
|
||||
|
||||
pub fn decode_block(block: &[u8; BLOCK_BYTES]) -> Result<[f32; BLOCK_ELEMENTS], String> {
|
||||
let base = f16_bits_to_f32(u16::from_le_bytes([block[0], block[1]]));
|
||||
if !base.is_finite() {
|
||||
return Err("IQ3_S block has a non-finite scale".into());
|
||||
}
|
||||
let mut output = [0.0f32; BLOCK_ELEMENTS];
|
||||
for subblock in 0..8 {
|
||||
let high = block[66 + subblock];
|
||||
let packed_scale = block[106 + subblock / 2];
|
||||
let nibble = (packed_scale >> (4 * (subblock % 2))) & 0x0f;
|
||||
let scale = base * f32::from(1 + 2 * nibble);
|
||||
for quartet_pair in 0..4 {
|
||||
let signs = block[74 + 4 * subblock + quartet_pair];
|
||||
for half in 0..2 {
|
||||
let part = 2 * quartet_pair + half;
|
||||
let low = usize::from(block[2 + 8 * subblock + part]);
|
||||
let high_bit = usize::from((high >> part) & 1) << 8;
|
||||
let grid = IQ3S_GRID[low | high_bit].to_le_bytes();
|
||||
for (within, magnitude) in grid.iter().enumerate() {
|
||||
let local = 4 * half + within;
|
||||
let destination = 32 * subblock + 8 * quartet_pair + local;
|
||||
let value = scale * f32::from(*magnitude);
|
||||
output[destination] = if signs & (1 << local) != 0 {
|
||||
-value
|
||||
} else {
|
||||
value
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
pub fn decode_into(blocks: &[u8], output: &mut [f32]) -> Result<(), String> {
|
||||
if !blocks.len().is_multiple_of(BLOCK_BYTES)
|
||||
|| (blocks.len() / BLOCK_BYTES)
|
||||
.checked_mul(BLOCK_ELEMENTS)
|
||||
.is_none_or(|expected| expected != output.len())
|
||||
{
|
||||
return Err("IQ3_S block and output lengths do not match".into());
|
||||
}
|
||||
for (block, values) in blocks
|
||||
.as_chunks::<BLOCK_BYTES>()
|
||||
.0
|
||||
.iter()
|
||||
.zip(output.as_chunks_mut::<BLOCK_ELEMENTS>().0.iter_mut())
|
||||
{
|
||||
values.copy_from_slice(&decode_block(block)?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
#[test]
|
||||
fn decodes_constant_and_pinned_mixed_block() {
|
||||
let mut table_bytes = Vec::with_capacity(512 * 4);
|
||||
for value in IQ3S_GRID {
|
||||
table_bytes.extend_from_slice(&value.to_le_bytes());
|
||||
}
|
||||
assert_eq!(
|
||||
hex::encode(Sha256::digest(table_bytes)),
|
||||
"bd1af4945a1717c65610b0284e4628b9a1ba3b306fae3a06f6e5f597356e349f"
|
||||
);
|
||||
let mut block = [0u8; BLOCK_BYTES];
|
||||
block[..2].copy_from_slice(&0x3c00u16.to_le_bytes());
|
||||
assert_eq!(decode_block(&block).unwrap(), [1.0; BLOCK_ELEMENTS]);
|
||||
block[74] = 1;
|
||||
let values = decode_block(&block).unwrap();
|
||||
assert_eq!(values[0], -1.0);
|
||||
assert_eq!(values[1], 1.0);
|
||||
let mut blocks = [0u8; BLOCK_BYTES * 2];
|
||||
blocks[..BLOCK_BYTES].copy_from_slice(&block);
|
||||
blocks[BLOCK_BYTES..BLOCK_BYTES + 2].copy_from_slice(&0x3c00u16.to_le_bytes());
|
||||
let mut decoded = [0.0f32; BLOCK_ELEMENTS * 2];
|
||||
decode_into(&blocks, &mut decoded).unwrap();
|
||||
assert_eq!(decoded[0], -1.0);
|
||||
assert_eq!(decoded[BLOCK_ELEMENTS], 1.0);
|
||||
let mut mixed = [0u8; BLOCK_BYTES];
|
||||
for (index, byte) in mixed.iter_mut().enumerate() {
|
||||
*byte = (index as u8).wrapping_mul(73).wrapping_add(19);
|
||||
}
|
||||
mixed[..2].copy_from_slice(&0x3800u16.to_le_bytes());
|
||||
let values = decode_block(&mixed).unwrap();
|
||||
assert_eq!(&values[..4], &[-94.5, 67.5, -67.5, -148.5]);
|
||||
let mut bytes = Vec::with_capacity(BLOCK_ELEMENTS * 4);
|
||||
for value in values {
|
||||
bytes.extend_from_slice(&value.to_le_bytes());
|
||||
}
|
||||
assert_eq!(
|
||||
hex::encode(Sha256::digest(bytes)),
|
||||
"cfee2753d1b389fe4ee30994ff3387d4400745b8432aeb32cb4d7fced39949ec"
|
||||
);
|
||||
mixed[..2].copy_from_slice(&0x7c00u16.to_le_bytes());
|
||||
assert!(decode_block(&mixed).is_err());
|
||||
assert!(decode_into(&mixed[..109], &mut [0.0; BLOCK_ELEMENTS]).is_err());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// iq3s_grid from ggml-common.h at Strata upstream d9ab8435f654c368c586340d490915f6addf56a3.
|
||||
// Copyright (c) 2023-2026 The ggml authors. MIT License.
|
||||
// See engine/strata/third_party/ggml/LICENSE for the full license text.
|
||||
// This table is pinned to the imported upstream revision; do not regenerate silently.
|
||||
|
||||
pub const IQ3S_GRID: [u32; 512] = [
|
||||
0x01010101, 0x01010103, 0x01010105, 0x0101010b, 0x0101010f, 0x01010301, 0x01010303, 0x01010305,
|
||||
0x01010309, 0x0101030d, 0x01010501, 0x01010503, 0x0101050b, 0x01010707, 0x01010901, 0x01010905,
|
||||
0x0101090b, 0x0101090f, 0x01010b03, 0x01010b07, 0x01010d01, 0x01010d05, 0x01010f03, 0x01010f09,
|
||||
0x01010f0f, 0x01030101, 0x01030103, 0x01030105, 0x01030109, 0x01030301, 0x01030303, 0x0103030b,
|
||||
0x01030501, 0x01030507, 0x0103050f, 0x01030703, 0x0103070b, 0x01030909, 0x01030d03, 0x01030d0b,
|
||||
0x01030f05, 0x01050101, 0x01050103, 0x0105010b, 0x0105010f, 0x01050301, 0x01050307, 0x0105030d,
|
||||
0x01050503, 0x0105050b, 0x01050701, 0x01050709, 0x01050905, 0x0105090b, 0x0105090f, 0x01050b03,
|
||||
0x01050b07, 0x01050f01, 0x01050f07, 0x01070107, 0x01070303, 0x0107030b, 0x01070501, 0x01070505,
|
||||
0x01070703, 0x01070707, 0x0107070d, 0x01070909, 0x01070b01, 0x01070b05, 0x01070d0f, 0x01070f03,
|
||||
0x01070f0b, 0x01090101, 0x01090307, 0x0109030f, 0x01090503, 0x01090509, 0x01090705, 0x01090901,
|
||||
0x01090907, 0x01090b03, 0x01090f01, 0x010b0105, 0x010b0109, 0x010b0501, 0x010b0505, 0x010b050d,
|
||||
0x010b0707, 0x010b0903, 0x010b090b, 0x010b090f, 0x010b0d0d, 0x010b0f07, 0x010d010d, 0x010d0303,
|
||||
0x010d0307, 0x010d0703, 0x010d0b05, 0x010d0f03, 0x010f0101, 0x010f0105, 0x010f0109, 0x010f0501,
|
||||
0x010f0505, 0x010f050d, 0x010f0707, 0x010f0b01, 0x010f0b09, 0x03010101, 0x03010103, 0x03010105,
|
||||
0x03010109, 0x03010301, 0x03010303, 0x03010307, 0x0301030b, 0x0301030f, 0x03010501, 0x03010505,
|
||||
0x03010703, 0x03010709, 0x0301070d, 0x03010b09, 0x03010b0d, 0x03010d03, 0x03010f05, 0x03030101,
|
||||
0x03030103, 0x03030107, 0x0303010d, 0x03030301, 0x03030309, 0x03030503, 0x03030701, 0x03030707,
|
||||
0x03030903, 0x03030b01, 0x03030b05, 0x03030f01, 0x03030f0d, 0x03050101, 0x03050305, 0x0305030b,
|
||||
0x0305030f, 0x03050501, 0x03050509, 0x03050705, 0x03050901, 0x03050907, 0x03050b0b, 0x03050d01,
|
||||
0x03050f05, 0x03070103, 0x03070109, 0x0307010f, 0x03070301, 0x03070307, 0x03070503, 0x0307050f,
|
||||
0x03070701, 0x03070709, 0x03070903, 0x03070d05, 0x03070f01, 0x03090107, 0x0309010b, 0x03090305,
|
||||
0x03090309, 0x03090703, 0x03090707, 0x03090905, 0x0309090d, 0x03090b01, 0x03090b09, 0x030b0103,
|
||||
0x030b0301, 0x030b0307, 0x030b0503, 0x030b0701, 0x030b0705, 0x030b0b03, 0x030d0501, 0x030d0509,
|
||||
0x030d050f, 0x030d0909, 0x030d090d, 0x030f0103, 0x030f0107, 0x030f0301, 0x030f0305, 0x030f0503,
|
||||
0x030f070b, 0x030f0903, 0x030f0d05, 0x030f0f01, 0x05010101, 0x05010103, 0x05010107, 0x0501010b,
|
||||
0x0501010f, 0x05010301, 0x05010305, 0x05010309, 0x0501030d, 0x05010503, 0x05010507, 0x0501050f,
|
||||
0x05010701, 0x05010705, 0x05010903, 0x05010907, 0x0501090b, 0x05010b01, 0x05010b05, 0x05010d0f,
|
||||
0x05010f01, 0x05010f07, 0x05010f0b, 0x05030101, 0x05030105, 0x05030301, 0x05030307, 0x0503030f,
|
||||
0x05030505, 0x0503050b, 0x05030703, 0x05030709, 0x05030905, 0x05030b03, 0x05050103, 0x05050109,
|
||||
0x0505010f, 0x05050503, 0x05050507, 0x05050701, 0x0505070f, 0x05050903, 0x05050b07, 0x05050b0f,
|
||||
0x05050f03, 0x05050f09, 0x05070101, 0x05070105, 0x0507010b, 0x05070303, 0x05070505, 0x05070509,
|
||||
0x05070703, 0x05070707, 0x05070905, 0x05070b01, 0x05070d0d, 0x05090103, 0x0509010f, 0x05090501,
|
||||
0x05090507, 0x05090705, 0x0509070b, 0x05090903, 0x05090f05, 0x05090f0b, 0x050b0109, 0x050b0303,
|
||||
0x050b0505, 0x050b070f, 0x050b0901, 0x050b0b07, 0x050b0f01, 0x050d0101, 0x050d0105, 0x050d010f,
|
||||
0x050d0503, 0x050d0b0b, 0x050d0d03, 0x050f010b, 0x050f0303, 0x050f050d, 0x050f0701, 0x050f0907,
|
||||
0x050f0b01, 0x07010105, 0x07010303, 0x07010307, 0x0701030b, 0x0701030f, 0x07010505, 0x07010703,
|
||||
0x07010707, 0x0701070b, 0x07010905, 0x07010909, 0x0701090f, 0x07010b03, 0x07010d07, 0x07010f03,
|
||||
0x07030103, 0x07030107, 0x0703010b, 0x07030309, 0x07030503, 0x07030507, 0x07030901, 0x07030d01,
|
||||
0x07030f05, 0x07030f0d, 0x07050101, 0x07050305, 0x07050501, 0x07050705, 0x07050709, 0x07050b01,
|
||||
0x07070103, 0x07070301, 0x07070309, 0x07070503, 0x07070507, 0x0707050f, 0x07070701, 0x07070903,
|
||||
0x07070907, 0x0707090f, 0x07070b0b, 0x07070f07, 0x07090107, 0x07090303, 0x0709030d, 0x07090505,
|
||||
0x07090703, 0x07090b05, 0x07090d01, 0x07090d09, 0x070b0103, 0x070b0301, 0x070b0305, 0x070b050b,
|
||||
0x070b0705, 0x070b0909, 0x070b0b0d, 0x070b0f07, 0x070d030d, 0x070d0903, 0x070f0103, 0x070f0107,
|
||||
0x070f0501, 0x070f0505, 0x070f070b, 0x09010101, 0x09010109, 0x09010305, 0x09010501, 0x09010509,
|
||||
0x0901050f, 0x09010705, 0x09010903, 0x09010b01, 0x09010f01, 0x09030105, 0x0903010f, 0x09030303,
|
||||
0x09030307, 0x09030505, 0x09030701, 0x0903070b, 0x09030907, 0x09030b03, 0x09030b0b, 0x09050103,
|
||||
0x09050107, 0x09050301, 0x0905030b, 0x09050503, 0x09050707, 0x09050901, 0x09050b0f, 0x09050d05,
|
||||
0x09050f01, 0x09070109, 0x09070303, 0x09070307, 0x09070501, 0x09070505, 0x09070703, 0x0907070b,
|
||||
0x09090101, 0x09090105, 0x09090509, 0x0909070f, 0x09090901, 0x09090f03, 0x090b010b, 0x090b010f,
|
||||
0x090b0503, 0x090b0d05, 0x090d0307, 0x090d0709, 0x090d0d01, 0x090f0301, 0x090f030b, 0x090f0701,
|
||||
0x090f0907, 0x090f0b03, 0x0b010105, 0x0b010301, 0x0b010309, 0x0b010505, 0x0b010901, 0x0b010909,
|
||||
0x0b01090f, 0x0b010b05, 0x0b010d0d, 0x0b010f09, 0x0b030103, 0x0b030107, 0x0b03010b, 0x0b030305,
|
||||
0x0b030503, 0x0b030705, 0x0b030f05, 0x0b050101, 0x0b050303, 0x0b050507, 0x0b050701, 0x0b05070d,
|
||||
0x0b050b07, 0x0b070105, 0x0b07010f, 0x0b070301, 0x0b07050f, 0x0b070909, 0x0b070b03, 0x0b070d0b,
|
||||
0x0b070f07, 0x0b090103, 0x0b090109, 0x0b090501, 0x0b090705, 0x0b09090d, 0x0b0b0305, 0x0b0b050d,
|
||||
0x0b0b0b03, 0x0b0b0b07, 0x0b0d0905, 0x0b0f0105, 0x0b0f0109, 0x0b0f0505, 0x0d010303, 0x0d010307,
|
||||
0x0d01030b, 0x0d010703, 0x0d010707, 0x0d010d01, 0x0d030101, 0x0d030501, 0x0d03050f, 0x0d030d09,
|
||||
0x0d050305, 0x0d050709, 0x0d050905, 0x0d050b0b, 0x0d050d05, 0x0d050f01, 0x0d070101, 0x0d070309,
|
||||
0x0d070503, 0x0d070901, 0x0d09050b, 0x0d090907, 0x0d090d05, 0x0d0b0101, 0x0d0b0107, 0x0d0b0709,
|
||||
0x0d0b0d01, 0x0d0d010b, 0x0d0d0901, 0x0d0f0303, 0x0d0f0307, 0x0f010101, 0x0f010109, 0x0f01010f,
|
||||
0x0f010501, 0x0f010505, 0x0f01070d, 0x0f010901, 0x0f010b09, 0x0f010d05, 0x0f030105, 0x0f030303,
|
||||
0x0f030509, 0x0f030907, 0x0f03090b, 0x0f050103, 0x0f050109, 0x0f050301, 0x0f05030d, 0x0f050503,
|
||||
0x0f050701, 0x0f050b03, 0x0f070105, 0x0f070705, 0x0f07070b, 0x0f070b07, 0x0f090103, 0x0f09010b,
|
||||
0x0f090307, 0x0f090501, 0x0f090b01, 0x0f0b0505, 0x0f0b0905, 0x0f0d0105, 0x0f0d0703, 0x0f0f0101,
|
||||
];
|
||||
@@ -2,6 +2,8 @@ pub mod app;
|
||||
pub mod config;
|
||||
pub mod doctor;
|
||||
pub mod gguf;
|
||||
pub mod iq3_s;
|
||||
mod iq3s_grid;
|
||||
pub mod kar;
|
||||
pub mod kar_codec;
|
||||
pub mod kar_writer;
|
||||
|
||||
@@ -159,7 +159,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("strata-next {}", env!("CARGO_PKG_VERSION"));
|
||||
Ok(())
|
||||
}
|
||||
_ => Err("usage: strata-next [serve|doctor|model fetch MANIFEST --output DIR|model verify MANIFEST --output DIR|model inspect FILE.gguf|model index FILE.gguf [--hash]|model prepare-f32-preview FILE.gguf --output FILE.kar --levels N|model inspect-kar FILE.kar|model verify-kar FILE.kar [--manifest SPEC --source-dir DIR]|model extract-tokenizer FILE.gguf --output DIR|model tokenize TOKENIZER_DIR TEXT [--special]|model tokenize TOKENIZER_DIR --stdin [--special]|model detokenize TOKENIZER_DIR IDS]".into()),
|
||||
[license] if license == "--ggml-license" => {
|
||||
println!("ggml IQ3_S grid table — MIT License\n");
|
||||
print!("{}", include_str!("../third_party/ggml/LICENSE"));
|
||||
Ok(())
|
||||
}
|
||||
_ => Err("usage: strata-next [serve|doctor|--ggml-license|model fetch MANIFEST --output DIR|model verify MANIFEST --output DIR|model inspect FILE.gguf|model index FILE.gguf [--hash]|model prepare-f32-preview FILE.gguf --output FILE.kar --levels N|model inspect-kar FILE.kar|model verify-kar FILE.kar [--manifest SPEC --source-dir DIR]|model extract-tokenizer FILE.gguf --output DIR|model tokenize TOKENIZER_DIR TEXT [--special]|model tokenize TOKENIZER_DIR --stdin [--special]|model detokenize TOKENIZER_DIR IDS]".into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023-2026 The ggml authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -87,3 +87,4 @@ The test toolchain was installed into ignored `artifacts/tool-venv/` for this ru
|
||||
- Ported top-down nested boundary and book fitting for a supplied normalized sample. Two pinned koference Python fixtures match the Rust f32 boundary bits and f16 book values; a degenerate sample is rejected. The f64-to-f16 path avoids double rounding of fitted means. All 38 Rust tests, Clippy with warnings denied, and Linux/arm64 musl cross-check pass. This only establishes synthetic calibration parity, not representative model sampling or a quality result.
|
||||
- Connected a small synthetic F32 GGUF to `model prepare-f32-preview`: it produced a verified KAR-2 archive with source SHA-256 `f2bff437d5a53e8ddf7f43ee41acf3baebb7fb5f27eefb079f5bc1634def6f2c` and archive SHA-256 `fe049ca40305d5380caaa278f34a9149ae2d5761ea9544b58a0eb73775cd6810`. The separate `model verify-kar` command passed. A valid synthetic IQ3_S GGUF was rejected by the F32 preview, without creating an archive. All 40 Rust tests, Clippy with warnings denied, and Linux/arm64 musl cross-check pass. This is a bounded experimental integration path, not full-model preparation.
|
||||
- Refactored the F32 preview to write each tensor's canonical NESTED section to a private staging directory, then assemble the KAR archive from file-backed sections. The native section bytes match the in-memory writer. A two-tensor fixture succeeds and leaves no staging directory; corrupting the second tensor to NaN fails after the first section and also cleans staging without publishing an archive. The preview source-size and per-tensor limits remain; IQ3_S source decoding and full-model quality remain open.
|
||||
- Added a native IQ3_S CPU block decoder with the pinned ggml grid table (SHA-256 `bd1af4945a1717c65610b0284e4628b9a1ba3b306fae3a06f6e5f597356e349f`). A deterministic mixed 110-byte block produced 256 F32 values whose byte digest `cfee2753d1b389fe4ee30994ff3387d4400745b8432aeb32cb4d7fced39949ec` matches an independent Python calculation from the upstream layout; constant, sign, multi-block, and malformed-scale cases also pass. All 41 Rust tests, Clippy with warnings denied, and Linux/arm64 musl cross-check pass. This has not been compared with a real tensor or GPU. The ggml MIT license is copied into the control binary and shown by `--ggml-license`.
|
||||
|
||||
@@ -18,6 +18,10 @@ An experimental native `kar_codec::encode_with_boundaries` converts one in-memor
|
||||
|
||||
`strata-next model prepare-f32-preview FILE.gguf --output FILE.kar --levels N` connects the GGUF index, native calibration, encoder, CPU reconstruction check, and verified KAR writer. It accepts only a single F32 GGUF no larger than 64 MiB, at most 1000 tensors, with at most 1 million elements per tensor. Each encoded tensor is written to a private staging section and released from memory before the next tensor; the archive writer reads those sections with a 1 MiB buffer. Staging is cleaned after success or failure. It fits each tensor from all normalized values, records the rate in the KAR builder identity, and prints source/archive SHA-256 plus the maximum tensor relative L2. This command is an explicitly lossy integration preview. IQ3_S input is rejected, and no output from this command is eligible for serving until the full-model quality gate passes.
|
||||
|
||||
The Rust `iq3_s` module now decodes one GGUF IQ3_S block (110 bytes, 256 F32 outputs) or a caller-sized sequence of complete blocks. Its 512-entry grid is copied from the pinned Strata/ggml tree, checked by SHA-256, and carries the ggml MIT notice in the binary through `--ggml-license`. Synthetic block output matches an independent Python calculation. Real tensor parity still needs the upstream CPU oracle and real-model fixtures.
|
||||
|
||||
KAR-2 records `source_dtype` only as F32, F16, or BF16. An IQ3_S GGUF cannot be identified directly as a KAR-2 tensor source without violating that field. The IQ3_S → F32 derivation must therefore have its own digest and provenance record, with the original GGUF shard digests linked separately, or the archive format must be versioned to represent quantized source types. The preview continues to reject IQ3_S until that identity contract is implemented; it must never label IQ3_S bytes as F32 source bytes.
|
||||
|
||||
## GPU path
|
||||
|
||||
For the target compressed runtime, copy the selected KAR data to VRAM in compressed form. Keep at least the working layer and selected experts decoded or decode them into a bounded scratch buffer on a CUDA stream before multiply. Use `kar_decode_rows()` for sparse per-layer embedding lookups. The scheduler must account for archive residency, precision level, transfers, decode, and multiply, and measure cold misses separately from warm expert-cache hits. The archive format and decoded numerical values must be compared with the koference CPU oracle before an end-to-end speed claim.
|
||||
|
||||
@@ -63,6 +63,8 @@ The target interface is one Linux command, `strata-next`, with `serve`, `model f
|
||||
- [x] Fit experimental top-down nested boundaries and f16 books from a supplied normalized sample; match pinned koference synthetic oracles.
|
||||
- [x] Wire a small F32 GGUF through native calibration, encoding, reconstruction check, and verified KAR publication under an explicit preview command.
|
||||
- [x] Spool each preview tensor as a canonical NESTED section and assemble the archive from file-backed sections; clean staging after success or failure.
|
||||
- [x] Decode synthetic GGUF IQ3_S source blocks in native Rust with a pinned ggml grid and bounded output.
|
||||
- [ ] Verify IQ3_S values against upstream CPU dequantization on representative tensors, then define a provenance-safe IQ3_S → KAR source identity contract (derived F32 source or a versioned format extension).
|
||||
- [ ] Feed the native writer from a bounded-memory GGUF tensor iterator and a native KAR encoder; implement `model prepare` on real shards.
|
||||
- [ ] Make one-command `serve` fetch, verify, and prepare missing model assets, then reuse the verified compressed archive.
|
||||
- [ ] Compare KAR reconstruction with its CPU oracle; run full-model quality before making the compressed path a default.
|
||||
|
||||
Reference in New Issue
Block a user