linkedin / linkedin/Liger-Kernel

No Significant Improvement Observed in Model Training Speed

Open
#664 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.6k
Forks
603
Avg merge
1d 20h
Merged PRs (30d)
47

Description

I am trying to speedup inference and training of a `mistralai/Mistral-Small-3.1-24B-Instruct-2503` model.

Simply replacing `AutoModelForCausalLM` with `AutoLigerKernelForCausalLM` does not lead to any speedup in my sampling speed or memory usage. I am also using DeepSpeed for distributed training.

```
model = AutoLigerKernelForCausalLM.from_pretrained(
"mistralai/Mistral-Small-3.1-24B-Instruct-2503",
torch_dtype=TorchDtype.float32,
attn_implementation="sdpa",
)
```

I have also tried this with the same result:

```
model = AutoModelForCausalLM.from_pretrained(
"mistralai/Mistral-Small-3.1-24B-Instruct-2503",
torch_dtype=TorchDtype.float32,
attn_implementation="sdpa",
)
apply_liger_kernel_to_mistral(
rope=True,
cross_entropy=False,
fused_linear_cross_entropy=True,
rms_norm=True,
swiglu=True,
model=model,
)
```

Am I missing anything? Thanks for any help.
Should I expect to see the speedup and memory optimization in the autoregressive generative sampling or in the backward pass? or in both?

########################

Python version: 3.12.9
PyTorch version: 2.6.0+cu124
CUDA version: 12.4
Triton version: 3.2.0
Transformers version: 4.51.1
DeepSpeed version: 0.15.4

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the Mistral-Small-3.1-24B setup using AutoLigerKernelForCausalLM and apply_liger_kernel_to_mistral with the listed PyTorch, CUDA, Triton, Transformers, and DeepSpeed versions. Compare autoregressive sampling, training forward, backward, and memory usage against AutoModelForCausalLM, then establish which measurements should improve and document the cause of any discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.