In this repository, I have developed the entire server-side principal architecture for real-time stock market prediction with Machine Learning. I have used Tensorflow.js for constructing ml model architecture, and Kafka for real-time data streaming and pipelining.
A source-grounded course and architectural reference for engineers designing systems that must survive real traffic, partial failure, security review, and changing requirements, spanning enterprise system design, distributed systems, AI systems, cybersecurity, reliability, cloud, HPC, edge, and mission-critical infrastructure.
A minimal PyTorch re-implementation of AlphaFold2's model & training
关键参数与规格
关键参数与规格
参数
值
语言
Go
类别
Tutorials
子类别
LLM fundamentals
关键词
Go
星标数
643
分叉数
43
贡献者
1
创建日期
2025-04-16
更新日期
2026-10-06
1 天星标数
0
7 天星标数
0
排名
15,623
上次排名
15,435
排名变化
-188
7 天星标排名
15,088
上次 7 天星标排名
15,091
7 天星标排名变化
3
总星标排名
15,915
上次总星标排名
15,889
总星标排名变化
-26
国家
Cyprus
README 摘录
gpt-go Simple GPT implementation in pure Go. What kind of response you can expect from the model: Or this: How to run It takes about 40 minutes to train on MacBook Air M3. The trained weights will be saved to file. If you rerun the model, it will pick up the saved weights and continue training. The loss should decrease each time, indicating that the model is learning something useful. You can train on your own dataset by pointing
the variable to your text corpus. To run in chat-only mode once the training is done: How to understand You can use this repository as a companion to the Neural Networks: Zero to Hero course. Use to see how the model has evolved over time: , , , , , . go you will find explanations starting from basic neuron example: All the way to self-attention mechanism: Design choices No batches. I've given up the complexity of the batch dimension for the sake of
better understanding. It's far easier to build intuition with 2D matrices, rather than with 3D tensors. Besides, batches aren't inherent to the transformer architecture. For better gradient smoothing gradient accumulation was tried. The effect was negligible, so it was removed as well. The gave us ~30% performance boost, but it brought additional dependency. We're not striving for maximum efficiency here, rather for radical simplicity. Current matmul implementation is quite effective, and it's only 40 lines of plain readable code. Papers
You don't need to read them to understand the code :) Attention Is All You Need Deep Residual Learning DeepMind WaveNet Batch Normalization Deep NN + huge data = breakthrough performance OpenAI GPT-3 paper Analyzing the Structure of Attention Credits Many thanks to Andrej Karpathy for his brilliant Neural Networks: Zero to Hero course. Thanks to @itsubaki for his elegant autograd package.
Simple GPT implementation in pure Go. Trained on favourite Jules Verne books.
What kind of response you can expect from the model:
Mysterious Island.
Well.
My days must follow
Or this:
Captain Nemo, in two hundred thousand feet weary in
the existence of the world.
How to run
$ go run .
It takes about 40 minutes to train on MacBook Air M3. The trained weights will be saved to model-1.234M file. If you rerun the model, it will pick up the saved weights and continue training. The loss should decrease each time, indicating that the model is learning something useful.
You can train on your own dataset by pointing the data.dataset variable to your text corpus.
To run in chat-only mode once the training is done:
$ go run . -chat
How to understand
You can use this repository as a companion to the Neural Networks: Zero to Hero course. Use git checkout to see how the model has evolved over time: naive, bigram, multihead, block, residual, full.
In main_test.go you will find explanations starting from basic neuron example:
// Our neuron has 2 inputs and 1 output (number of columns in weight matrix).
// Its goal is to predict next number in the sequence.
input := V{1, 2} // {x1, x2}
weight := M{
{2}, // how much x1 contributes to the output
{3}, // how much x2 contributes to the output
}
All the way to self-attention mechanism:
// To calculate the sum of all previous tokens, we can multiply by this triangular matrix:
tril := M{
{1, 0, 0, 0}, // first token attends only at itself ("cat"), it can't look into the future
{1, 1, 0, 0}, // second token attends at itself and the previous token ( "cat" + ", ")
{1, 1, 1, 0}, // third token attends at itself and the two previous tokens ("cat" + ", " + "dog")
{1, 1, 1, 1}, // fourth token attends at itself and all the previous tokens ("cat" + ", " + "dog" + " and")
}.Var()
// So, at this point each embedding is enriched with the information from all the previous tokens.
// That's the crux of self-attention.
enrichedEmbeds := MatMul(tril, inputEmbeds)
Design choices
No batches.
I've given up the complexity of the batch dimension for the sake of better understanding. It's far easier to build intuition with 2D matrices, rather than with 3D tensors. Besides, batches aren't inherent to the transformer architecture. For better gradient smoothing gradient accumulation was tried. The effect was negligible, so it was removed as well.
Removed gonum.
The gonum.matmul gave us ~30% performance boost, but it brought additional dependency. We're not striving for maximum efficiency here, rather for radical simplicity. Current matmul implementation is quite effective, and it's only 40 lines of plain readable code.
Papers
You don't need to read them to understand the code :)