[QnA]: Why `cos` and `sin` is expected to be `hdim`, not `hdim//2`?

Open
#844 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, pytorch

Research direction

Start with src/liger_kernel/ops/qwen2vl_mrope.py at the linked lines, then inspect the related unit tests and Qwen2-VL MRoPE behavior. Determine whether the kernel intentionally requires full-dimension cos and sin inputs or can accept half-dimension values, and document the reasoning or expected interface when the question is resolved.

Written by the indexing model from the issue text.

Description

question

I have a question regarding to the qwen2_vl MRope. From my understanding is as follows:

full_cos = torch.cat([cos_halfdim, cos_halfdim], dim=-1)
full_sin = torch.cat([sin_halfdim, sin_halfdim], dim=-1)

However from the unit tests and the code here,

https://github.com/linkedin/Liger-Kernel/blob/2845fe8363a6f40a265ec8102523fe4c0ded068e/src/liger_kernel/ops/qwen2vl_mrope.py#L7

the cos and sin are full_cos and full_sin instead. Is there a reason to not just pass half of the cos and sin to save memory movement?

Dominant language
Python
Stars
6.7k
Forks
673
Avg merge
4d 20h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from linkedin/Liger-Kernel

All issues in linkedin/Liger-Kernel

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.