Memory-Efficient Training
GaLore is a research project aimed at making LLM pretraining more efficient.
Why Pretraining a Large Model Is Costly
Training a large language model is expensive, and a large part of that expense comes from the resources a training run consumes. This article looks at a recent research effort that tries to make LLM pretraining more efficient, along with a related large model built for a specific domain. The source for this material is short, so the goal here is to be precise about what it establishes and clear about where it stops.
Where Would You Look First?
Try a quick orientation exercise before reading on. Imagine you are asked to change an existing training script so that it runs more efficiently, and you are told the change should be small. Which part of the script would you look at first? Make a guess and hold onto it, because the rest of the article narrows the answer down.
What do you think happens?
To make a training script more efficient with a small change, which component would you change first?
Reveal answer
The optimizer
According to the source, the required change is a single replacement: PyTorch's AdamW optimizer in the training function is replaced with the GaLoreAdamW optimizer from the galore-torch package. The source does not describe changes to the model architecture, the data pipeline, or the loss function.
What GaLore Is and the Goal It Pursues
GaLore is a research project aimed at making LLM pretraining more efficient. Its goal, as the source frames it, is memory-efficient LLM training.
The word research project matters. GaLore is not described in the source as a standard library function that has always been part of the framework. It is a line of work with a published paper. The source cites that paper as a 2024 work by Zhao et al. titled Memory-Efficient LLM Training by Gradient Low-Rank Projection. The title already signals the two ideas the rest of this article builds on: memory efficiency, and a technique called gradient low-rank projection.
The source also points to a public code repository for GaLore. That repository is where a practitioner would look for the implementation itself, and the source does not reproduce its contents. So when you read about GaLore here, you are reading a summary of the goal and the mechanism names, not a full account of how the implementation works.
The One Code Change: Swapping the Optimizer
The most practically useful statement in the source is about what a developer has to edit. According to the source, adopting GaLore boils down to replacing PyTorch's AdamW optimizer in the training function with the GaLoreAdamW optimizer. That replacement is supplied by the galore-torch Python package.
The optimizer is the part of the training function that applies updates to the model's parameters. Only that component is swapped. The source frames the adoption as one replacement, not as a rewrite of the model or the data pipeline. The diagram above shows the single point of intervention: the optimizer slot. Everything else in the training function stays as it was, according to this description.
Tracing the adoption change
A training function currently uses PyTorch's AdamW optimizer. Using only what the source says, what is the change required to adopt GaLore, and which component does it replace?
- 1Locate the current component
The training function currently uses PyTorch's AdamW. This is the component the source identifies for replacement.
- 2Identify the replacement
The source names GaLoreAdamW as the replacement optimizer, supplied by the galore-torch Python package.
- 3Confirm the scope
The source describes one replacement. It does not describe changes to the model or the data pipeline, so those are not part of the adoption as the source states it.
Replace PyTorch's AdamW optimizer in the training function with GaLoreAdamW from the galore-torch package. This replaces the optimizer component only.
Gradient Low-Rank Projection Inside GaLore
The source treats Gradient Low-Rank Projection as a technique used in GaLore, and it states that GaLore uses this technique for memory-efficient LLM training. The relationship is one of containment. GaLore is the larger project. Gradient Low-Rank Projection is one of the mechanisms it relies on to reduce memory use during training.
This is why the technique is named the way it is. The name Gradient Low-Rank Projection places memory efficiency at the center of the approach, since the source assigns the technique the role of reducing memory use during training. The source does not go further than that role.
Where the Source Stops
The source does not walk through the internal steps of Gradient Low-Rank Projection. It does not explain which quantities are projected, how the projection is computed, or what the rank is set to. Rather than invent those details, this article limits itself to the roles the source assigns: a technique, used by GaLore, aimed at memory-efficient training.
BloombergGPT: Stated Versus Unexplained
The source also cites BloombergGPT. It is described as a large language model for finance, attributed to Wu et al. in 2023, with the title BloombergGPT: A Large Language Model for Finance. The source states that this is a domain-specific model, and that is the main fact it provides about it. Beyond that, the source gives no further details. The table below separates what is stated from what is missing.
| Aspect | Stated in the source | Left unexplained by the source |
|---|---|---|
| Purpose | A large language model for finance | Which specific financial tasks it was built for |
| Scope | A domain-specific model | How its training data was assembled |
| Authorship | Attributed to Wu et al., 2023 | Any further background on the project |
| Title | BloombergGPT: A Large Language Model for Finance | Architecture, size, or results |
What the source establishes about BloombergGPT and what it leaves open
Mistakes Beginners Make
Common mistake Assuming GaLore requires rewriting the model or the data pipeline
What it looks likePlanning a full rewrite of the model before trying GaLore
Why it failsThe source frames adoption as one replacement of the optimizer component.
Do this insteadStart by identifying the optimizer in the training function, since that is the component the source says to replace.
Common mistake Treating Gradient Low-Rank Projection as the whole of GaLore
What it looks likeDescribing GaLore only as the projection technique
Why it failsThe source describes GaLore as the larger research project, with Gradient Low-Rank Projection as one mechanism it uses.
Do this insteadDescribe GaLore as the project with the goal of memory-efficient LLM pretraining, and the projection as a technique it relies on.
Common mistake Explaining how the projection is computed based on the source
Why it failsThe source does not describe the projection's internal steps, the quantities projected, or the rank.
Do this insteadState the role the source gives the technique and point to the cited paper for the mechanism.
Common mistake Presenting details about BloombergGPT, such as its size or results, as stated by the source
Practice: Trace the Change
A colleague says that to adopt GaLore, you must rewrite the model, change the data pipeline, and replace the optimizer. Using only the source, explain which parts of this claim are supported and which are not, and name the one component the source says to replace.
Hints
- Look for the sentence that says the required change boils down to one replacement.
- Consider which of the three proposed changes the source actually mentions.
- The source names the replacement optimizer and the package that supplies it.
Key Takeaways
- GaLore is a research project aimed at making LLM pretraining more efficient, and it is described in the source as a published 2024 work by Zhao et al.
- According to the source, adopting GaLore means replacing PyTorch's AdamW optimizer in the training function with GaLoreAdamW from the galore-torch package, a single component change.
- Gradient Low-Rank Projection is a technique GaLore uses to reduce memory use during training, named for its memory-efficiency role; its internal mechanism is in the cited paper, not the source.
- The source states that BloombergGPT is a large language model for finance, attributed to Wu et al. in 2023, and gives no further details about it.