test(dequant): verify real GGUF tensors with gguf-py (RM-2013)
User description
Linear project: ANN/SNN Hybrid
Stacked on #150. Refs RM-2013 (engram-parser v0.4.0 milestone).
Adds an ignored, CPU-only conformance test to real_gguf and uses the existing gguf-py 0.19.0 pin. Both implementations independently resolve the named tensor from the same local GGUF. The test checks one complete bounded tensor per requested wire dtype and reports max absolute and relative error. Normal tests neither require Python nor download weights.
Verified SHA-256 for both revision-pinned Qwen2.5-0.5B-Instruct GGUF files. Observed zero absolute and relative error for Q8_0 (114,688 values), Q5_K (4,358,144), and Q6_K (4,358,144). Repro commands, revisions, tool versions, and digests are in docs/real-gguf-oracle.md. This result is same-file decoder conformance; the separately distributed GGUF/Safetensors pair in #150 has a distinct, documented numeric mismatch.
Rustfmt and all-target/all-feature Clippy passed. The full all-feature suite was exercised locally with the pre-existing Unix socket test excluded after the sandbox denied its socket bind. No model weights or new Rust dependencies.
Summary by cubic
Adds an opt-in conformance test that verifies engram-parser's dequantization of real GGUF checkpoints against the independent gguf-py decoder. The test mmaps a local GGUF, dequantizes one full tensor per requested wire dtype (Q8_0, Q5_K, Q6_K), and compares against gguf-py reading the same file. Normal tests are unaffected: the test is ignored unless ENGRAM_GGUF_ORACLE_PYTHON is set, and no weights are downloaded. Observed zero max absolute and relative error for the sampled tensors; reproduction commands, file digests, and results are in docs/real-gguf-oracle.md.
CodeAnt-AI Description
Add real GGUF dequantization conformance checks
What Changed
- Adds an opt-in, CPU-only test that compares complete Q8_0, Q5_K, and Q6_K tensors from a local GGUF against gguf-py reading the same file, and fails when values exceed the allowed error.
- Documents pinned model files, reproduction commands, and observed results; regular tests still require no Python or downloaded model weights.
Impact
✅ Detects real GGUF tensor decoding mismatches
✅ Reproducible checks for three quantized formats
✅ No Python or model downloads in regular tests
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
@codeant-ai ask: Can you suggest a safer alternative to storing this secret?
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
@codeant-ai: Your feedback here
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
@codeant-ai: Do not flag unused imports.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.