microsoft / microsoft/onnxruntime-genai
Incorrect output shape for logits output returned from get_output("logits")
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 354
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 85
Description
Describe the bug
I am trying to check perplexity of Phi3.5 model I exported using Olive (See Example linked below). This is a quantized with QDQ nodes and have static shapes (sliding window of 64) with decoder-pipeline.
When I call get_output("logits"), It always returns tensor with [64, N] regardless of the input prompt length.
The logits shape is correct if I use a regular gen-ai model without sliding window..
To Reproduce
- Use olive example to export the model (https://github.com/microsoft/Olive/tree/main/examples/phi3_5#qdq-model-with-4-bit-weights--16-bit-activations)
- Run the model (something like below)
seqlen = 128 input_tokens = test_encodings[ : seqlen] print("Input Seq length: ", input_tokens.shape) generator = og.Generator(model, params) generator.append_tokens(input_tokens) logits = torch.tensor(generator.get_output("logits")) print("- Get Output:", logits.shape)
Outputs:
- Get Output: (1, 64, 32064)
Expected behavior
For Phi3.5, the logits shape should be (1, 128, 32064) for input sequence length of 128.
Desktop (please complete the following information):
- OS: [Windows]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Olive Phi3.5 QDQ export example and the Generator.append_tokens and get_output("logits") entry points described in the report. Reproduce the static sliding-window case with a 128-token prompt, compare it with a regular model, and trace where the returned logits shape is determined. Done means the quantized Phi3.5 output preserves the input sequence length while retaining the expected vocabulary dimension.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- ai, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100