Skip to content

gguf-radar 0.1.2

Choose a tag to compare

@Root0ne Root0ne released this 28 Nov 17:48
· 17 commits to main since this release
7f911b9

This release checks every tensor and six more block types for hidden data in zero-scale blocks, and it fixes a false positive in the readable text check.

Upgrade with:

pip install --upgrade git+https://github.com/Root0ne/gguf-radar@v0.1.2

Added

  • Zero-scale blocks are now checked and cleaned in Q4_0, Q5_0, Q2_K, Q3_K, Q5_K and Q6_K tensors, as well as in Q8_0 and Q4_K tensors. File signatures and readable text are looked for in all of them. The flatness test is used for Q2_K, Q3_K, Q4_0 and Q6_K, where real quantizer output was measured to be clearly apart from random bytes. It is not used for Q5_K and Q5_0, where it was not.
  • In Q2_K, Q4_K and Q5_K, a block with a zero d and a non-zero dmin is now counted, checked and cleaned. Its values are unused, and in a test model with very small weights most of the affected Q4_K blocks were of this kind.

Changed

  • All tensors are scanned for zero-scale bytes. Before, the scan stopped after 128 tensors, so data in a later tensor was not seen. scan_local_gguf and scan_dead_blocks still accept a limit.
  • Tensors are read in pieces of 64 MiB, in the scan and in sanitize, so a tensor of several gigabytes no longer has to fit into memory. A program header or readable text that crosses the border between two pieces is still found, and the report does not depend on the size of the pieces.
  • A scale stored as negative zero is a finding only in Q8_0 and Q4_K. The quantizers of Q4_0, Q5_0, Q3_K and Q6_K write negative zero themselves, so it counts there as an ordinary zero scale.
  • A scan of a local file now reads the whole file, so it takes about as long as reading the file once. Before, most of the weights were skipped.
  • Readable text in zero-scale bytes is reported only when it fills at least 128 bytes in consecutive blocks, uses at least 16 different characters and contains spaces or line breaks in the way that text does. How the checks work lists the conditions. Text with few or no spaces, such as Base64 data, is no longer reported as text, except in a Q8_0 block that the quantizer cannot have written.
  • A tensor with more MZ markers than the scan can follow is reported as holding an excessive number of Windows program markers.
  • sanitize no longer scans the zero-scale blocks of the input a second time. It reads each tensor once.

Fixed

  • A clean Q4_K model is no longer reported as MALICIOUS because its leftover bytes look like text. This happened in 0.1.1 with a real quantizer run on a tensor that held a tight group of very small positive weights and a few larger ones.
  • A Windows program hidden in zero-scale bytes is now found even when many MZ byte pairs that are not programs come before it.