0% found this document useful (0 votes)
5 views3 pages

CS336 Assignment 2: Distributed LLM Tuning

The assignment focuses on the distributed fine-tuning of the LLaMA 3B model using 2 GPUs, emphasizing data, tensor, and pipeline parallelism techniques. Deliverables include a report on the training methods and performance, along with code access on HPC. Evaluation will be based on training efficiency and the perplexity metric computed on a subset of the dataset.

Uploaded by

daiveekiitkgp
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

CS336 Assignment 2: Distributed LLM Tuning

The assignment focuses on the distributed fine-tuning of the LLaMA 3B model using 2 GPUs, emphasizing data, tensor, and pipeline parallelism techniques. Deliverables include a report on the training methods and performance, along with code access on HPC. Evaluation will be based on training efficiency and the perplexity metric computed on a subset of the dataset.

Uploaded by

daiveekiitkgp
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Programming Assignment 2 -

Distributed LLM Fine Tuning


Assignment Overview
Goal: Distributed Fine-Tuning of LLaMA on 2 GPUs

Dataset
Same dataset as Programming Assignment 1.

Pretrained Model
●​ LLaMA 3B model
●​ On the cloud burst compute file system: /scratch/BDML25SP/

Key Focus
We will be focusing on distributed training
●​ Data Parallelism
●​ Tensor Parallelism
●​ Pipeline Parallelism

The goal of the assignment is to implement these techniques on 2 GPUs and achieve high
training efficiency (time per epoch).

Deliverables
1.​ A report documenting:
a.​ Distributed training techniques used.
b.​ Training performance (time per epoch) and evaluation results.
c.​ Step by step guide on how to run the training code.

2.​ Code access on HPC

Evaluation
Compute the perplexity metric on the remaining 10% of the dataset. The assignment will be
evaluated primarily on the basis of how time efficient the fine-tuning code is, and the final
perplexity score will not hold as much weight.
Data Parallelism
Data parallelism involves replicating the model on both GPUs and splitting the training data
across them. We have covered this paradigm in class in the paper Pytorch Distributed
([Link]

Example code:

Tensor Parallelism
Splits weight matrices of large layers (like Transformer blocks) across multiple GPUs. Each
GPU holds only part of the model's layers. We covered this in the Tofu paper
([Link]

Example code:

Pipeline Parallelism
Pipeline parallelism assigns different layers of the model to different GPUs and processes
micro-batches sequentially. We have covered two systems of this type in GPipe
([Link] and PipeDream ([Link]
Example Code:

Evaluation
Measure time per epoch as the primary metric. Other parts are the same as in Programming
Assignment 1.

Common questions

Powered by AI

Focusing evaluation on time per epoch directly benefits the assessment of training performance by emphasizing computational efficiency. It incentivizes optimized code development that utilizes the GPU resources effectively, addressing the real-world requirement of reducing computational costs and timescales for training large models. It ensures that the developed training techniques genuinely enhance performance .

Tensor parallelism differs from data parallelism by focusing on splitting the model's parameters themselves across multiple GPUs, rather than duplicating the model on each GPU. In tensor parallelism, large layers such as those in Transformer blocks are partitioned, so each GPU holds only a part of these layers. This contrasts with data parallelism, where each GPU maintains a full copy of the model but processes different data .

The primary goal of the assignment is to implement distributed training techniques, specifically data parallelism, tensor parallelism, and pipeline parallelism, to achieve high training efficiency. This efficiency is measured in terms of the time taken per epoch of training. The effectiveness of these techniques is assessed by how well the training code is optimized for time efficiency. The perplexity metric is also computed but holds lesser weight in evaluation .

The components required for documentation in the assignment include a report detailing the distributed training techniques employed, an analysis of training performance focusing on time per epoch, and evaluation results. Additionally, the report should include a step-by-step guide on executing the training code, making the process replicable and understandable .

Practical challenges in implementing these parallelisms include managing communication overheads between GPUs, which can negate parallelism benefits. In data parallelism, ensuring balanced data distribution and model synchronization is crucial. Tensor parallelism requires careful architectural adjustments to split layers correctly. Pipeline parallelism involves handling non-trivial data flow management to avoid GPU idling. All techniques demand meticulous coordination of resources to prevent bottlenecks .

The distributed training assignment incorporates systems like GPipe and PipeDream as paradigms of pipeline parallelism. These systems provide frameworks for splitting model layers across multiple GPUs and managing data flow through micro-batches. By using principles from these systems, the assignment leverages tried-and-tested methodologies to improve training efficiency and effectiveness, ensuring that the implementation is both robust and well-optimized .

Pipeline parallelism takes advantage of both model and data parallelism by assigning different layers of the model to different GPUs and processing micro-batches in a sequential manner. This allows each GPU to work on its assigned layers without requiring full model replication or full memory load as in data parallelism. It maximizes computational and memory efficiency by staggering computations across GPUs, reducing idle times and potentially improving throughput .

Perplexity serves as a metric for evaluating the quality of language model predictions in the distributed training exercise. Although it is not the primary focus, measuring perplexity provides insights into how well the model understands and predicts sequential data. A lower perplexity score indicates better language understanding and model accuracy, serving as a validation measure for the enhancements achieved through distributed training techniques .

Data parallelism in the distributed training of the LLaMA model involves replicating the entire model on each GPU. The dataset is then divided among the available GPUs so that each GPU processes a different subset of the training data simultaneously. This method allows for parallel computation, making the training process more efficient by leveraging the processing power of multiple GPUs concurrently .

Prioritizing time efficiency over perplexity reflects a focus on the practical aspects of model training processing power and time cost. Efficient model training not only reduces computational expenses but also facilitates scalable implementations needed for handling larger datasets and more complex models in real-world applications. This priority aligns with industry demands for speed and cost-effectiveness without significantly compromising the prediction quality measured by perplexity .

You might also like