perf: improve CPU throughput and default to configurable INT8 - #8
Conversation
Greptile SummaryThis PR enables concurrent inference through a shared lifecycle-protected ONNX session, reuses preprocessing buffers, and makes the bundled INT8 U²-Net artifact the configurable default.
Confidence Score: 5/5The implementation appears safe to merge from a runtime-correctness perspective, with non-blocking gaps in container validation and model reproducibility. No blocking code defect remains. The unresolved feedback concerns loss of CI coverage for the shipped container and removal of the scripts and raw evidence needed to reproduce the new default model; both are non-blocking quality issues. The prior memory-risk thread was manually resolved without explanation, while the vulnerable Pillow pin and contradictory precision report were eliminated by the latest deletions and documentation updates. Files Needing Attention: .github/workflows/ci.yml, tools/quantization/README.md Important Files Changed
|
Summary
MODEL_PRECISION=fp32selects FP32; an explicitMODEL_PATHoverrides precision. Invalid precision values fail startup unless a custom path is supplied.Measured trade-off
On the supplied Intel Xeon, two four-CPU HTTP comparisons measured 4.06–4.31 req/s for INT8 vs 2.95–2.98 for FP32, with 64–65% less peak cgroup memory. These compare precisions with the same concurrent pipeline, not the old serialized service. The throughput gain has not been established on ARM64.
The model was calibrated on 128 ECSSD images and evaluated on 200 separate public images plus nine extra fixtures. Median focal-point shift was 0.10%, p95 0.91%, and maximum 7.4% of an image dimension. One public image lost over five percentage points of foreground coverage in a tested crop shape; none lost over ten. Difficult-scene regressions remain; this is an intentional speed/quality trade-off, not lossless conversion.
Details:
tools/quantization/RESULTS-expanded.md.Validation
make model(both artifact checksums)go test -race ./...go vet ./...Packaging / rollout notes
MODEL_PRECISION=fp32.MODEL_PATHoverride if you want precision selection to take effect.