Go, Python, Rust, and production AI applications
ajmani.net
ajmani.net
That being said, there is a real shortage of Rust software for Rust only projects. I ended up writing a wrapper for Llama.cpp and open ai API [0] because I needed it and couldn't find anything out there. Eventually, I do intend to implement Hugging Face's Candle library [1] (A rust version of Torch). There is something appealing about doing everything in a single lang especially as the monopoly of CUDA inevitably gets chipped away.
[0] https://github.com/ShelbyJenkins/llm_client [1] https://github.com/huggingface/candle
Dang, I never thought of this.
Also as copilot generates code for me, if it compiles in rust I know it will usually work well. With python the iteration loop is so much less trustworthy
Some of this frustration was recently an "Unpopular Opinion" on the Go Time Podcast regarding Python being great for "data exploration" but not for "data engineering": https://changelog.com/gotime/304#t=3196
I've been yearning for better interactive tooling and ML-related libraries to bridge this gap and started using some even in just the last week:
* GoNB (Golang-support for Jupyter notebooks, also from a Googler) https://github.com/janpfeifer/gonb
* That uses Go-Plotly for graphs/UI: https://github.com/MetalBlueberry/go-plotly
* GoMLX (GoNB author is also on that project, many thanks Jan!) https://github.com/gomlx/gomlx
* Hidden at the end of OP is LangChainGo for LLMs, which I haven't used yet: https://github.com/tmc/langchaingo
Pick those up and let's make the Go community stronger together!
Written but someone who has built ML libraries from scratch in Go
Recently I have been getting the itch to go lower level and see if it would be feasible to write an LLM backend in pure Go, or a Stable Diffusion backend. Just for curiosity and learning.
But if this is a dead-end I would like to know from someone more experienced than I. Thanks for any advice you can offer in advance.
What is the realm of the interop problem there? That one wants to assemble data in Go and then feed it to another API? Or even at a lower level, getting data to a GPU/TPU requires C interop so it's more about the memory sharing?
Those libraries come from Google, so hopefully they can help battle these issues in the nether realms.
Python's parallelism story also holds it back, but that may be improving soon. It's unlikely it will be as nice as Go's though.
For me, Go feels too verbose, but I appreciate the static typing and performance. Python with its robust ecosystem and optional types feels okay, but the performance is really awful.
[1]: https://www.thestrangeloop.com/2022/python-performance-matte...
1. Making your models network accessible in a configured way 2. RAG and any chaining code for model calls
For #1, this is probably going to start with pytorch since that's typically what research code uses, and get hand optimized over time as your application matures.
For #2, it seems like the most popular tools so far are in the Python space, of course that doesn't mean other languages don't have robust ecosystems for AI already and of course new things get developed all the time, but ecosystem size is important to consider.