“Understanding Large Language Model Fine-Tuning (for Non-Programmers)” on the Pure AI Web Site

I contributed technical content and opinions to an article titled “Understanding Large Language Model Fine-Tuning (for Non-Programmers)” on the Pure AI web site. See https://pureai.com/Articles/2024/06/03/fine-tuning-llms.aspx.

I created an end-to-end demo that fine-tunes a base BERT large language model so that it can categorize a Twitter message related to finance into one of 20 categories:

"LABEL_0": "Analyst Update",
"LABEL_1": "Fed | Central Banks",
"LABEL_2": "Company | Product News",
"LABEL_3": "Treasuries | Corporate Debt",
"LABEL_4": "Dividend",
"LABEL_5": "Earnings",
"LABEL_6": "Energy | Oil",
"LABEL_7": "Financials",
"LABEL_8": "Currencies",
"LABEL_9": "General News | Opinion",
"LABEL_10": "Gold | Metals | Materials",
"LABEL_11": "IPO",
"LABEL_12": "Legal | Regulation",
"LABEL_13": "M&A | Investments",
"LABEL_14": "Macro",
"LABEL_15": "Markets",
"LABEL_16": "Politics",
"LABEL_17": "Personnel Change",
"LABEL_18": "Stock Commentary",
"LABEL_19": "Stock Movement"

Fine-tuning a LLM from scratch, using PyTorch, is possible but very difficult. Fine-tuning a LLM using a no-code tool is possible but not very flexible. My demo program uses an intermediate level of abstraction by using the HuggingFace code library, which is a set of wrapper functions over PyTorch.

The article presents the complete demo program, but I focus on the main ideas, not the code syntax. You can find the demo program on my post at https://jamesmccaffreyblog.com/2024/06/03/example-of-fine-tuning-a-text-classification-language-model-using-the-huggingface-libraries/.

The article ends with some quotes:

Dr. McCaffrey offered an opinion, “I think the main decision facing most companies is whether to be an early adopter, at very high expense, or wait for no-code tools, at high risk of being rendered irrelevant by competitors who are early adopters.

“These are business questions, not technical questions. But it’s important for company decision makers to have a strong grasp of the technical issues involved before they make a decision that affects the future of their company.”



Most of AI research focuses the English languages. There are a lot of interesting spoken languages that I know nothing about. Left: The language of the Central Asian country Uzbekistan (pop. 37,000,000) is Uzbek. Center: The language of the country Kazakhstan (pop. 20,000,000) is Kazakh. Left: The language of the country Kyrgyzstan (pop. 7,000,000) is Kyrgyz.


This entry was posted in Miscellaneous. Bookmark the permalink.

Leave a Reply