Customize, run and save LLMs using OLLAMA and the Modelfile
In this text, I’ll show you methods to use the Modelfile in Ollama to alter how an existing LLM (Llama2) behaves when interacting with it. I’ll also show you methods to save your newly customized model to your personal namespace on the Ollama server.
I do know it could actually get a bit confusing with all the several ”llamas” flying around. Just remember, Ollama is the corporate that allows you to download and locally run many alternative LLMs. Whereas, Llama2 is a selected LLM created by Meta the owner of Facebook. Other than this relationship, they will not be connected in every other way.
For those who’ve never heard of Ollama before I like to recommend that you just try my article below where I am going into depth on what Ollama is and methods to install 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 models with Ollama.
The modelfile comprises information corresponding to,
- Base Model Reference. All modefiles will need to have a model that they use as the premise for any latest model
- Parameters. These specify things corresponding to the
temperature, top_k and top_pthat must be applied to the brand new model. We’ll talk more about these afterward. - Template. This specifies what the ultimate prompt might be that’s passed to the LLM.
- System. We are able to use this command to find out how the system behaves overall.
There are other properties the modelfile could make use of but we’ll only be using those above. There’s a link to the Ollama documentation at the tip of the article if you ought to discover more about this.
The bottom model
The very first thing we want to do is discover an existing model so we are able to examine its properties and make the changes we wish to it. For that, I’m going…