Spago is a self-contained machine learning and natural language processing library written entirely in Go. It provides automatic differentiation, neural network building blocks and ready-made transformer-era models โ including BERT-style encoders โ so Go services can train and serve NLP models without a Python runtime. It is an open-source project on GitHub with around 1,900 stars, maintained into 2025.
Go shops that need NLP usually shell out to Python microservices. Spago removes that split: it implements a computation-graph engine with reverse-mode autodiff, common layers and optimizers, and a model zoo covering tasks such as named entity recognition, question answering and text classification, plus BART and BERT architectures. Models can be trained in Go or loaded from converted weights, and everything compiles into a single static binary, which simplifies deployment for APIs and command-line tools that need embedded language intelligence.
Free. Spago is open source under the BSD-2-Clause license.
Under the hood, Spago is organized around a dense tensor package with broadcasting and GPU-free CPU execution, tokenizers for preparing text, and utilities to convert and load model weights produced by other ecosystems. Example applications in the repository show complete training and inference loops, and the project emphasizes readable, hackable code โ it is as much a learning resource for how frameworks work as it is a production library.
Go developers and platform teams who want NLP and small-model inference inside their Go services, and ML engineers curious about framework internals implemented from scratch.