Skip to content

Conversation

winskuo-quic
Copy link
Collaborator

@winskuo-quic winskuo-quic commented Aug 20, 2025

Summary

  • Adding static Qwen 2.5 - 1.5B to script.
  • Adding static Qwen 3 0.6B/1.5B to script
  • Adding back skip_advanced_requant.
  • Adding prompt + special token for calibration, which helps certain models to improve accuracy.

Example Scripts:

python examples/qualcomm/oss_scripts/llama/llama.py -b build-android -H haowhsu-linux -s 5f396958 -m SM8750 --prompt "How many r's in strawberries?" --temperature 0 --model_mode kv --max_seq_len 1024 --ptq 16a8w --decoder_model qwen3-0_6b --tasks wikitext --limit 1 --artifact ./qwen3-0_6b

Statistics on SM8750, seq_len=1024

qwen2 1.5B: ~34tok/sec. QNN on device PPL=9.4 (CPU FP=9.1)
qwen3 0.6B: ~56tok/sec. QNN on device PPL=16.8 (CPU FP=16.26)
qwen3 1.7B: ~14tok/sec. QNN on device PPL=14.1 (CPU FP=13.52)

Test plan

E2E in test_qnn_delegate.py

@winskuo-quic winskuo-quic requested a review from cccclai as a code owner August 20, 2025 08:16
Copy link

pytorch-bot bot commented Aug 20, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13544

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit dde5562 with merge base 9359481 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 20, 2025
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@winskuo-quic winskuo-quic marked this pull request as draft August 20, 2025 08:51
@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/qwen2_5-1_5b branch from 4afc025 to dde5562 Compare August 21, 2025 14:02
@winskuo-quic winskuo-quic marked this pull request as ready for review August 21, 2025 14:02
@winskuo-quic
Copy link
Collaborator Author

Hi @cccclai,
This PR is to improve accuracy for qwen3 0.6B/1.7B and enable qwen 2.5 1.5B.
The PPL score does not have much effect, which still closely align with FP CPU.
The main difference here is special tokens such as , are also feed as input during calibration, which makes the output string looks more similar to CPU FP's output.
Before, qwen3 basically could not hit eot and will repeat the same sentence. With this PR, we have tested a couple of prompts, and they can all hit eot condition.

Please have a look.
Thanks

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this in D80726276.

@cccclai cccclai merged commit f154d50 into pytorch:main Aug 25, 2025
104 of 105 checks passed
agrima1304 pushed a commit to agrima1304/executorch that referenced this pull request Aug 26, 2025
…3_0.6B/1.7B and Qwen 2.5_1.5B (pytorch#13544)

### Summary
- Adding static Qwen 2.5 - 1.5B to script.
- Adding static Qwen 3 0.6B/1.5B to script
- Adding back `skip_advanced_requant`.
- Adding prompt + special token for calibration, which helps certain
models to improve accuracy.

#### Example Scripts:
`python examples/qualcomm/oss_scripts/llama/llama.py -b build-android -H
haowhsu-linux -s 5f396958 -m SM8750 --prompt "How many r's in
strawberries?" --temperature 0 --model_mode kv --max_seq_len 1024 --ptq
16a8w --decoder_model qwen3-0_6b --tasks wikitext --limit 1 --artifact
./qwen3-0_6b`

#### Statistics on SM8750, seq_len=1024
qwen2 1.5B: ~34tok/sec. QNN on device PPL=9.4 (CPU FP=9.1)
qwen3 0.6B: ~56tok/sec. QNN on device PPL=16.8 (CPU FP=16.26)
qwen3 1.7B: ~14tok/sec. QNN on device PPL=14.1 (CPU FP=13.52)


### Test plan
E2E in test_qnn_delegate.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants