LogoLogo
Continuum WebsiteContinuum ApplicationsContinuum KnowledgeAxolotl Platform
Continuum Knowledge
Continuum Knowledge
  • Continuum
  • Data
    • Datasets
      • Pre Training Data
      • Types of Fine Tuning
      • Self Instruct Paper
      • Self-Alignment with Instruction Backtranslation
      • Systematic Evaluation of Instruction-Tuned Large Language Models on Open Datasets
      • Instruction Tuning
      • Instruction Fine Tuning - Alpagasus
      • Less is More For Alignment
      • Enhanced Supervised Fine Tuning
      • Visualising Data using t-SNE
      • UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction
      • Training and Evaluation Datasets
      • What is perplexity?
  • MODELS
    • Foundation Models
      • The leaderboard
      • Foundation Models
      • LLama 2 - Analysis
      • Analysis of Llama 3
      • Llama 3.1 series
      • Google Gemini 1.5
      • Platypus: Quick, Cheap, and Powerful Refinement of LLMs
      • Mixtral of Experts
      • Mixture-of-Agents (MoA)
      • Phi 1.5
        • Refining the Art of AI Training: A Deep Dive into Phi 1.5's Innovative Approach
      • Phi 2.0
      • Phi-3 Technical Report
  • Training
    • The Fine Tuning Process
      • Why fine tune?
        • Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?
        • Explanations in Fine Tuning
      • Tokenization
        • Tokenization Is More Than Compression
        • Tokenization - SentencePiece
        • Tokenization explore
        • Tokenizer Choice For LLM Training: Negligible or Crucial?
        • Getting the most out of your tokenizer for pre-training and domain adaptation
        • TokenMonster
      • Parameter Efficient Fine Tuning
        • P-Tuning
          • The Power of Scale for Parameter-Efficient Prompt Tuning
        • Prefix-Tuning: Optimizing Continuous Prompts for Generation
        • Harnessing the Power of PEFT: A Smarter Approach to Fine-tuning Pre-trained Models
        • What is Low-Rank Adaptation (LoRA) - explained by the inventor
        • Low Rank Adaptation (Lora)
        • Practical Tips for Fine-tuning LMs Using LoRA (Low-Rank Adaptation)
        • QLORA: Efficient Finetuning of Quantized LLMs
        • Bits and Bytes
        • The Magic behind Qlora
        • Practical Guide to LoRA: Tips and Tricks for Effective Model Adaptation
        • The quantization constant
        • QLORA: Efficient Finetuning of Quantized Language Models
        • QLORA and Fine-Tuning of Quantized Language Models (LMs)
        • ReLoRA: High-Rank Training Through Low-Rank Updates
        • SLoRA: Federated Parameter Efficient Fine-Tuning of Language Models
        • GaLora: Memory-Efficient LLM Training by Gradient Low-Rank Projection
      • Hyperparameters
        • Batch Size
        • Padding Tokens
        • Mixed precision training
        • FP8 Formats for Deep Learning
        • Floating Point Numbers
        • Batch Size and Model loss
        • Batch Normalisation
        • Rethinking Learning Rate Tuning in the Era of Language Models
        • Sample Packing
        • Gradient accumulation
        • A process for choosing the learning rate
        • Learning Rate Scheduler
        • Checkpoints
        • A Survey on Efficient Training of Transformers
        • Sequence Length Warmup
        • Understanding Training vs. Evaluation Data Splits
        • Cross-entropy loss
        • Weight Decay
        • Optimiser
        • Caching
      • Training Processes
        • Extending the context window
        • PyTorch Fully Sharded Data Parallel (FSDP)
        • Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
        • YaRN: Efficient Context Window Extension of Large Language Models
        • Sliding Window Attention
        • LongRoPE
        • Reinforcement Learning
        • An introduction to reinforcement learning
        • Reinforcement Learning from Human Feedback (RLHF)
        • Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • INFERENCE
    • Why is inference important?
      • Grouped Query Attention
      • Key Value Cache
      • Flash Attention
      • Flash Attention 2
      • StreamingLLM
      • Paged Attention and vLLM
      • TensorRT-LLM
      • Torchscript
      • NVIDIA L40S GPU
      • Triton Inference Server - Introduction
      • Triton Inference Server
      • FiDO: Fusion-in-Decoder optimised for stronger performance and faster inference
      • Is PUE a useful measure of data centre performance?
      • SLORA
  • KNOWLEDGE
    • Vector Databases
      • A Comprehensive Survey on Vector Databases
      • Vector database management systems: Fundamental concepts, use-cases, and current challenges
      • Using the Output Embedding to Improve Language Models
      • Decoding Sentence-BERT
      • ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT
      • SimCSE: Simple Contrastive Learning of Sentence Embeddings
      • Questions Are All You Need to Train a Dense Passage Retriever
      • Improving Text Embeddings with Large Language Models
      • Massive Text Embedding Benchmark
      • RocketQAv2: A Joint Training Method for Dense Passage Retrieval and Passage Re-ranking
      • LLM2Vec: Large Language Models Are Secretly Powerful Text Encoders
      • Embedding and Fine-Tuning in Neural Language Models
      • Embedding Model Construction
      • Demystifying Embedding Spaces using Large Language Models
      • Fine-Tuning Llama for Multi-Stage Text Retrieval
      • Large Language Model Based Text Augmentation Enhanced Personality Detection Model
      • One Embedder, Any Task: Instruction-Finetuned Text Embeddings
      • Vector Databases are not the only solution
      • Knowledge Graphs
        • Harnessing Knowledge Graphs to Elevate AI: A Technical Exploration
        • Unifying Large Language Models and Knowledge Graphs: A Roadmap
      • Approximate Nearest Neighbor (ANN)
      • High Dimensional Data
      • Principal Component Analysis (PCA)
      • Vector Similarity Search - HNSW
      • FAISS (Facebook AI Similarity Search)
      • Unsupervised Dense Retrievers
    • Retrieval Augmented Generation
      • Retrieval-Augmented Generation for Large Language Models: A Survey
      • Fine-Tuning or Retrieval?
      • Revolutionising Information Retrieval: The Power of RAG in Language Models
      • A Survey on Retrieval-Augmented Text Generation
      • REALM: Retrieval-Augmented Language Model Pre-Training
      • Retrieve Anything To Augment Large Language Models
      • Generate Rather Than Retrieve: Large Language Models Are Strong Context Generators
      • Active Retrieval Augmented Generation
      • DSPy: LM Assertions: Enhancing Language Model Pipelines with Computational Constraints
      • DSPy: Compiling Declarative Language Model Calls
      • DSPy: In-Context Learning for Extreme Multi-Label Classification
      • Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programs
      • HYDE: Revolutionising Search with Hypothetical Document Embeddings
      • Enhancing Recommender Systems with Large Language Model Reasoning Graphs
      • Retrieval Augmented Generation (RAG) versus fine tuning
      • RAFT: Adapting Language Model to Domain Specific RAG
      • Summarisation Methods and RAG
      • Lessons Learned on LLM RAG Solutions
      • Stanford: Retrieval Augmented Language Models
      • Overview of RAG Approaches with Vector Databases
      • Mastering Chunking in Retrieval-Augmented Generation (RAG) Systems
    • Semantic Routing
    • Resource Description Framework (RDF)
  • AGENTS
    • What is agency?
      • Rephrase and Respond: Let Large Language Models Ask Better Questions for Themselves
      • Types of Agents
      • The risk of AI agency
      • Understanding Personality in Large Language Models: A New Frontier in AI Psychology
      • AI Agents - Reasoning, Planning, and Tool Calling
      • Personality and Brand
      • Agent Interaction via APIs
      • Bridging Minds and Machines: The Legacy of Newell, Shaw, and Simon
      • A Survey on Language Model based Autonomous Agents
      • Large Language Models as Agents
      • AI Reasoning: A Deep Dive into Chain-of-Thought Prompting
      • Enhancing AI Reasoning with Self-Taught Reasoner (STaR)
      • Exploring the Frontier of AI: The "Tree of Thoughts" Framework
      • Toolformer: Revolutionising Language Models with API Integration - An Analysis
      • TaskMatrix.AI: Bridging Foundational AI Models with Specialised Systems for Enhanced Task Completion
      • Unleashing the Power of LLMs in API Integration: The Rise of Gorilla
      • Andrew Ng's presentation on AI agents
      • Making AI accessible with Andrej Karpathy and Stephanie Zhan
  • Regulation and Ethics
    • Regulation and Ethics
      • Privacy
      • Detecting AI Generated content
      • Navigating the IP Maze in AI: The Convergence of Blockchain, Web 3.0, and LLMs
      • Adverse Reactions to generative AI
      • Navigating the Ethical Minefield: The Challenge of Security in Large Language Models
      • Navigating the Uncharted Waters: The Risks of Autonomous AI in Military Decision-Making
  • DISRUPTION
    • Data Architecture
      • What is a data pipeline?
      • What is Reverse ETL?
      • Unstructured Data and Generatve AI
      • Resource Description Framework (RDF)
      • Integrating generative AI with the Semantic Web
    • Search
      • BM25 - Search Engine Ranking Function
      • BERT as a reranking engine
      • BERT and Google
      • Generative Engine Optimisation (GEO)
      • Billion-scale similarity search with GPUs
      • FOLLOWIR: Evaluating and Teaching Information Retrieval Models to Follow Instructions
      • Neural Collaborative Filtering
      • Federated Neural Collaborative Filtering
      • Latent Space versus Embedding Space
      • Improving Text Embeddings with Large Language Models
    • Recommendation Engines
      • On Interpretation and Measurement of Soft Attributes for Recommendation
      • A Survey on Large Language Models for Recommendation
      • Model driven recommendation systems
      • Recommender AI Agent: Integrating Large Language Models for Interactive Recommendations
      • Foundation Models for Recommender Systems
      • Exploring the Impact of Large Language Models on Recommender Systems: An Extensive Review
      • AI driven recommendations - harming autonomy?
    • Logging
      • A Taxonomy of Anomalies in Log Data
      • Deeplog
      • LogBERT: Log Anomaly Detection via BERT
      • Experience Report: Deep Learning-based System Log Analysis for Anomaly Detection
      • Log-based Anomaly Detection with Deep Learning: How Far Are We?
      • Deep Learning for Anomaly Detection in Log Data: A Survey
      • LogGPT
      • Adaptive Semantic Gate Networks (ASGNet) for log-based anomaly diagnosis
  • Infrastructure
    • The modern data centre
      • Enhancing Data Centre Efficiency: Strategies to Improve PUE
      • TCO of NVIDIA GPUs and falling barriers to entry
      • Maximising GPU Utilisation with Kubernetes and NVIDIA GPU Operator
      • Data Centres
      • Liquid Cooling
    • Servers and Chips
      • The NVIDIA H100 GPU
      • NVIDIA H100 NVL
      • Lambda Hyperplane 8-H100
      • NVIDIA DGX Servers
      • NVIDIA DGX-2
      • NVIDIA DGX H-100 System
      • NVLink Switch
      • Tensor Cores
      • NVIDIA Grace Hopper Superchip
      • NVIDIA Grace CPU Superchip
      • NVIDIA GB200 NVL72
      • Hopper versus Blackwell
      • HGX: High-Performance GPU Platforms
      • ARM Chips
      • ARM versus x86
      • RISC versus CISC
      • Introduction to RISC-V
    • Networking and Connectivity
      • Infiniband versus Ethernet
      • NVIDIA Quantum InfiniBand
      • PCIe (Peripheral Component Interconnect Express)
      • NVIDIA ConnectX InfiniBand adapters
      • NVMe (Non-Volatile Memory Express)
      • NVMe over Fabrics (NVMe-oF)
      • NVIDIA Spectrum-X
      • NVIDIA GPUDirect
      • Evaluating Modern GPU Interconnect
      • Scalable Hierarchical Aggregation and Reduction Protocol (SHARP)
      • Next-generation networking in AI environments
      • NVIDIA Collective Communications Library (NCCL)
    • Data and Memory
      • NVIDIA BlueField Data Processing Units (DPUs)
      • Remote Direct Memory Access (RDMA)
      • High Bandwidth Memory (HBM3)
      • Flash Memory
      • Model Requirements
      • Calculating GPU memory for serving LLMs
      • Transformer training costs
      • GPU Performance Optimisation
    • Libraries and Complements
      • NVIDIA Base Command
      • NVIDIA AI Enterprise
      • CUDA - NVIDIA GTC 2024 presentation
      • RAPIDs
      • RAFT
    • Vast Data Platform
      • Vast Datastore
      • Vast Database
      • Vast Data Engine
      • DASE (Disaggregated and Shared Everything)
      • Dremio and VAST Data
    • Storage
      • WEKA: A High-Performance Storage Solution for AI Workloads
      • Introduction to NVIDIA GPUDirect Storage (GDS)
        • GDS cuFile API
      • NVIDIA Magnum IO GPUDirect Storage (GDS)
      • Vectors in Memory
Powered by GitBook
LogoLogo

Continuum - Accelerated Artificial Intelligence

  • Continuum Website
  • Axolotl Platform

Copyright Continuum Labs - 2023

On this page
  • Key Differences between Language Models and Traditional Deep Neural Networks
  • LRBench++
  • LR Schedule Monitor
  • LR Policy Database
  • LR Value Range Test
  • LR Policy Visualizer
  • LR Policy Evaluator
  • LR Tuning Optimisations
  • LRBench++ offers three LR tuning methods with different objectives
  • Discussion and Future Directions
  • So what learning rate should I use?
  • Examples of Learning Rates used in fine tuning:

Was this helpful?

  1. Training
  2. The Fine Tuning Process
  3. Hyperparameters

Rethinking Learning Rate Tuning in the Era of Language Models

One of the most important hyperparameters

PreviousBatch NormalisationNextSample Packing

Last updated 1 year ago

Was this helpful?

The learning rate is a critical hyperparameter that determines the step size used to update the model's weights during optimization.

The authors of this December 2023 paper highlight the recent success of LMs and the trend of fine-tuning pre-trained LMs for various applications due to the high costs associated with training LMs from scratch.

They emphasize the importance of the learning rate as a critical hyperparameter in LM fine-tuning, which directly impacts both fine-tuning efficiency and the quality of the fine-tuned LMs.

The authors argue that existing learning rate policies, primarily designed for traditional deep neural networks (DNNs), may not work well for LM fine-tuning, and there is a need to reassess the research challenges and opportunities in learning rate tuning for LMs.

Based on the analysis provided in the paper, there are several key challenges associated with choosing the right learning rate, both for traditional deep neural network (DNN) training and large language model (LLM) fine-tuning:

Learning rate directly impacts training effectiveness and model accuracy

The learning rate is one of the most critical hyperparameters in both DNN training and LM fine-tuning. It controls the magnitude of gradients updated on the model parameters, allowing the optimizer to adjust the learning speed for each iteration. Choosing an inappropriate learning rate can significantly impair the training process and the resulting model's performance.

Difficulty in finding the optimal learning rate

It can be a daunting task to identify a good learning rate. If the learning rate is too small, the model may fail to converge or progress very slowly. On the other hand, if the learning rate is too large, the model may overshoot the optimal solution, leading to suboptimal performance or even divergence.

Trial-and-error approach is time-consuming and expensive

The conventional method for finding the right learning rate involves manual tuning, where different learning rates are tried one at a time. This trial-and-error approach is tedious, time-consuming, and highly expensive, especially for LLMs with their high complexity and fine-tuning costs.

Lack of systematic studies for LLM fine-tuning

While there has been research on learning rate policies for traditional DNN training, there is a lack of systematic studies on how to achieve high efficiency and high accuracy in LLM fine-tuning.

Most existing LLM fine-tuning methods still follow similar assumptions and principles to traditional deep learning training/fine-tuning, which may not be optimal given the unique characteristics of LLMs.

Key Differences between Language Models and Traditional Deep Neural Networks

The paper discusses several key differences between LMs and traditional DNNs, including:

Model complexity: LMs have billions of parameters, while traditional DNNs have millions

Training/fine-tuning costs: LM training/fine-tuning is much more expensive than traditional DNN training

Model initialization: LM fine-tuning often starts from pre-trained models, while traditional DNN training starts from random initialisation.

Training epochs: LM training/fine-tuning requires fewer epochs (2-3) compared to traditional DNN training (100+).

Evaluation strategies: LM evaluation may involve time-consuming real-world tasks, while traditional DNNs can be quickly evaluated on testing data.

These differences highlight the need to rethink the learning rate tuning paradigm for LLMs.

LRBench++

The authors present LRBench++, a learning rate benchmarking and tuning tool for both traditional DNNs and LLMs.

LRBench++ provides support for LLM implementations, iteration-based LR tuning, and systematic NLP learning tasks for evaluating LLMs.

It also incorporates popular hyperparameter tuning algorithms, such as grid search and random search, and supports different LR tuning methods for various training/fine-tuning objectives.

The LRBench++ system is an enhanced version of LRBench designed for evaluating, selecting, and tuning learning rate (LR) policies to optimise both traditional deep neural network (DNN) training and language model (LM) fine-tuning.

It incorporates several core components and features to address the unique challenges associated with LM training and fine-tuning. Let's dive into the details of each component and how they work together:

LR Schedule Monitor

The LR schedule monitor continuously tracks the training/fine-tuning status of the DNN/LLM and updates the learning rate value based on the specified LR policy.

Functionality: It closely monitors the progress of the training/fine-tuning process, including metrics such as the current epoch, iteration, and loss values. Based on this information and the selected LR policy, the monitor adjusts the learning rate accordingly. This ensures that the LR is dynamically adapted throughout the training/fine-tuning process.

LR Policy Database

The LR policy database serves as a repository to store and organise the LR tuning results for different learning tasks.

Functionality: It maintains a structured collection of LR tuning results, categorized by the specific learning task (e.g., image classification, object detection, sentiment analysis). This database allows users to access and leverage previous tuning results, facilitating knowledge sharing and reducing the need for redundant tuning efforts.

LR Value Range Test

The LR value range test employs a grid search approach to determine an appropriate range of LR values, effectively narrowing down the search space.

Functionality: It systematically explores a predefined grid of LR values and evaluates the model's performance for each value. By analysing the results, it identifies a suitable range of LR values that yield good performance. This range serves as a starting point for further fine-grained tuning, saving computational resources and time.

LR Policy Visualizer

The LR policy visualizer provides a visual representation of the DNN/LLM training/fine-tuning status and the corresponding LR values over time.

Functionality: It generates intuitive visualizations, such as plots and graphs, that display the evolution of the learning rate throughout the training/fine-tuning process. These visualizations help users gain insights into the behavior of different LR policies and their impact on model performance.

LR Policy Evaluator

The LR policy evaluator assesses and compares alternative LR policies to estimate optimal LR parameters and enables dynamic LR tuning.

Functionality: It conducts a comprehensive evaluation of different LR policies by running multiple training/fine-tuning experiments with varying LR configurations.

By analysing the results, it identifies the most promising LR policies and estimates the best LR parameters for a given learning task. Additionally, it supports dynamic LR tuning, allowing for real-time adjustments based on the model's performance during training/fine-tuning.

LR Tuning Optimisations

LRBench++ incorporates various optimisation techniques to enhance the efficiency and scalability of the LR tuning process.

  • Grid Search: It performs an exhaustive search over a predefined grid of LR parameter values, evaluating all possible combinations to find the optimal configuration.

  • Random Search: It randomly samples LR parameter values from a defined search space, allowing for a more efficient exploration compared to grid search.

  • Distributed Parallel Tuning: Built on top of Ray Tune [30], it enables distributed and parallel execution of LR tuning experiments, leveraging multiple computing resources to accelerate the tuning process.

LRBench++ offers three LR tuning methods with different objectives

Single Policy LR Selection

  • Aims to identify the best single LR policy that maximizes model accuracy within given training/fine-tuning constraints, such as a predefined number of iterations.

Multi-policy LR Composition

  • Focuses on composing multiple LR policies to achieve optimal model accuracy while adhering to the specified training/fine-tuning constraints.

Cost-effective LR Tuning

  • Seeks to minimize training costs while reaching a target accuracy threshold, balancing performance and computational resources.

By leveraging these components and features, LRBench++ provides a comprehensive platform for benchmarking and tuning learning rate policies for both traditional DNNs and LLMs.

Its modular design allows users to utilize different modules based on their specific requirements, making it adaptable to various real-world scenarios. LRBench++ aims to serve as a public platform for the community to collect, share, and leverage LR tuning results, fostering collaboration and advancing the field of deep learning and large language models.

Discussion and Future Directions

The authors summarise common practices in LM fine-tuning settings and discuss the research challenges and opportunities in learning rate tuning for LMs, including cost-effective LR tuning, benchmarking LRs, and evaluating LM performance during training/fine-tuning.

The authors present LRBench++, a valuable tool for benchmarking and tuning learning rates for both traditional DNNs and LLMs. The experimental analysis reveals key insights into the impact of learning rates on LLM fine-tuning and provides a foundation for future research in this area.

So what learning rate should I use?

When fine-tuning, it's often recommended to use a smaller learning rate than used during pre-training, as you want to make smaller updates to the already learned weights rather than learning from scratch.

We can't always use a high learning rate because it can cause the optimisation algorithm to overshoot the optimal values of the parameters, resulting in instability and slow convergence.

Additionally, a high learning rate can cause the loss to fluctuate wildly, making it difficult to determine whether the model is improving or not.

The function to calculate new weights using a learning rate is:

new_weights = old_weights - learning_rate * gradient

The learning rate is an important parameter, which depends on the optimiser, the model, and many more other hyperparameters.

A usual good starting point is 0.1 for SGD, and 1e-3 for Adam.

The deeper the model is, the lower the learning rate usually should be. For instance, Transformer models usually apply learning rates of 1e-5 to 1e-4 for Adam.

The lower your batch, the lower the learning rate should be. Consider using gradient accumulation if your batch size is getting too small (PyTorch Lightning supports this, see here).

Consider using the PyTorch Lightning learning rate finder toolkit for an initial good guess.

Examples of Learning Rates used in fine tuning:

N.B. In scientific notation, "2×10^−5" means 2 times 10 raised to the power of negative 5. This is a way to represent very small or very large numbers succinctly. Specifically, 2×10^−5 is equal to 0.00002.

Alpaca-7B: The learning rate is 2×10−52×10−52×10−52×10−52×10−52×10−5 (2e-5). The LR Scheduler used is "WarmupDecayLR". It is trained for 3 epochs with a warmup percentage of 0.03.

Vicuna-7B: The learning rate is 2×10−52×10−52×10−52×10−52×10−52×10−5 (2e-5). It uses the "cosine" learning rate scheduler. The training duration is 3 epochs with a warmup percentage of 0.03.

WizardLM-7B: Here, the learning rate is also 2×10−52×10−52×10−52×10−52×10−52×10−5 (2e-5), with a "cosine" LR scheduler. It's trained for 3 epochs, but the warmup is different, being 2 (which might indicate 2% or 2 epochs, depending on the context).

GPT4All-J-6B: The learning rate is 2×10−52×10−52×10−52×10−52×10−52×10−5 (2e-5) with a "WarmupLR" scheduler. The model is trained for 2 epochs with a warmup of 500, which likely refers to 500 steps.

Dolly-7B: This model has a slightly lower learning rate of 5×10−65×10−65×10−65×10−65×10−65×10−6 (5e-6). It also uses the "WarmupLR" scheduler, is trained for 2 epochs, and has a warmup of 50 steps.

Rethinking Learning Rate Tuning in the Era of Large Language ModelsarXiv.org
Logo
Core Components of LRBench++
Page cover image