Skip to main content

Local LLMs are getting easier

There is increasing interest in using smaller large language models (LLMs), hosted locally instead accessed from cloud-based vendors such as OpenAI. My clients have been interested in these either from a cost point of view, or for data protection reasons (since no data goes to OpenAI or other vendors).

Although this has been done for a while from Python using (mainly) the excellent Hugging Face, new options have come available that makes this easier and more flexible, especially from other languages such as Go and Rust. Here are observations and tips on a few alternatives that I’ve been trying.

Advent of Code as a Lab for Fast Computing

This year’s Advent of Code is well past the half-way mark, and I’ve been reflecting on some of the harder or more interesting problems over the last few years, and the lessons learned about making code faster, or large problems tractable.

In case you haven’t encountered it, AoC is an annual coding competition, with a new problem every day, from December 1 through 25. Each day, there are two parts, and the second (usually harder) part unlocks after you solve the first part. You can use any programming language, and only need to submit the right answer (usually a number) to solve each part.

Linear Programming in Go

I’ve been away helping Bain set up a new capability in generative AI, on the back of our OpenAI partnership, and am coming back to standard data science problems. In this post, I’d like to share some experiments doing linear programming optimization, using Gonum’s optimization library. It’s a very basic facility, but has helped me learn how to set up problems using the venerable Simplex algorithm, first developed by George Danzig in 1947.

Starting a New Go Project

If you are new to Go, here is the basic process for setting up a new project and building/running it. This assumes that you have already installed Go as described in the previous blog post.

First, create a working directory for the project, and change into it:

mkdir ~/myproject
cd ~/myproject

Then, use your favorite text editor or IDE to create a Go program, with any name that ends in .go, for example main.go:

A Basic Go Setup

In this article, I wanted to share the setup I use for writing data science programs in Go. I’ve found it very easy to get started with this language, but thought it might be useful to describe the setup.

I use both Linux and a Mac, so this article will describe those platforms, but Go should work well on Windows as well. In any case, we assume that you are comfortable running the command line.