Today most people use AI from the cloud. Over time, I expect that to shift for at least some use cases to use on-prem setups. When I saw that GitHub Copilot documented how to use local models, I thought I would try it using Microsoft’s new MAI Code 1.1 Flash model, since I have a workstation that meets the documented requirements:

A false start

I walked through the entire process documented in the GitHub Copilot documentation, getting to the last step to actually download the model, and it didn’t work. Why? Well, the needed support is not present in the Windows Server 2025 OS. (I’m sure that was in the docs somewhere and I just skimmed over it.) Given that I only have this one machine (Lenovo ThinkStation P620) that has the needed hardware and it also runs all of my Hyper-V lab VMs, I had no desire to rebuild it to run on Windows 11.

Solving that problem then required a “plan B.” The best way to pull it off without reinstalling the host OS was to pass the NVIDIA GeForce RTX 5060 Ti through to the VM using DDA. Effectively, this yanks the device from the host and gives it to the VM. Well great, but I’m currently using that card for the video output on the server (even though I use primarily from RDP), and I didn’t want to get to a state where I couldn’t access the host if networking was broken and the video card was only available from the VM and wasn’t going to be used for video output.

Solving that problem required a “plan B1” — I needed another video adapter I could use instead. I had one remaining PCIe slot in the server and the previous NVIDIA Quadro P620 available to put into it. Making that card the primary video adapter gives me the needed fallback.

Then back to “plan B”: Yank the adapter from the host, give it to the VM. You can see the steps for that in this screenshot of the PowerShell commands on the host. I issues all but the last command with the VM turned off, then booted the VM and installed the NVIDIA GeForce RTX driver in the VM and rebooted. The driver failed with an error: “This device cannot find enough free resources that it can use. (Code 12).” Fixing that required shutting the VM down again, issuing the last command, and then booting the VM back up again.

Presto, a working GPU inside the VM. Three hours after I initially started, I was back to step #1. So let’s continue with the “real work.”

Install GitHub Copilot

Obviously to use a local GPU with GitHub Copilot, you first need to install GitHub Copilot. That’s easy enough to do with Winget:

(I had never used the GitHub Copilot app before. I had previously had a free GitHub Copilot Pro subscription that I used from VS Code and Visual Studio. But when that expired and I tried to sign up for a paid version, I couldn’t — Microsoft wasn’t accepting any new customers due to “capacity issues.” That’s when I switched to Claude.)

Install llama.cpp

The GitHub Copilot app works with cloud LLMs by default. While it can use local models too, it doesn’t have the needed pieces itself to run them, so it needs llama.cpp to do that. There are instructions that describe how to set it up:

https://docs.github.com/en/copilot/how-tos/github-copilot-app/add-llm-models#installing-llamacpp-for-windows

I’m not a big fan of following directions, so I “tweaked” them. Why download and extract zip files from GitHub when you can just install an app using Winget? Even though llama.cpp 1.0 was just released, that hasn’t been published to Winget yet (doesn’t seem to be a priority), it’s still on version b12343. OK, that’s good enough per the GitHub Copilot docs, so I’ll just use that.

Where did it put it? Find out with PowerShell, splitting the path into something readable:

$env:PATH -Split ";"

That tells you it is in “C:\Users\nieha\AppData\Local\Microsoft\WinGet\Packages\ggml.llamacpp_Microsoft.Winget.Source_8wekyb3d8bbwe”. Perfectly obvious.

Then set the LLAMACPP_SERVER_PATH environment variable to point to the llama-server.exe file in that path. It feels wrong to do that using SETX.EXE from PowerShell, but PowerShell has no easier way to set a persistent environment variable:

And the PowerShell equivalent way of checking if it is working:

Will I later regret using the llama.cpp app from Winget? Quite possibly, as new version installs will probably still not contain the CUDA DLLs, so I’ll have to manually repeat that step every time I install an update (unless the llama.cpp people, who I believe are part of Hugging Face, which is now part of NVIDIA, decide to finally ship a “complete” app).

Add CUDA “stuff”

From the output above, you can see that llama.cpp saw a “Vulkan” GPU. But the goal is to use NVIDIA’s CUDA API and the app available through Winget doesn’t install the needed DLLs for that. So back to Github to find the matching files from https://github.com/ggml-org/llama.cpp/releases.

Microsoft’s docs (which they really should work on, they aren’t great) say to download the arm64 files, likely because they are assuming someone will want to do this with the RTX Spark devices like the Surface Laptop Ultra. Sorry, I want to do this on x64. I found the matching version and downloaded the zip files:

If you don’t know the version just check:

& "$env:LLAMACPP_SERVER_PATH" --version

Extract both of those zip files directly into the long path for llama.cpp (don’t create subfolders). I used Explorer to do that and told it not to replace files (since they were already installed as part of the app).

Now if you run that –list-devices command again, you’ll see another entry:

OK, CUDA support successfully added to llama.cpp.

Configure the local model

Now we need to tell GitHub Copilot to use the local model. Into the settings where we can see the model providers. The default is the cloud (GitHub Copilot), so you have to click the “Add provider” button.

Then you can choose Windows ML.

My VM has 128GB of RAM. GitHub Copilot looked and saw that there was 102GB available. It limited the RAM usage to 80% of that to make sure the OS isn’t overcomitted.

Next you can click the Azure (“A”) icon to show the available models. I downloaded both of them (takes a chunk of disk space).

After the download, we can see the available models, and we can start one or more of them. I started the MAI Code 1.1 Flash model.

That started the llama-server.exe process that hosts the model.

Finally, success, it’s all working.

A verdict?

I had previously given a coding task to Claude running a cloud model, asking it to refactor about 1000 lines of code into something more modular. It took Claude about 20 minutes to complete the task (described in a short paragraph), and it did a pretty good job. So I thought that would be a good test. I gave GitHub Copilot the same code and the same paragraph of instructions and sent it on its way.

The load on the server was as you would expect: using a lot of memory for the model, and keeping the GPU pretty busy. The CPU isn’t very busy at all.

It eventually finished the task, and what it ended up producing was distinctly different from what Claude created but it was a solid piece of work.

But remember how long it took Claude: 20 minutes. So how long did it take GitHub Copilot with the local model? About 15 hours.

So yes, it was an interesting experiment to go through, and yes, it works. But you’ve got to have some serious (and seriously expensive) hardware to make it work well. Anyone got an RTX Spark with 128GB of RAM they are willing to donate?


Discover more from Out of Office Hours

Subscribe to get the latest posts sent to your email.

2 responses to “Using GitHub Copilot with a (free) local LLM”

  1. There is a point in the text where you say amd64 that I think you meant to say ARM64 since you say it won’t work on x64. Otherwise great article and thanks for sharing the process to get it work even with bad docs.

    Like

    1. Fixed. There’s always at least one typo 🙂

      Like

Leave a Reply

Trending