Native Go ML Projects Collection
A comprehensive collection of machine learning and deep learning implementations written in pure Go with no external dependencies.
| Project | Description | Status |
|---|---|---|
| Transformer | Complete Transformer architecture (Vaswani et al., 2017) | β Complete |
| Vector Database | HNSW-based vector similarity search | β Complete |
| ASR Library | Automatic Speech Recognition with MFCC & LSTM | β Complete |
| RAG Evaluation | Comprehensive RAG/LLM evaluation toolkit | β Complete |
| Training Dashboard | Real-time ML training metrics visualization | β Complete |
| Model Registry | Model versioning and management system | β Complete |
| Agents Framework | AI agent framework with native transformers | β Complete |
| Fine-tuning | Neural network fine-tuning with LoRA support | β Complete |
| GPT/BERT | Native Go GPT and BERT transformer models | β Complete |
| MCP Marketplace | MCP apps marketplace with REST API and web UI | β Complete |
| LRS-Agents-NBX | Learning Rate Scheduler agents with NBX integration | β Complete |
/workspace/
βββ tensor/ # Core tensor operations library
β βββ tensor.go # Tensor data structure
β βββ ops.go # Mathematical operations
βββ transformer/ # Transformer architecture implementation
β βββ layer.go # Multi-head attention, FFN, positional encoding
β βββ model.go # Encoder/Decoder, embeddings, full model
β βββ backward.go # Backpropagation through layers
β βββ train.go # Training utilities
βββ vector_db/ # Native vector database
β βββ main.go # VectorDB with CRUD operations
β βββ hnsw.go # HNSW index for ANN search
β βββ types.go # Type definitions
β βββ README.md # Documentation
βββ asr/ # Automatic Speech Recognition
β βββ audio.go # Audio loading & preprocessing
β βββ features.go # MFCC feature extraction
β βββ model.go # LSTM acoustic model
β βββ pipeline.go # End-to-end ASR pipeline
β βββ README.md # Documentation
β βββ cmd/main.go # Demo application
βββ rag_eval/ # RAG/LLM Evaluation Toolkit
β βββ main.go # Evaluation metrics & pipeline
β βββ rag_evaluation.json # JSON export
β βββ README.md # Documentation
βββ dashboard/ # Training Dashboard
β βββ main.go # HTTP server & UI
β βββ README.md # Documentation
βββ model_registry/ # Model Registry
β βββ main.go # HTTP server
β βββ registry.go # Core registry logic
β βββ server.go # API endpoints
β βββ index.html # Web UI
β βββ README.md # Documentation
βββ agents/ # Agents Framework
β βββ framework/ # Core framework
β β βββ core/ # Core types
β β βββ agents/ # Agent implementations
β β βββ testing/ # Testing utilities
β β βββ main.go # Demo
β βββ README.md # Documentation
βββ finetune/ # Fine-tuning Architecture
β βββ config/ # Configuration
β βββ data/ # Dataset and DataLoader
β βββ models/ # Neural network layers
β βββ losses/ # Loss functions
β βββ optimizers/ # AdamW, SGD, Lion, etc.
β βββ training/ # Training loop
β βββ main.go # Demo
β βββ README.md # Documentation
βββ transformers/ # GPT/BERT Transformers
β βββ core/ # Tensor operations
β βββ gpt/ # GPT model
β βββ bert/ # BERT model
β βββ tokenizer/ # Tokenizers
β βββ training/ # Training utilities
β βββ main.go # Demo
β βββ README.md # Documentation
βββ marketplace/ # MCP Apps Marketplace
β βββ api/ # REST API server
β βββ apps/ # App registry and models
β βββ mcp/ # MCP protocol implementation
β βββ web/ # Web UI
β βββ main.go # Entry point
β βββ README.md # Documentation
βββ main.go # Transformer demo
βββ go.mod # Go module definition
βββ README.md # This file
Directory: dashboard/
Real-time ML training metrics visualization with SVG charts.
- β Real-time metrics (loss, accuracy, learning rate)
- β SVG-based charts (server-side rendered)
- β Dark-themed web interface
- β Auto-refresh every 2 seconds
cd dashboard && go run main.go
# Open http://localhost:8080Directory: model_registry/
Native Go model registry and versioning system for ML models.
- β Model versioning with stages (REGISTERED β STAGING β PRODUCTION β ARCHIVED)
- β Metrics and parameters tracking
- β Artifact storage
- β REST API
- β Web UI
cd model_registry && go run main.go
# Open http://localhost:8081Directory: agents/framework/
Comprehensive framework for building and testing AI agents with native Go transformers.
- β Multiple agent types (ReAct, Plan-Execute, etc.)
- β Standard LLM Interface: OpenAI, Anthropic, Ollama, LocalAI
- β Native Go Transformers: Built-in GPT-2 and BERT support
- β Tool system with easy integration
- β Memory management (Conversation, Vector, Sliding Window)
- β Built-in testing framework
- β Mock LLM for testing
- β Multimodal: Image, Audio, Video, Document processing
- β Git Integration: Clone, commit, push, pull, status, log
- β GitHub Integration: Issues, PRs, repos, releases, search
- β HuggingFace Integration: Model search, datasets, inference
// Use native Go GPT-2/BERT in agents
nativeLLM, _ := llm.NewNativeLLMProvider("gpt2")
agent := agents.NewReActAgent(config, nativeLLM)
result := agent.Run(ctx, "Explain transformers")cd agents/framework && go run main.goDirectory: tensor/ & transformer/
Complete implementation of "Attention Is All You Need" (Vaswani et al., 2017).
- β Multi-head scaled dot-product attention
- β Positional encoding (sinusoidal)
- β Feed-forward networks with ReLU
- β Encoder and decoder layers
- β Full backpropagation through all layers
- β Cross-entropy loss with gradient computation
- β Learning rate scheduler with warmup
- β Attention visualization
- Small model (2 layers, 256 dim): ~2.5s per epoch
- Full backpropagation: ~8-9s per epoch
Directory: vector_db/
Native vector database with HNSW (Hierarchical Navigable Small World) index.
- β HNSW graph index for efficient ANN search
- β Multiple similarity metrics (Cosine, Euclidean, Dot Product)
- β CRUD operations: Insert, Update, Delete, Get
- β Metadata support and filtering
- β Thread-safe operations
- 10,000 vectors (128 dim): Insert in ~290ms
- Search (10 results): ~20Β΅s
- 82x faster than brute force
Directory: asr/
Complete speech recognition pipeline with MFCC features and LSTM acoustic model.
- β Audio loading (WAV format)
- β MFCC feature extraction
- β LSTM acoustic model
- β CTC decoding
- β End-to-end pipeline
- 5 seconds of audio: ~66ms processing
- 75x realtime speed
Directory: rag_eval/
Comprehensive evaluation toolkit for Retrieval-Augmented Generation systems.
- β Retrieval Metrics: Recall, Precision, F1, MRR, MAP, NDCG
- β Generation Metrics: BLEU-1/2/3, ROUGE-1/2/L, Jaccard
- β RAG Quality: Context Relevancy, Answer Relevancy, Faithfulness
- β Batch Evaluation: Multiple test cases
- β JSON Export: For analysis and dashboards
=== Average Retrieval Metrics ===
Recall@5: 0.7374 | Precision@5: 0.9333 | F1 Score: 0.7983
=== Average Generation Metrics ===
BLEU-1: 0.5500 | ROUGE-1: 0.7333 | ROUGE-L: 0.5722
=== RAG Quality ===
Context Relevancy: 0.2142 | Answer Relevancy: 0.6297 | Faithfulness: 0.2618
Overall Score: 0.6593
Directory: finetune/
Pure Go machine learning fine-tuning library with LoRA support.
- β Neural Network Layers: Linear, Embedding, LayerNorm, Attention, Transformer
- β LoRA Support: Low-rank adaptation for efficient fine-tuning
- β Optimizers: AdamW, Adam, SGD, Lion, RMSprop
- β Learning Rate Schedulers: Linear, Cosine, Constant with warmup
- β Training Loop: Full training pipeline with evaluation and metrics
cd finetune && GOWORK=off go run main.gocfg := config.DefaultConfig()
cfg.Lora.Enabled = true
cfg.Lora.Rank = 8
model := models.NewModelWrapper(*cfg)
trainer := training.NewTrainer(model, cfg, trainLoader, devLoader)
trainer.Train()Directory: transformers/
Native Go implementation of GPT and BERT transformer architectures.
- β GPT Model: GPT-2 architecture (105M+ parameters)
- β BERT Model: BERT-Base and BERT-Large
- β Core Operations: Tensor math, attention, layer norm
- β Tokenizers: BasicTokenizer, BPETokenizer, WordPiece
- β Training: AdamW, Adam, SGD optimizers, LR schedulers
cd transformers && GOWORK=off go run main.go// Create GPT model
gptConfig := gpt.GPT2Config()
gptModel := gpt.NewGPTModel(gptConfig)
// Create BERT model
bertConfig := bert.DefaultBERTConfig()
bertModel := bert.NewBERTModel(bertConfig)
// Tokenize text
tok := tokenizer.NewBasicTokenizer(1000)
ids := tok.Encode("Hello world")Directory: marketplace/
MCP (Model Context Protocol) apps marketplace with REST API and web UI.
- β MCP protocol implementation
- β App registry with categories, ratings, reviews
- β REST API for app management
- β Web UI for browsing and searching apps
- β Built-in MCP tools (search, get details, featured apps)
- β Sample apps (Code Assistant, Data Analyst, etc.)
cd marketplace && go run main.go
# API: http://localhost:8080/api/
# Web UI: http://localhost:8080/web/index.html| Method | Endpoint | Description |
|---|---|---|
| GET | /api/apps |
List all apps |
| GET | /api/apps/featured |
Get featured apps |
| GET | /api/apps/trending |
Get trending apps |
| GET | /api/apps/search?q= |
Search apps |
| GET | /api/apps/categories |
List categories |
| GET | /api/apps/{id} |
Get app details |
| POST | /api/apps |
Register new app |
| GET | /api/stats |
Marketplace statistics |
# 1. Transformer Demo
cd /home/runner/workspace && GOWORK=off go run main.go
# 2. Vector Database
cd /home/runner/workspace/vector_db && GOWORK=off go run .
# 3. ASR Demo
cd /home/runner/workspace && GOWORK=off go run asr/cmd/main.go
# 4. RAG Evaluation
cd /home/runner/workspace/rag_eval && GOWORK=off go run main.go
# 5. Training Dashboard
cd /home/runner/workspace/dashboard && GOWORK=off go run main.go
# 6. Model Registry
cd /home/runner/workspace/model_registry && GOWORK=off go run main.go
# 7. Fine-tuning
cd /home/runner/workspace/finetune && GOWORK=off go run main.go
# 8. GPT/BERT Transformers
cd /home/runner/workspace/transformers && GOWORK=off go run main.go
# 9. MCP Marketplace
cd /home/runner/workspace/marketplace && GOWORK=off go run main.go| Project | Throughput | Latency | Use Case |
|---|---|---|---|
| Transformer | ~2.5s/epoch | ~8s w/ backprop | NLP, sequence modeling |
| Vector DB | 10k vectors/s | ~20Β΅s search | Similarity search, RAG |
| ASR | 75x realtime | ~66ms/5s audio | Speech recognition |
| RAG Eval | 10k evals/s | ~400Β΅s/eval | Quality assessment |
| Dashboard | Real-time | ~10ms/req | Training visualization |
- Transformer: "Attention Is All You Need" (Vaswani et al., 2017)
- HNSW: "Efficient and Robust Approximate Nearest Neighbor Search" (Malkov & Yashunin, 2018)
- CTC: "Connectionist Temporal Classification" (Graves et al., 2006)
- BLEU: "A Method for Automatic Evaluation of Machine Translation" (Papineni et al., 2002)
- β Transformer with full backpropagation
- β HNSW-based vector database
- β Complete ASR pipeline
- β RAG evaluation toolkit
- β Training Dashboard
- β Backward pass implementation
- β Quantization (INT8/INT4)
- β Model serialization
- β Semantic similarity metrics
- β Language model integration (ASR)
- β Beam search decoding
- β Streaming inference
- β Distributed training support
- β RAG evaluation dashboard
- β ASR beam search decoder
- β N-gram language model
- GPU acceleration (CUDA/OpenCL) - requires external bindings
- Full BPTT for ASR (backpropagation through time)
- Vector database integration with RAG
MIT License - Free to use, modify, and distribute.
