this post was submitted on 28 Nov 2023
1 points (100.0% liked)

LocalLLaMA

3 readers
1 users here now

Community to discuss about Llama, the family of large language models created by Meta AI.

founded 1 year ago
MODERATORS
 

I know the typical answer is "no because all the libs are in python".. but I am kind of baffled why more porting isn't going on especially to Go given how Go like Python is stupid easy to learn and yet much faster to run. Truly not trying to start a flame war or anything. I am just a bigger fan of Go than Python and was thinking coming in to 2024 especially with all the huge money in AI now, we'd see a LOT more movement in the much faster runtime of Go while largely as easy if not easier to write/maintain code with. Not sure about Rust.. it may run a little faster than Go, but the language is much more difficult to learn/use but it has been growing in popularity so was curious if that is a potential option.

There are some Go libs I've found but the few I have seem to be 3, 4 or more years old. I was hoping there would be things like PyTorch and the likes converted to Go.

I was even curious with the power of the GPT4 or DeepSeek Coder or similar, how hard would it be to run conversions between python libraries to go and/or is anyone working on that or is it pretty impossible to do so?

(page 2) 22 comments
sorted by: hot top controversial new old
[–] logicchains@alien.top 1 points 11 months ago

Musk's new in-progress LLM is apparently being built with Rust and JAX.

[–] sandys1@alien.top 1 points 11 months ago

We are using rust (webassembly) in Edgechains. Looking for contributors to help build the AI webassembly runtime!

[–] fireteller@alien.top 1 points 11 months ago (1 children)

I do a great deal of work with AI using Go.

TL;dr: I strongly recommend using Go with the llama.cpp bindings (https://github.com/ggerganov/llama.cpp).

Go is particularly well-suited for LLMs, but in a different way than most people discuss here. Firstly, Go is a better language for LLMs to learn and write. This becomes evident when comparing Go with other languages across a variety of coding tasks using ChatGPT. The code generated for Go is often much better: more code can be correctly generated per prompt, and more complicated logic is often handled well in Go, while it's difficult to generate in other languages. This is because Go has less variability; there are fewer alternative ways to do something. Go is very uniformly structured across codebases due to enforced formatting, shares most symbols with C and C++, and has a very complete standard library, making it unambiguous which libraries to include. Training and generating Go code with LLMs is far more performant than any other language I've tried, especially if you use a local model with a Go LoRA, or train your own model on Go.

Go is also well-suited for efficiently handling blocking data tasks such as loading large models from disk to RAM or GPU, or from remote RAM to local RAM, thereby achieving the best available I/O performance (often the bottleneck).

Additionally, Go is the language of choice for web service client and server implementations, working well in contexts where you are using ChatGPT, GitHub, HuggingFace, and other API-based AI and supporting services.

Finally, Go is compilable and cross-compilable to a single executable, making the distribution and remote deployment of applications much less error-prone.

I strongly recommend Go for AI work due to its interaction with all these aspects of the AI ecosystem.

[–] Dry-Vermicelli-682@alien.top 1 points 11 months ago

WOW.. fantastic. This is the first (only?) response I've seen of the dozens here that says any of this. As a long time back end dev, switching to Go for that was amazing. I was FAR faster and more productive than in Java, Python or NodeJS. Especially once I built my own set of frameworks that I quickly copy/paste (or import). I love how fast/easy it is to stand up a docker wrapper as well. Very tiny images with very fast runtimes.

My point in this post was partially stemmed from the need to install so much runtime to use python and the various aspects with speed/memory/etc running python apps. If it is just basic glue code like some have said, then it's not a big deal. But that I know Go and love the language makes me want to use it over anything else if I can.

[–] enspiralart@alien.top 1 points 11 months ago

All AI stuff is done in C/CPP, everything else is just a wrapper.

[–] s_busso@alien.top 1 points 11 months ago

I use Golang for the backend of an Agent-based platform mixed with Python. I use it mainly for the RAG part, but I'm considering expanding to other functions, and I did some small projects fully in Golang and OpenAI API.

Also, there is a langchain port to Golang: https://github.com/tmc/langchaingo, which shows how much can be done with Golang in the LLM world.

[–] cztomsik@alien.top 1 points 11 months ago (1 children)

I am using Zig for my project (https://www.avapls.com/). Currently, I only do inference, but so far it was awesome and I would definitely do it again.

Zig plays nicely with anything with C interface. ATM I am using GGML but I think if I really needed, I could use torch too.

I also did node.js extension for quick prototypes and so far it worked great. I intend to get back to it one day but it's currently on hold because I don't have time.

https://github.com/cztomsik/ggml-js

BTW: some people also use elixir for ML https://github.com/livebook-dev/livebook

[–] Dry-Vermicelli-682@alien.top 1 points 11 months ago

I am really looking forward to Zig maturing. I find the memory model stuff a bit odd, but the overall language looks easy enough for most things, and so far everything I read.. and this being a 0.11 release, is that it's as fast if not faster than C code in most cases. I don't know how well it would compare to higher level languages like Go, Java, etc for back end web stuff.. but I'd imagine with some time and a few good frameworks similar to Go's Chi, JWTAuth and Casbin libraries, it would be very good.

load more comments
view more: ‹ prev next ›