How to compare file sizes between different quantization formats
Multiple quantized versions of the same model available in Ollama
What this does
Lists multiple model variants and extracts their sizes to create a human-readable comparison for informed quantization selection. The result is a side-by-side view showing exactly how much disk space each variant consumes.
Steps
Filter model inventory for a specific base model. Isolates rows for each variant of the target model.
ollama list | grep llama3Expected output: Rows such as
llama3:q4_K_M,llama3:q5_K_M,llama3:q8_0, andllama3:latest.Extract variant names and sizes. Pipe through awk to display only the NAME and SIZE columns.
ollama list | grep llama3 | awk '{print $1, $NF}'Expected output: Each variant name paired with its byte size.
Calculate total disk consumed by all variants. Sums the sizes to evaluate storage impact.
ollama list | grep llama3 | awk '{sum+=$NF} END {print "Total bytes:", sum}'Expected output: Aggregate byte count for all llama3 variants.
- Record the local run evidence. Save the exact command, runtime or package version, model name if applicable, and observed output so the result can be reproduced later.
Verification
ollama list | grep llama3 | awk '{print $1, $NF}'
# Expected: list such as "llama3:q4_K_M 4.1G", "llama3:q5_K_M 5.2G", "llama3:q8_0 6.8G"
Common failures
- grep no matches: Model name is incorrect; verify exact case with
ollama listfirst. - column misalignment: The SIZE column index may vary by Ollama version; inspect raw table output to find the correct column.
- no variants present: Pull additional quantization levels first with
ollama pull <model>:<tag>. - suffix confusion: Byte suffixes may differ (G vs GB); compare within the same unit for accuracy.
- whitespace issues: Ollama output may contain leading/trailing whitespace; use
tr -s ' 'before parsing.