Latest massive language fashions (LLMs) are extremely succesful in most language era duties. Nonetheless, since they function based mostly on next-token prediction, they typically wrestle with precisely performing mathematical operations. Moreover, resulting from their data cut-off, they might lack the data wanted to reply some queries precisely.
One method to alleviate these points is thru operate calling. Operate calling permits LLMs to reliably hook up with exterior instruments. It allows interplay with exterior APIs. For instance, retrieving info from the Web and performing mathematical operations might be completed via operate calling by interfacing the LLM with an internet search engine and a calculator.
On this article, we are going to see find out how to fine-tune LLMs for operate calling. I exploit xLAM, a dataset of 60k entries of operate calling launched by Salesforce for fine-tuning Llama 3. We are going to see find out how to format the dataset and the way we are able to exploit the fine-tuned adapters for operate calling.
I additionally made this pocket book implementing the code described on this article for fine-tuning, and a few examples of inference: