Customizing Giant Language Fashions | by Thomas Reid | Mar, 2024


Customise, run and save LLMs utilizing OLLAMA and the Modelfile

On this article, I’ll present you easy methods to use the Modelfile in Ollama to alter how an current LLM (Llama2) behaves when interacting with it. I’ll additionally present you easy methods to save your newly personalized mannequin to your private namespace on the Ollama server.

I do know it might probably get a bit complicated with all of the completely different ”llamas” flying round. Simply bear in mind, Ollama is the corporate that lets you obtain and regionally run many various LLMs. Whereas, Llama2 is a selected LLM created by Meta the proprietor of Fb. Other than this relationship, they aren’t related in some other method.

For those who’ve by no means heard of Ollama earlier than I like to recommend that you simply try my article beneath the place I’m going into depth on what Ollama is and easy methods to set up it in your system.

What’s a modelfile?

In Ollama, a modelfile refers to a configuration file that defines the blueprint to create and share fashions with Ollama.

The modelfile incorporates data similar to,

  1. Base Mannequin Reference. All modefiles should have a mannequin that they use as the idea for any new mannequin
  2. Parameters. These specify issues such because the temperature, top_k and top_p that must be utilized to the brand new mannequin. We’ll speak extra about these in a while.
  3. Template. This specifies what the ultimate immediate will likely be that’s handed to the LLM.
  4. System. We will use this command to find out how the system behaves total.

There are different properties the modelfile could make use of however we’ll solely be utilizing those above. There’s a hyperlink to the Ollama documentation on the finish of the article if you wish to discover out extra about this.

The bottom mannequin

The very first thing we have to do is establish an current mannequin so we will look at its properties and make the modifications we need to it. For that, I’m going…

Leave a Reply

Your email address will not be published. Required fields are marked *