Skip to content

Add support to APOLLO - #6617

Merged
hiyouga merged 1 commit into
hiyouga:mainfrom
zhuhanqing:apollo
Jan 14, 2025
Merged

Add support to APOLLO#6617
hiyouga merged 1 commit into
hiyouga:mainfrom
zhuhanqing:apollo

Conversation

@zhuhanqing

Copy link
Copy Markdown
Contributor

Adding Support for APOLLO

This pull request introduces APOLLO, a memory-efficient optimizer tailored for pre-training large language models (LLMs) and full-parameter fine-tuning. APOLLO significantly reduces memory overhead compared to AdamW while maintaining comparable performance, making it ideal for LLM workflows.

Project page: APOLLO GitHub Repository


Features

  • Low Memory Overhead: APOLLO achieves memory usage similar to SGD, even in rank-1 space, enabling efficient pre-training and fine-tuning of LLMs.
  • AdamW-level performance: APOLLO achieves on-par or even better performance than AdamW, even at a much reduced rank.
  • No SVD Requirement: Unlike GaLore, APOLLO does not require Singular Value Decomposition (SVD), eliminating the SVD delays commonly encountered when using GaLore.

Tests

We have added a test in the examples/extras/apollo directory. Additionally, we conducted a comparative evaluation with GaLore by fine-tuning models and testing on the MMLU task.

GaLore Performance

Average: 64.96
           STEM: 55.43
Social Sciences: 75.66
     Humanities: 59.72
          Other: 71.25

APOLLO Performance (Scaling Factor = 32)

With a scaling factor derived from the ratio of LLaMA-8B dimension (4096) to rank (128):

Average: 65.03
           STEM: 55.47
Social Sciences: 76.15
     Humanities: 59.60
          Other: 71.28

Why APOLLO?

APOLLO offers a compelling alternative to existing optimizers, especially for large-scale LLM pre-training and fine-tuning. Its reduced memory footprint and simplicity (no SVD) make it a practical choice for researchers and engineers.

@hiyouga
hiyouga self-requested a review January 13, 2025 06:43
@hiyouga hiyouga added pending This problem is yet to be addressed enhancement New feature or request labels Jan 13, 2025

@hiyouga hiyouga left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hiyouga
hiyouga merged commit d9189f9 into hiyouga:main Jan 14, 2025
@hiyouga hiyouga added solved This problem has been already solved and removed enhancement New feature or request pending This problem is yet to be addressed labels Jan 14, 2025
1587causalai pushed a commit to 1587causalai/llama_factory that referenced this pull request Feb 18, 2025
stephen-nju pushed a commit to stephen-nju/Llmtrain that referenced this pull request Mar 24, 2025
yoonseok312 pushed a commit to pensieve-ai/LLaMA-Factory-vlm that referenced this pull request Apr 29, 2025
liu-qingyuan pushed a commit to liu-qingyuan/LLaMA-Factory-Megafake that referenced this pull request Jun 6, 2025
xuguodong1999 pushed a commit to xuguodong1999/LLaMA-Factory that referenced this pull request May 5, 2026
Former-commit-id: 5a252e5a458457adbd19da3b68a3897ad2962824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

solved This problem has been already solved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants