Fine Tuning LLM for Enterprise: Practical Guidelines and Recommendations

Mathav Raj J,Kushala VM,Harikrishna Warrier,Yogesh Gupta
2024-03-23
Abstract:There is a compelling necessity from enterprises for fine tuning LLMs (Large Language Models) o get them trained on proprietary domain knowledge. The challenge is to imbibe the LLMs with domain specific knowledge using the most optimial resource and cost and in the best possible time. Many enterprises rely on RAG (Retrieval Augmented Generation) which does not need LLMs to be ine-tuned but they are limited by the quality of vector databases and their retrieval capabilities rather than the intrinsic capabilities of the LLMs themselves. In our current work we focus on fine tuning LLaMA, an open source LLM using proprietary documents and code from an enterprise repository and use the fine tuned models to evaluate the quality of responses. As part of this work, we aim to guide beginners on how to start with fine tuning an LLM for documentation and code by making educated guesses on size of GPU required and options that are available for formatting the data. We also propose pre processing recipes for both documentation and code to prepare dataset in different formats. The proposed methods of data preparation for document datasets are forming paragraph chunks, forming question and answer pairs and forming keyword and paragraph chunk pairs. For code dataset we propose forming summary and function pairs. Further, we qualitatively evaluate the results of the models for domain specific queries. Finally, we also propose practical guidelines and recommendations for fine tuning LLMs.
Software Engineering,Machine Learning
What problem does this paper attempt to address?
The problem that this paper attempts to solve is how to fine - tune large language models (LLMs) efficiently so that they can adapt to enterprise - specific knowledge domains. Specifically, the paper focuses on how to use optimized resources and costs to enable LLMs to possess domain - specific knowledge within the shortest possible time. Many enterprises rely on retrieval - augmented generation (RAG) technology. This method does not require fine - tuning of LLMs, but its effectiveness is limited by the quality of the vector database and retrieval capabilities, rather than the capabilities of the LLMs themselves. To overcome these challenges, the author focuses on fine - tuning open - source LLMs (such as LLaMA) using proprietary documents and code from enterprise knowledge bases and evaluating the response quality of the fine - tuned models. The main goal of the paper is to guide beginners on how to start fine - tuning LLMs, including estimating the required GPU size, choosing appropriate data formats, and proposing data pre - processing methods. In addition, the paper also explores different data preparation methods, such as forming paragraph blocks, forming question - answer pairs, and forming keyword - paragraph block pairs, as well as the summary - function pair method proposed for code datasets. Through these methods, the paper aims to provide practical guidelines and suggestions to help enterprises use LLMs more effectively for fine - tuning specific tasks, thereby improving the performance and accuracy of the model when handling domain - specific queries.