Lightning-AI / Lightning-AI/lightning-thunder

Thunder and ThunderFX are slower than torch.compile for FP8 and falcon-7b and other models

Open
#1,365 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug

As can be seen below Thunder is slower than torch.compile for single gpu training of falcon-7b:

image

Below are results for ThunderFX for multi-gpu training :
image

Batch sizes and sharding modes doesn't match, but these are the fastest options for ThunderFX:

  • For the first row for micro batch size the same as torch.compile (6) we get even lower throughput - 46.19
  • For the second row for micro batch size 7 and sharing mode zero3 we get throughput 93.5.
To Reproduce

Steps to reproduce the behavior:

python /opt/pytorch/lightning-thunder/thunder/benchmarks/benchmark_litgpt.py \
    --model_name falcon-7b \
    --compile thunder \
    --low_precision_mode fp8-delayed-te  \
    --micro_batch_size 1
Expected behavior

Thunder should be as fast as torch.compile.

Environment

system.device_product_name DGXH100
system.gpu_driver_version 535.129.03
libraries.cuda 12.6.2.004
libraries.pip.lightning 2.4.0.dev20240728
libraries.pip.lightning-thunder 0.2.0.dev0
libraries.pip.lightning-utilities 0.11.8
libraries.pip.litgpt 0.4.11
libraries.pip.nvfuser 0.2.20+git85c22a2
libraries.pip.pytorch-lightning 2.4.0
libraries.pip.torch 2.6.0a0+git96b30dc
libraries.pip.torchmetrics 1.5.1
libraries.pip.torchvision 0.19.0a0+d23a6e1

Contributor guide

No contributing guide indexed for this repository

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 with thunder/benchmarks/benchmark_litgpt.py and reproduce the listed falcon-7b FP8 command on the stated DGX H100 environment. Compare Thunder and ThunderFX with torch.compile using matched batch-size and sharding settings, then use the benchmark results to identify the performance gap. Done means the benchmark confirms Thunder performance is comparable to torch.compile.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.