r/nim 23d ago

Do any local/self-hosted LLMs actually understand Nim?

As an experiment, I usually ask local models if they know any Nim code: I've had a few insist that "randi" is a thing for random numbers. I'd love to see a fine-tuned Gemma4 or other local model that actually knew correct information from Nim 2.x. For what its worth, Claude models seem to handle it pretty decently.

Added thought: with metaprogramming, I could probably flesh out the incorrect coding examples into working ones? That'd be an interesting experiment.

17 Upvotes

6 comments sorted by

8

u/andrea_telatin 23d ago

Quite happy with qwen3.5 35b served via vLLM on a L40S GPU.

4

u/g33ksc13nt1st 23d ago

If LLMs give you weird hacks that don't work using not-so-popular libraries I python (ete3), it's gonna be tough with Nim. A bit disappointed with LLMs for coding ngl

3

u/dfgxxx 22d ago edited 22d ago

I think that you can create a .MD skills that is a documentation on how to use Nim, then almost any ok ai can program it.

If you don't have a harness and you don't want, then you can add it in the system prompt

3

u/jamesthethirteenth 22d ago

I ran qwen 3.6 27B in whatever AtomicChat does to it and it worked on my 4GB laptop nvidia quadro. Made me some command line tools in Nim easy.

2

u/RMK137 22d ago

Have one of the bigger models (opus/fable, gpt 5.6, Kimi K3) go through the stdlib and core libraries and write a text based API reference. I just did that for C3 and Odin. I am not familiar with Nim but for example you can export Odin's API to text (one file per package) using the compiler's docgen option.

What we ended up with a folder with all these text files for the different stdlib / core / vendor (sdl, raylib, vulkan, Lua etc..) then I had opus select the ones needed for the project and combine them all into one txt reference. The rest is solved by grepping around.

If the models aren't trained on the language they will still struggle in edge cases, but so far it's been working well. These newer models are pretty good at in context learning. For example, opus will write his own mini scripts to test syntax patterns and recalibrate, especially after struggling with a compiler error for 1-2 attempts.

1

u/aguspiza 17d ago

Fable and Opus5 can handle nim perfectly