Add experimental INT8/FP8 ONNX post-training quantization tools - #1231
Closed
zsqdx wants to merge 1 commit into
Closed
Add experimental INT8/FP8 ONNX post-training quantization tools#1231zsqdx wants to merge 1 commit into
zsqdx wants to merge 1 commit into
Conversation
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.
Summary
This draft adds a standalone, research-oriented post-training quantization path for ONNX graphs emitted by KataGo's TensorRT backend.
all-weightedscope matching the executable MatMul/Conv coverage of zml24's reference script while still excluding activation-only attention matmuls.Motivation
KataGo currently consumes
.bin.gzweights and constructs its TensorRT ONNX graph internally. This change provides an isolated way to study explicit INT8/FP8 PTQ against that exact five-output inference graph without changing KataGo's runtime, model format, or default precision behavior.The default scope is intentionally accuracy-first. The broader scope is available for controlled coverage experiments, but promotion still requires held-out accuracy checks, a TensorRT build, production-batch throughput tests, and self-play.
Scope and safety
This PR contains only the core quantizer, shared helpers, pinned dependency, documentation, and focused tests. It does not include model weights, Q/DQ artifacts, TensorRT engines, benchmark logs, automatic scope-search experiments, or changes to KataGo runtime defaults.
Validation gates are descriptive unless the caller supplies explicit thresholds. The tool fails closed on source/validation overlap, requested-node count mismatches, provider fallback, malformed Q/DQ semantics, source mutation, and artifact publication errors.
Validation
59 passedacross the focused quantization, Q/DQ audit, and artifact-safety tests.Feedback requested
This is intentionally a draft. Feedback would be especially useful on whether this tooling belongs upstream, the desired CLI/API boundary, and whether the initial projection-only scope is narrow enough for a first experimental integration.