Feature Request: Add THD / Packed-Sequence Training Support
Maintainers usually reply within 3 days
@Anubhav-2003 is already working on this.
Since Jul 22, 2026.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- python
- Domain
- machine-learning, performance
Research direction
The issue names no implementation files, entry points, or tests. Start by surveying the existing Liger kernels and their shape-related tests, then determine which kernels need THD inputs and sequence metadata such as cu_seqlens and max_seqlen. Done means the supported kernels accept packed layouts without padding assumptions and have coverage for variable-length training.
Written by the indexing model from the issue text.
Description
🚀 The feature, motivation and pitch
Motivation
Some training frameworks represent variable-length batches in a packed THD layout, where activations are shaped like (total_tokens, num_heads, head_dim), or more generally (total_tokens, hidden_dim), instead of the standard padded batch layout (batch_size, seq_len, ...).
This layout is useful for sequence packing and variable-length training because it avoids padding overhead.
Supporting this layout may require passing sequence metadata such as cu_seqlens or max_seqlen to kernels that need per-sequence position information.
Request
Add support for THD / packed-sequence training layouts across Liger kernels.
The long-term goal is to support inputs such as hidden_states: (total_tokens, hidden_dim) and attention tensors such as (total_tokens, num_heads, head_dim), with metadata such as cu_seqlens and max_seqlen where needed.
Alternatives
No response
Additional context
No response
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 656
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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.
More from linkedin/Liger-Kernel
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
linkedin/Liger-Kernel#1658 ·
Maintainers usually reply within 3 days
-
LigerPolyNorm defaults to in_place=True (docstring says False) and overwrites shared gradientsPossibly taken @nazek52 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
linkedin/Liger-Kernel#1647 ·
Maintainers usually reply within 3 days
-
[Bug] Experimental embedding kernels overflow int32 row offsets (illegal memory access past 2^31 output elements)Possibly taken @0xDexe claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
linkedin/Liger-Kernel#1570 · 3 comments ·
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
linkedin/Liger-Kernel#1661 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
linkedin/Liger-Kernel#1660 ·
Maintainers usually reply within 3 days
All issues in linkedin/Liger-Kernel
Similar issues
-
author-page correction move-papers
Difficulty 1/5 Under an hour Newbie friendliness 78/100
acl-org/acl-anthology#10978 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
GoogleCloudPlatform/professional-services-data-validator#1899 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
HKUDS/CLI-Anything#652 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Project-N-E-K-O/N.E.K.O#3813 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Dao-AILab/flash-attention#3191 ·
Maintainers usually reply within 4 days