quant.cpp icon indicating copy to clipboard operation
quant.cpp copied to clipboard

Add --json output mode for PPL measurement

Open unamedkr opened this issue 7 months ago • 1 comments

The --ppl (perplexity) mode in tools/quant.c currently prints human-readable text output. For CI pipelines and automated benchmarking, a machine-parseable JSON output mode would be very useful.

What to do:

  • Add a --json flag that can be combined with --ppl.
  • When both flags are set, output a JSON object with fields like {"perplexity": 5.42, "tokens": 1024, "model": "..."} instead of the formatted text.
  • Keep the default behavior unchanged when --json is not specified.

Files to touch: tools/quant.c (argument parsing and PPL output section).

unamedkr avatar Apr 03 '26 14:04 unamedkr

Implemented in 69f2994. ./quant model.gguf --ppl text.txt --json outputs machine-parseable JSON to stdout.

unamedkr avatar Apr 03 '26 17:04 unamedkr