Skip to content

fix(llm-edge): restore end-to-end execution of compression benchmark - #1036

Open
BLVCK-MAMBA-6 wants to merge 1 commit into
kubeedge:mainfrom
BLVCK-MAMBA-6:fix/compression-benchmark-e2e
Open

BLVCK-MAMBA-6 wants to merge 1 commit into
kubeedge:mainfrom
BLVCK-MAMBA-6:fix/compression-benchmark-e2e

Conversation

@BLVCK-MAMBA-6

@BLVCK-MAMBA-6 BLVCK-MAMBA-6 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it

This PR restores end-to-end execution of examples/llm-edge-benchmark-suite/single_task_bench_with_compression. The example referenced missing dataset files, imported psutil without declaring it, and could run inference with the original model instead of the file produced by quantization.

This PR supersedes #542 by carrying forward Fahmid Arman’s JSONL fixtures and dataset path fixes and addressing the remaining benchmark issues. Fahmid is credited as co-author in the squashed commit.

  • Adds psutil to the example’s requirements for process memory measurement and documents the CPU setup using the bundled Sedna wheel.
  • Loads the generated _q8_0.gguf for inference and raises an error if quantization does not produce a usable model path.
  • Reports throughput in requests per second, includes the existing process memory metric in the results, and corrects ranking to prefer lower latency and higher throughput.
  • Keeps the prefill_latency field name and documents that it measures time to the first streamed chunk containing generated text. An empty response raises an error instead of contributing a zero to the latency average.

Which issue(s) this PR fixes

Fixes #249

Testing performed

Ran the documented Qwen2.5-0.5B-Instruct FP16 setup on commit a40a532 with Python 3.11 on an Ubuntu 24.04 CPU runner. The GitHub Actions run passed in 3 min 58 sec, including setup and downloads.

Ianvs generated qwen2.5-0.5b-instruct-fp16_q8_0.gguf, loaded it for inference, and wrote selected_rank.csv and all_rank.csv. Both files reported the same metrics:

Metric Result
Average request latency 578.64 ms
Throughput 1.728 requests/s
Average process memory (RSS) 871.22 MiB
Average time to first generated text 224.65 ms

These results are from one Q8_0 run. No FP16 performance comparison was performed.

Separate Windows mock-stream tests verified that a metadata-only chunk does not start the first-text measurement and that a stream with no generated text raises an error. git diff --check also passed.

@BLVCK-MAMBA-6
BLVCK-MAMBA-6 marked this pull request as ready for review November 12, 2026 09:37
@kubeedge-bot kubeedge-bot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 13, 2026
@BLVCK-MAMBA-6
BLVCK-MAMBA-6 force-pushed the fix/compression-benchmark-e2e branch 2 times, most recently from 84c62d7 to 8d482ba Compare November 13, 2026 17:05
@kubeedge-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLVCK-MAMBA-6
To complete the pull request process, please assign jaypume after the PR has been reviewed.
You can assign the PR to them by writing /assign @jaypume in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@BLVCK-MAMBA-6
BLVCK-MAMBA-6 force-pushed the fix/compression-benchmark-e2e branch from 8d482ba to 21c0c3f Compare November 13, 2026 17:09
@kubeedge-bot kubeedge-bot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 13, 2026
@BLVCK-MAMBA-6
BLVCK-MAMBA-6 force-pushed the fix/compression-benchmark-e2e branch from 21c0c3f to a40a532 Compare November 13, 2026 17:17

@MooreZheng MooreZheng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Adeyemo for the modification and improvement. A video should be fine to ensure the revisions and example can be run in an end-to-end manner.

@hsj576

hsj576 commented Dec 3, 2026

Copy link
Copy Markdown
Member

Hi, could you run the end-to-end compression benchmark with a few more models, such as Llama 3.1 and Qwen3? The current results only cover Qwen2.5-0.5B-Instruct. Please confirm that the benchmark loads the quantized GGUF for each model and share the resulting metrics.

@ken6078

ken6078 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Can this example be fully executed in CI? If not, what would be the main blockers? For example, model download size, build time, runner resource limitations, or simply taking too long to run on GitHub Actions?

@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author

Can this example be fully executed in CI? If not, what would be the main blockers? For example, model download size, build time, runner resource limitations, or simply taking too long to run on GitHub Actions?

@ken6078, sorry for the confusion on the call—I thought you meant whether the upstream PR checks already run the full example.

It does run end to end in GitHub Actions. I tested Qwen2.5-0.5B-Instruct in a separate workflow on my fork using an Ubuntu 24.04 CPU runner with no GPU. The full run took 3m58s, including dependency installation, downloads, compression, inference and verification of both result files. The logs confirm that inference loaded the generated Q8_0 GGUF.

[Successful run and logs](https://github.com/BLVCK-MAMBA-6/ianvs/actions/runs/43510958344)

For this model, I didn’t encounter a runner resource or timeout blocker. The main setup costs are downloading the roughly 1.27 GB FP16 model and compiling llama-cpp-python from source.

@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author

Thank you Adeyemo for the modification and improvement. A video should be fine to ensure the revisions and example can be run in an end-to-end manner.

Thank you @MooreZheng. I'll record a short terminal walkthrough of the full end-to-end run and share it here soon.

@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author

Hi, could you run the end-to-end compression benchmark with a few more models, such as Llama 3.1 and Qwen3? The current results only cover Qwen2.5-0.5B-Instruct. Please confirm that the benchmark loads the quantized GGUF for each model and share the resulting metrics.

Thank you @hsj576. I'll run the benchmark on Qwen3 and Llama 3.1 next and post the logs showing each run loads its quantized GGUF, along with the metrics, soon.

And probably a few more models.

@ken6078

ken6078 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the detailed follow-up! If it's running smoothly in CI, would it be possible to integrate it into the validator as well? I think that would be a great addition to help keep things consistent and make the validation process more reliable.

@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author

That sound good @ken6078. I'll wire single_task_bench_with_compression into the validator in this PR.

@kubeedge-bot kubeedge-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 4, 2026
@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author

@ken6078 the compression example is now part of the existing validator in this PR.

The upstream "PR dynamic example validation" job passed on Python 3.11 in 2m 59s, covering dependency installation, asset preparation, compression, inference, and result verification. The JSON report confirms inference loaded the freshly generated qwen2.5-0.5b-instruct-fp16_q8_0.gguf, and that selected_rank.csv and all_rank.csv contain matching, finite metrics.

Successful upstream validation job

@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author
ianvs-compression-demo-short.mp4

@MooreZheng here's the walkthrough. The run completes with Qwen2.5-0.5B-Instruct and covers fresh FP16 → Q8_0 quantization, loading the generated _q8_0.gguf for inference, and writing selected_rank.csv.

Quantization took 14.2 seconds and shrank the file from roughly 1.2 GiB to 645 MiB. Across the three bundled prompts, the run recorded:

  • Average latency: 1.35 seconds
  • Time to first text: 558 ms
  • Throughput: 0.74 requests/s
  • Average process memory: approximately 846 MiB

The last part of the video shows the compressed-model loading confirmation, both file sizes, and the results together, so these numbers only show that the bundled prompts execute.

To reproduce it from this PR's checkout on Ubuntu 24.04 x86-64 with Python 3.11 installed:

bash <<'BASH'
set -euo pipefail

example=examples/llm-edge-benchmark-suite/single_task_bench_with_compression

# Prepare build tools and an isolated environment.
sudo apt-get update
sudo apt-get install -y build-essential cmake
python3.11 -m venv .venv-compression-review
source .venv-compression-review/bin/activate

# Install the CPU runtime and repository dependencies.
python -m pip install torch \
  --index-url https://download.pytorch.org/whl/cpu
python -m pip install -r requirements.txt \
  resources/third_party/sedna-0.6.0.2-py3-none-any.whl
python -m pip install -e . --no-deps

# Install example requirements with CPU build settings.
CMAKE_ARGS="-DGGML_NATIVE=OFF -DLLAMA_CURL=OFF -DGGML_CUDA=OFF" \
CMAKE_BUILD_PARALLEL_LEVEL=4 \
python -m pip install --no-binary=llama-cpp-python \
  -r "$example/requirements.txt"

python -m pip check

# Prepare the FP16 model and quantizer.
python "$example/scripts/prepare_assets.py"

# Run fresh quantization and inference.
rm -f models/qwen/qwen2.5-0.5b-instruct-fp16_q8_0.gguf
ianvs -f "$example/benchmarkingjob.yaml" \
  2>&1 | tee compression-demo.log

# Display the generated model and benchmark results.
grep -F 'Loading compressed GGUF:' compression-demo.log
ls -lh models/qwen/*.gguf
cat workspace/benchmarkingjob/rank/selected_rank.csv
BASH

The first run also downloads the approximately 1.27 GB model and builds llama-cpp-python, so setup takes longer than shown in the video. For the video, I prepared the dependencies and FP16 input beforehand and shortened idle pauses for readability.

Thanks for suggesting the walkthrough!

@BLVCK-MAMBA-6

Copy link
Copy Markdown
Contributor Author

@hsj576 I ran the benchmark on two more models, Qwen3-0.6B and Llama-3.1-8B-Instruct, after the earlier Qwen2.5-0.5B-Instruct run. Both worked.

Both runs used the benchmark code from ffbedd3. Ianvs quantized each FP16 input to Q8_0, loaded the freshly generated _q8_0.gguf for inference, and completed all three bundled prompts. selected_rank.csv and all_rank.csv were generated for both, with matching, finite measurements.

Model CPU environment File size: FP16 → Q8_0 Avg latency (ms) Time to first text (ms) Throughput (requests/s) Avg process RSS (MiB)
Qwen3-0.6B Codespaces: 2 cores, 8 GB RAM Approximately 1.5 GiB → 768 MiB 3,329.49 938.99 0.3003 1,173.65
Llama-3.1-8B-Instruct GitHub Actions: 4 cores, 16 GB RAM 16.07 GB → 8.54 GB (46.85% smaller) 10,715.83 3,876.02 0.0933 8,229.51

The logs confirm each run loaded its generated model:

  • INFO:root:Loading compressed GGUF: models/qwen3/Qwen3-0.6B-f16_q8_0.gguf
  • INFO:root:Loading compressed GGUF: models/llama31/Llama-3.1-8B-Instruct-f16_q8_0.gguf

The native llama.cpp loader also opens those same compressed files.

The Llama 3.1 Actions run finished in 10m 43s, including setup and downloads. Its full logs, configs, summaries, and result tables are in the pr1036-llama31-evidence artifact.

Signed-off-by: Adeyemo Favour <118637798+BLVCK-MAMBA-6@users.noreply.github.com>
@BLVCK-MAMBA-6
BLVCK-MAMBA-6 force-pushed the fix/compression-benchmark-e2e branch from ffbedd3 to d80c810 Compare December 4, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PRE-TEST: llm-edge-benchmark-suite/single_task_bench_with_compression references missing dataset in testenv.yaml

5 participants