ML/AI research engineer. Ex stats professor. Author of "Build a Large Language Model From Scratch" (https://t.co/O8LAAMRzzW) & reasoning (https://t.co/5TueQKx2Fk)
Activity on rasbt/llm-architecture-gallery
rasbt closed an issue in llm-architecture-gallery
View on GitHubActivity on rasbt/llm-architecture-gallery
rasbt contributed to rasbt/llm-architecture-gallery
View on GitHubActivity on rasbt/llm-architecture-gallery
rasbt commented on an issue in llm-architecture-gallery
View on GitHubActivity on repository
rasbt pushed reasoning-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt commented on an issue in LLMs-from-scratch
View on GitHubNow we know: The popular Ox Alpha LLM was GLM-5.3-Flash... Compared to GLM-5.2, this new GLM-5.3-Flash model uses: - a Kimi Linear-style 3:1 (super*) hybrid attention pattern with 34 Kimi Delta Attention layers (KDA) and 11 Multi-heat Latent Attention (MLA) / DeepSeek Sparse Attention (DSA) layers; - a scaled-down GLM-5.2-style sparse MoE backbone, going from 744B-A40B to 320B-A18B; - a DeepSeek V4-style mHC residual path with four parallel streams; - plus a native vision encoder (not shown). * "Super hybrid" because both KDA and MLA/DSA are "efficient" components. E.g., Kimi only uses KDA + full attention GQA, DeepSeek V3.2 uses DSA + full attention MLA. PS: Sry for the excessive tech jargon. Explainers on all these components (MLA, DSA, KDA, mhC, etc.) in my LLM Architecture Gallery PPS: Haha, maybe justification for getting that pricey Mac Studio M5 Ultra 256 GB / 512 GB to run this locally...
Introducing GLM-5.3-Flash - Leading capabilities at a highly competitive price - Natively multimodal with a 1M-token context window - A 320B-A18B model released under the MIT License - Previously previewed as Ox Alpha, running entirely on Chinese AI chips Blog:
Activity on repository
rasbt pushed reasoning-from-scratch
View on GitHubActivity on rasbt/reasoning-from-scratch
rasbt opened a pull request in reasoning-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed a pull request in LLMs-from-scratch
View on GitHubNice case study on using optimized functions whenever possible (except for educational purposes, though 😆)
By switching from a hand-rolled GELU to PyTorch's built-in one, I improved my LLM training speed -- and much more than I expected, from 21,000 tokens/second to 25,000! https://www.gilesthomas.com/2026/08/built-in-gelu
View quoted postActivity on repository
rasbt pushed llm-architecture-gallery
View on GitHubActivity on rasbt/llm-architecture-gallery
rasbt contributed to rasbt/llm-architecture-gallery
View on GitHubA short illustration of how the Claude's watermarking is supposed to work (based on my read of their released materials). In general, when we are generating tokens, there can be multiple high-scoring tokens at certain next-word positions. Usually, we sample with top-k or top-p sampling so the highest-scoring token is most often selected (if we repeat the sampling many times), but other tokens may be selected as well. With watermarking, there is a key that says which of the (ideally equally) highest-scoring tokens to select. Or, more concretely, the secret key and previous token influence the randomness here. Now, if we repeat this at many token positions, this creates the watermark as it will be a pattern that is statistically unlikely to get otherwise (due to combinatorics). One thing I am confused about: They basically say that they HAVE to do this for everyone due to EU regulation. Why? Sure, but this is an inference-time technique that doesn't require retraining or training a separate model, so, if they wanted, they could only do that for EU users? 🤔
We’ve written an FAQ to answer some of the questions we've received about watermarking. In summary: • We’re implementing watermarking to comply with the EU AI Act. Other major model developers have signed the same Code of Practice and will also be implementing watermarking;
View quoted postShort illustration of how Claude's text watermarking is supposed to work based on Anthropic's released materials.
RT ACM Education & Learning Center 8/19, join us for the #ACMTechTalk, "From Conventional LLMs to Reasoning Models to Agents," w/AI & LLM Research Engineer @rasbt. ACM Practitioner Board Co-Chaior @marlene_zw (@Microsoft) will moderate. Register (free) to attend live or on demand: https://bit.ly/3S5p0dp
Whoa, Meta released a new open-weight LLM yesterday, something that hasn't happened since the good old Llama days. Their Meta Muse Glimmer model is a 30B multimodal reasoning model with a Gemma-like architecture design. (“Glimmer” is probably a wordplay on “Spark,” the more likely capable model from which Glimmer was distilled. Muse Spark is only available through Meta’s Model API, though.) Architecture-wise, here are some of the main points: 1. "Only" a 131k context window, compared to Qwen3.6 and Gemma 4, which support 2x that natively; it's reasonable, but maybe on the shorter end in the age of agent harnesses 2. It's a dense model, not a mixture-of-experts. (So, it's fairer to compare it to Qwen3.6 27B than Qwen3.6 30B-A3B.) 3. Hybrid attention with grouped-query attention (GQA) and sliding window attention (SWA); the SWA:GQA pattern is a 3:1 local:global ratio. Other models like Gemma 4, which uses similar components, have a 5:1 ratio for comparison. 4. It adopts gated attention for both GQA and SWA; gated attention has become quite common in recent months. It basically applies a sigmoid gate to the attention output to decide how much of the attention information enters the residual connection. The interesting point is that it uses relatively standard GQA and SWA rather than hybrid attention mechanisms such as Nemotron or Qwen3.6. 5. A very extreme GQA ratio: 32 query heads and only 2 KV heads; for comparison, Gemma 4 31B uses 32 Q / 16 KV in the local heads and 32 Q / 4 KV in the global heads. This means that Meta Glimmer has a very small KV cache. Overall, the probably most similar architecture is Gemma 3 27B (including the Gemma-style pre/post RMSNorm placement) and Gemma 4 31B, but with some tweaks like SwiGLU instead of GeGLU activations, gated attention, and the more extreme GQA:SWA pattern mentioned before. What stands out is its extreme KV-cache efficiency. I.e., the KV CACHE / TOKEN ratios (in BF16) are: - Muse Glimmer: 52 KiB (lower is bett...
Short architecture note on Meta Muse Glimmer 30B, including gated local and global GQA, KV-cache efficiency, and release-time benchmark comparisons.
Activity on rasbt/LLMs-from-scratch
rasbt commented on an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed a pull request in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt opened a pull request in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt commented on an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt opened a pull request in LLMs-from-scratch
View on GitHubJust saw that the LLMs-from-scratch repository passed 100,000 stars on GitHub! This is super cool and motivating. I am really happy to see that this open-source repo has helped so many people. Thanks also to everyone who shared ideas and opened PRs with improvements! Of course, I plan to keep adding new material, including new attention variants and architectures (while bigger projects like RL and Reasoning From Scratch live in their separate repositories). I am also currently working on a larger applied custom “small” LLM project. It has been keeping me super busy this month, but I will share more on that soon. If you are new to it, some of the highlights include 1. Of course, the complete code path from tokenization and attention to pretraining, classification, and instruction fine-tuning, etc. All of it FROM SCRATCH, of course! (RL lives in a companion repo.) 2. From-scratch implementations of Llama, Qwen, Gemma, and Olmo (smaller variants that run locally and can be plugged into the training scripts). 3. From-scratch implementations of attention alternatives and other architecture components, such as GQA, MLA, sliding-window attention, Gated DeltaNet, DeepSeek Sparse Attention, cross-layer KV sharing, and mixture-of-experts 4. Materials on KV caching, training performance, memory-efficient weight loading, DPO, evaluation, and LoRA So, if you don’t have any weekend plans yet, happy tinkering!
Short note celebrating the LLMs-from-scratch repository passing 100,000 GitHub stars and summarizing its learning materials.
RT Hamel Husain It’s been a long time since I’ve been excited to work through a technical book @rasbt It’s time to bring more ML back into my life
Activity on rasbt/mlxtend
rasbt closed a pull request in mlxtend
View on GitHubActivity on rasbt/reasoning-from-scratch
rasbt closed an issue in reasoning-from-scratch
View on GitHubActivity on repository
rasbt pushed reasoning-from-scratch
View on GitHubActivity on rasbt/reasoning-from-scratch
rasbt commented on an issue in reasoning-from-scratch
View on GitHubActivity on rasbt/reasoning-from-scratch
rasbt opened a pull request in reasoning-from-scratch
View on GitHubRT Sophia Yang, Ph.D. Happy August! Our AI book club is reading @rasbt's Build a Reasoning Model this month. I have 10 free copies to give away (thanks @ManningBooks)! Join our book club and comment below why you're interested in reading this book & I'll pick the winners. Excited to read together!
Activity on repository
rasbt starred rasbt/LLMs-from-scratch
View on GitHubActivity on repository
rasbt pushed llm-architecture-gallery
View on GitHubActivity on rasbt/llm-architecture-gallery
rasbt contributed to rasbt/llm-architecture-gallery
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt commented on an issue in LLMs-from-scratch
View on GitHubConsistent with what I found with Qwen3.6 a while back: Claude Code uses 2-3x as many tokens than (many) other harnesses at similar success rate. - Unoptimized? - Buggy? - Deliberate (coz that helps it in more challenging cases)? Need to find some time to investigate more...
We ran Kimi K3 through 3 agent harnesses (Claude Code, Hermes, Kimi Code) on 28 identical tasks. All 3 harnesses completed the tasks at similar success rates, but the interesting story is token efficiency: the same task cost up to 30x more tokens depending on the harness. 🧵🧵
View quoted postActivity on repository
rasbt pushed reasoning-from-scratch
View on GitHubActivity on repository
rasbt pushed reasoning-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt opened a pull request in LLMs-from-scratch
View on GitHubActivity on rasbt/reasoning-from-scratch
rasbt opened a pull request in reasoning-from-scratch
View on GitHubThe Kimi K3 architecture figure for yesterday's big open-weight model release, along with some observations and thoughts. 1. Yes, it looks relatively complicated, but it's essentially a scaled-up production version of their Kimi Linear model they released last year (scaled up from 48B -> 2.8T; K3 is by far the biggest open-weight model right now) 2. The one new component compared to Kimi Linear is the LatentMoE. I omitted it in the figure below since it's already very crowded, but that's essentially the same LatentMoE as in Nemotron 3 Ultra (you can find it in my LLM Architecture Gallery if you are curious). The idea here is to compress (down-project) large linear layers similar to multi-head latent attention. 3. Kimi K3's overall trend (similar to Nemotron 3, DeepSeek V4, and others) is also towards better inference efficiency. That is, there are many components that replace existing components with efficiency-tweaked versions. I.e., MoE -> LatentMoE, regular attention -> multi-head latent attention and Kimi Delta Attention. (I also have short tutorials and write-ups in my gallery if you are curious about additional details). 4. The one component change that is not an efficiency tweak is attention residuals. Like DeepSeek V4 improved the residual path with mHC (manifold-constrained Hyper-Connections), attention residuals are a way to improve the residual path, but it works a bit differently. I.e., mHC made the residual path wider. Attention residuals (also already part of Kimi Linear) connect the residuals across layers; the connection itself uses an attention score for an important/contribution weight. According to the report, it improves the validation loss and downstream performance (a bit) consistently and adds about 4% in training cost and 2% in inference cost. 5. Interestingly, Kimi K3 got rid of all RoPE layers and uses NoPE (No Positional Embeddings) everywhere instead. (Again, this is inherited from Kimi Linear). In other architectures, the recent tre...
Short architecture note on Kimi K3, including LatentMoE, Kimi Delta Attention, Attention Residuals, NoPE, multimodality, and inference-efficiency choices.
RT elie this scaling law is a piece of art, kimi K3 recipe improves by ~2.5x over kimi K2 recipe the tech report is amazing
Releasing the model weights and technical report of Kimi K3. Kimi K3 is our most capable model: a 2.8T MoE model with native visual understanding and a 1M-token context window. New model architecture: 2.5x the intelligence per unit of compute, not just more params. Alongside
Activity on repository
rasbt pushed reasoning-from-scratch
View on GitHubLooking forward to chatting with @hugobowne today (July 27) at 4 pm PT on the Vanishing Gradient livestream on YouTube. Will cover open source, the newest LLMs & trends, agent frameworks, and whatever else comes up. Basically, all the exciting stuff. Should be fun!
Next week I’m sitting down with @rasbt, independent AI researcher, author of Build a Large Language Model (From Scratch) and Build a Reasoning Model (From Scratch), and creator of Ahead of AI, which just crossed 200,000 subscribers. Since we last spoke, Sebastian and I have been
Activity on repository
rasbt pushed llm-architecture-gallery
View on GitHubActivity on rasbt/llm-architecture-gallery
rasbt contributed to rasbt/llm-architecture-gallery
View on GitHubYes, open-source / open-weight models are important for a healthy AI ecosystem. That's how we can verify things, check claims, and keep up outside the closed labs. Plus, it gives us the freedom to run AI on our own hardware if we are not ready to share personal data and IPs with closed labs through using their models. (Not that proprietary models are bad, actually I use them a lot as well, but it wouldn't healthy not to have any alternatives.) Anyway, while pretty much everyone is waiting for the Kimi K3 and Ling 3.0 weights to land on the model hub any day now, there were quite a few other interesting new open-weight model releases the past week. Yes, one of those weeks! So, here are the architecture pics along with some notes on what I found most interesting: 1) Nanbeige 4.2 3B uses looped depth sharing. This basically means it runs the same 22-layer (=transformer block) stack twice. So, it extends the 22-layer architecture to 44-layers, but without duplicating the weights. (2x the transformer block compute but same memory footprint.) Why? The info is a bit sparse, but section 2.1 of the Nanbeige 4.2 technical report says two passes gave the best trade-off and retained about 75% of the token efficiency of a standard architecture. More passes gave barely any gains but made the training much slower and much more expensive. 2) Laguna S 2.1 is poolside's Laguna model in a really nice size: 118B sparse MoE with 8B active parameters and a 1M-token context window. Otherwise, the architecture is pretty standard. It uses 36 sliding-window and 12 global (gated-)GQA layers. However, given this size, and the fact that it (just barely) runs on my DGX Spark (uses about <80 GB of RAM), this is right now the most interesting model for me personally. It's 3x bigger and thus a tad slower but maybe a good candidate as daily-driver-Qwen3.6-35B-replacement. (Still waiting on some more independent performance benchmarks though.) 3) Motif-3-Beta is a new 314B-A13B sparse MoE that ...
Short note on the architectures of six new open-weight models, including Nanbeige 4.2, Laguna S 2.1, Motif-3-Beta, Solar Open 2, Antares 1B, and BTL-3.
Activity on rasbt/LLMs-from-scratch
rasbt closed an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/LLMs-from-scratch
rasbt commented on an issue in LLMs-from-scratch
View on GitHubShort correction note for the random seed in Listing 6.5 on page 198 of Build a Reasoning Model From Scratch.
Thanks everyone for all the kind words and feedback. Super happy that you are enjoying Build a Reasoning Model (From Scratch)! Unfortunately, there's small typo in listing 6.5 on page 198 (see video below). The line "torch.manual_seed(0)" should be "torch.manual_seed(5)" This correction is needed to reproduce the generated response in listing 6.5 and the corresponding log-probability outputs later in Chapter 6. If you use 0, the generated response and the results that follow will be different. This will be fixed in the next printing. I am sorry about the oversight, and I hope this note saves you some debugging time.
Activity on repository
rasbt pushed llm-architecture-gallery
View on GitHubActivity on rasbt/llm-architecture-gallery
rasbt contributed to rasbt/llm-architecture-gallery
View on GitHubActivity on repository
rasbt pushed python-machine-learning-book
View on GitHubInteresting surprise drop from Thinky! The Inkling model looks pretty solid on benchmarks, and it has some little surprises in its architecture: - Small conv layers in several places - An RMSNorm for the embeddings (before the block RMSNorm) - Rel. position bias instead of RoPE
first open weight thinking machine model!! 975B total, 41B active trained on 45T tokens, 1M context, multimodal in sliding window with a 5:1 ratio and 512 size, deepseek aux-free load balancing and 2 shared experts (usually people only use 1), actually curious why the model is
Activity on rasbt/LLMs-from-scratch
rasbt commented on an issue in LLMs-from-scratch
View on GitHubActivity on rasbt/python-machine-learning-book-2nd-edition
rasbt closed a pull request in python-machine-learning-book-2nd-edition
View on GitHubShort note celebrating Ahead of AI reaching 200,000 subscribers.