Sebastian Raschka
RT @sudalairajkumar: 138 LLM architectures. One gallery. From GPT-2 to Amazon's Ergo 1.1T, @rasbt's LLM Architecture Gallery lets you explore and compare modern LLM architectures side by side. An excellent visual learning resource! https://sebastianraschka.com/llm-architecture-gallery/ Happy Learning! https://twitter.com/sudalairajkumar/status/2128337419418337736/photo/1
Sebastian Raschka
Mark my words: Lean will overtake Python by 2030 :D (By LLMs, for LLMs.)
Sebastian Raschka
@dwarkesh_sp Btw this was purely directed towards said labs. The points *you* are making here, I agree with :)
Sebastian Raschka
The one issue I have with RSI discussion is that it assumes once someone reached RSI, it's game over for the other labs. But RSI doesn't automatically mean faster progress and better models. RSI only helps if it beats today's AI-assisted human engineers. And even then, you are likely bottlenecked by compute. That is, you can only run so many experiments in parallel. In other words, a lab without RSI but with more compute and strong engineers could still catch up to (or even outpace) an RSI lab with less compute.
Sebastian Raschka
a) Given how much both sides talk and obsess about safety, it is mind-boggling that they don't cooperate on that with each other and exchange tools and frameworks. b) I don't follow their argument that there can only be one lab developing RSI. It's not that once one lab has a solid, working version of RSI, the others can't develop the same.
Sebastian Raschka
People are comparing Amazon Ergo 1.1T with Kimi K3.1 Pro, which ranks slightly ahead on the Artificial Intelligence Index. But to be fair, Kimi K3.1 Pro is also more than 2x bigger. https://twitter.com/rasbt/status/2128143357298004429/photo/1
Sebastian Raschka
Monday: essays on pacing the frontier. 🐢 Tuesday: a frontier open-weight model drops. 🚀 What a week 🤯 https://twitter.com/rasbt/status/2127904666168246741/photo/1
Sebastian Raschka
Nice! A new suite of fully open models (275M to 2.7B). Basically a Pythia for 2026. Architecture-wise, it's a nice data point for the hybrid trend: - 4 Gated DeltaNet layers per full-attention layer (up from 3:1 in Olmo Hybrid) - No positional encodings at all, since the recurrent layers already process tokens in order - So extending the context to 64k needs no RoPE rescaling; the architecture stays the same across all training stages Small enough to run real pretraining and RL experiments on modest hardware. We need more of this.
Sebastian Raschka
Anthropic has benefited enormously from publicly available research: the Transformer, scaling laws, and many training and post-training advances. So the "strong security to protect model weights and algorithmic secrets and crack down on distillation" part of "We Must Pace the Frontier, Part 2" sounds a bit like pulling up the ladder. And a lot of that open research comes from Chinese labs, too:
Sebastian Raschka
Add a custom model option so I can plug in my local Qwen/Gemma on the DGX, and Antigravity becomes my one-stop shop :) https://twitter.com/rasbt/status/2127486918954795428/photo/1
Sebastian Raschka
Wow, Antigravity feels like a straight-up ChatGPT/Codex clone. But hey, that's a good thing. Familiar = convenient :)
Sebastian Raschka
SLOP = Ships Lots Of Products
Sebastian Raschka
Whoa. Didn't have Google promoting distillation on my 2026 bingo card. If you want a hands-on intro to distillation with working code examples, here's a good place to start: https://github.com/rasbt/reasoning-from-scratch/blob/main/ch08/01_main-chapter-code/ch08_main.ipynb https://twitter.com/rasbt/status/2126816593988731070/photo/1
Sebastian Raschka
@elonmusk @deedydas Ha, let's not push that stock price up by accident :) *Just a disclaimer for people skimming: this is a joke exchange (Anthropic's internal use ≠ worldwide usage).
Sebastian Raschka
@michael_nielsen What I am trying to say is these resources are incredibly useful to the general public, to give them the opportunity to understand the technology that closed labs are building.
Sebastian Raschka
While I respect your decision, my thinking is that only a limited number of institutions are working at the frontier, and many of them are closed. These institutions are big enough to train their own people anyway. Removing access to open resources like these will mostly hurt individuals outside the frontier who want to study and understand it. It also takes a bit of agency away from those individuals and further concentrates development in a select few closed-source labs.
Sebastian Raschka
RT @ysinjab: I really enjoyed reading this book by @rasbt. Great hands-on explanations of how reasoning models work, from inference time scaling to reinforcement learning and knowledge distillation. It helps connect the dots between the different approaches to reasoning. https://twitter.com/ysinjab/status/2126329349477392889/photo/1
Sebastian Raschka
Sebastian Raschka
Just wanted to say Happy Thanksgiving! 🦃 I'll be back in December with some cool LLM-related analyses in the pipeline. In the meantime, you know where to find my blog if you have some time for reading! https://twitter.com/rasbt/status/2125955986863087956/photo/1
Sebastian Raschka
Reading about the data collection incident in that open-source coding-agent tool. Two takeaways: 1) Open source matters more and more when software runs on your machine. Installing closed software that nobody can audit is like handing a stranger your house keys. 2) Open source alone isn't enough, though. If a tool gets to access a big chunk of your files, it's not a bad idea to audit it (an LLM or agent can help with that). Telemetry is common, btw. Qwen-Code, for example, has it too, and it's usually easy to turn off (as I wrote about this in my "running local coding agents" article a couple of months ago).
Sebastian Raschka
@trq212 Congrats! 🎊 Banked reset on the house? Joking aside, wishing you all the best, and I am pretty excited to hopefully see you bringing over some experience over to the codex dev.
Sebastian Raschka
@elonmusk @tunguz C
Sebastian Raschka
Code reviews today feel like slapping gazillions of unit tests onto your colleague's code. But who reviews the tests? :)
Sebastian Raschka
Sebastian Raschka
With yesterday’s GLM-5.4 release, there are 5 looped transformers in my LLM Architecture Gallery now. I see a trend :) https://twitter.com/rasbt/status/2125249956495953973/photo/1
Sebastian Raschka
Whoever gets their hands on the most battle-tested enterprise code... This is how the ChatGPT vs Claude vs Gemini vs Muse vs Grok race is going to be decided in 2027 and beyond. (And smart enterprises will play multiple fronts.) https://twitter.com/rasbt/status/2125245138641490324/photo/1
Sebastian Raschka
Glad this got resolved. Whatever you think of the last two weeks, CUDA is a big part of why deep learning took off when it did. It's been 1.5 decades since AlexNet was trained on two GTX 580 gaming GPUs in 2012. And Nvidia GPUs are still best in class. Welcome back, Jensen.
Sebastian Raschka
Fair, but "training" has a lot of different roles: - reading the internet (raw next-token pre-training) - learning how to behave (supervised fine-tuning, RLHF) - getting graded (RLVR) (And now there's mid-training too, which is basically pre-training on the good stuff; I think we can do better here though.)
Sebastian Raschka
Yes, pre-training wasn’t plateauing. Great chart btw.
Sebastian Raschka
I seriously think US open-weight models wouldn't be this good without Chinese open-weight models and vice versa. And proprietary models wouldn't be this good (and cheap) without open-weight models. Competition is a good thing. https://twitter.com/rasbt/status/2124142247285235990/photo/1
Sebastian Raschka
Sebastian Raschka
Yeah. Also, LLMs are specifically fine-tuned to work in specific harnesses and with specific tools. I.e., the harness is part of the training setup, so the model can't really absorb it. It’s a bit like the CPU/GPU absorbing the operating system.
Sebastian Raschka
Whoa, great and even excessive Marin Mochi (535B-A23B) checkpoint drop (in a good way!) Comes with great tech report btw with insights into why / how components were picked (for training stability and GPU throughput). Short fact sheet: 1) Latent MoE with an extra RMSNorm on the latent that made latent MoE actually work (better) 2) Classic 3:1 sliding-window/global gated GQA, partial RoPE (local) and NoPE (global) 3) Adding short convolutions on keys, attention output, and MoE output 4) Exclusive self-attention (XSA) -- I guess the end-of-the year architecture roundup this year won't be boring 😅
Sebastian Raschka
Shipping without the drama is an underrated skill
Sebastian Raschka
Just also added a lot of the additional content I originally trimmed from this article to an optional appendix (plus YaRN and ALiBi). So, if you already read the article and are looking for this bonus content, search for the "appendix" in this article. You can also find a direct link here, but it makes most sense to read passages of this where it is referenced throughout the text: https://sebastianraschka.com/supplementary/positional-embeddings/
Sebastian Raschka
Sebastian Raschka
@tunguz *btw my point was doing the job sample test, that is, actually interact with the model
Sebastian Raschka
@tunguz A correlation of just ~0.2 is pretty meh tbh https://link.springer.com/article/10.1007/s10869-026-10146-8
Sebastian Raschka
Comparing new LLM releases via benchmarks is now a bit like using IQ tests for hiring decisions. Sure, benchmarks are useful baselines and so on, but beyond that, I don't know how indicative they are of our individual tasks and needs. (Yes, also looking at that release yesterday)
Sebastian Raschka
@mattshumer_ A critical-constructive review comparing it to the previous ones would still be tremendously useful though imho. I’m really curious now.
Sebastian Raschka
Could be the start of a trend in new pre-training recipes: no LR decay phase anymore. (Also seen in Kolibri.) Instead: constant LR + averaging the last N checkpoints (or a running weight average). I guess that makes it easier in practice because you don't have to commit to a total training length upfront. A little meta analysis based on those who share training details: - Classic cosine: Llama 3, OLMo 2, OLMo 3, GLM-4.5, GLM-5, Kimi K3, Phi-4 - WSD ("Warmup-Stable-Decay"): DeepSeek V3, DeepSeek V4, DeepSeek V4.1-Flash, Kimi K2, Kimi Linear, Nemotron 3 Nano, Nemotron 3 Super, SmolLM3, MiniMax M2 - No decay (constant LR plus checkpoint averaging): Kolibri-1, DatologyAI's models
Sebastian Raschka
@Alibaba_Qwen > a new MoE architecture you definitely got my attention 🤗
Sebastian Raschka
The open-source LLM ecosystem could really benefit from an LLM building-block API. We have so many LLM components across different models now. Whether you are using PyTorch or C++ and CUDA code directly, there is a major switching cost when you want to run experiments or ablation studies, say swapping GQA with MLA, dense FFNs with MoE, attention layers with Mamba2 or Gated DeltaNet, or standard residual connections with attention residuals. Currently, it’s very messy even with LLM-assisted coding. It could maybe be on top of PyTorch or CUDA directly, but it needs to be carefully engineered and maintained (versus quickly vibe-coded on a weekend) and efficient enough that people trust it to use in production (which is really a requirement to move beyond toy examples). Maybe some food for thought for a big, well-funded lab :) (There are some efforts that go into that direction, like torchtitan, torchtune, Megatron Core, OLMo-core, but they are not quite that level of abstraction, I'd say. And, as always, there’s the chicken-and-egg problem: it needs to be popular to get widely adopted, and it needs to get widely adopted to become popular.)
Sebastian Raschka
Sebastian Raschka
(Finally) wrote up "Understanding Positional Embeddings in Modern LLMs." A RoPE from-scratch tutorial missing from my LLM building blocks collection + what recent architectures do (NoPE, partial RoPE, hybrids). Prob not the flashiest topic, but essential for understanding LLMs https://twitter.com/rasbt/status/2121958665989083253/photo/1
Sebastian Raschka
Inkling 2 Small took a while... but it's more interesting than I initially thought! Using attention residuals (like Kimi K3), but without the linear-attention hybrid. Food for discussion for the end-of-the-year architecture trends analysis! https://twitter.com/rasbt/status/2121613812990095543/photo/1
Sebastian Raschka
Seb's Law, co-signed by another Seb
Sebastian Raschka
Wow that escalated quickly. Was gone for a few weeks and now pretty much everyone launched their own decision model copycats: - Sep 23: Together AI, Tev1-4B - Sep 24: Alibaba Cloud, decision-model - Sep 29: Liquid AI, d1 - Sep 30: Databricks, ai_decide - Oct 1: Amazon AWS, Strands Decider 2B - Oct 1: Cloudflare, Clef and Clef-flash (Clef-omni on Oct 9) - Oct 1: Perplexity, Decider (v1.3 on Nov 12) - Oct 6: OpenAI, Decisions API (GPT-6 Luna) - Oct 7: https://t.co/s8O5rwbq5z, H2O-Lightning-4B - Oct 7: Snowflake, Snowflake Decision - Oct 9: Microsoft, Microsoft-Decision-1 - Oct 15: IBM, Granite Switch 4.1 with Decision adapter - Oct 21: Baseten, Mammoth-1 and Elephant-1 - Nov 6: Salesforce, Koa Decisions - Nov 11: Google DeepMind, Gemini Decision 1 According to a Vercel report, 26% of requests are now routed through decision models 📈
Sebastian Raschka
Hoping Nemotron keeps going. Thankfully, open weight LLMs have some alternatives. But their open data and full training recipes would be much harder to replace.
Sebastian Raschka
LLM training is hard. Hard to be a jack of all trades.
Sebastian Raschka
In reasoning model development, it's always been this interesting tension between training/optimizing chain-of-thoughts (CoTs) vs not touching them to preserve monitorability. CoTs are cool because we can check what the model is up to (e.g., whether it cheats or not) as long as it spells out its thought process. And we risk losing that if we explicitly optimize CoTs. Two caveats: 1) I.e., the catch of CoT and monitorability is that this only works if the written thinking reflects what the model is actually doing. 2) Also, when models become more capable, they spell out less in the CoT (like a cleverer math student needs less note-taking when solving problems during an exam). Nothing new on that front, but an interesting thread below on how to measure "harder to monitor", with some interesting results that confirm the existing intuitions: 1) no-CoT capability (meaning how much reasoning the model can do in a single forward pass without writing anything down) - Better pretraining (lower perplexity) raises this no-CoT capability - Architecture mostly doesn't matter 2) CoT controllability (meaning how well the model can change its written reasoning when asked to add, remove, or change parts of it) - RL alone raises controllability a lot - Controllability is passed on through distillation * Higher no-CoT capability and higher controllability both make monitoring harder. PS: Perhaps the good news is that it seems that process supervision wasn't the main culprit.
Sebastian Raschka
RT @brianrey_x: i've never learned as much as when building things from scratch. currently working through build a large language model by @rasbt, and it's one of the best ways i've found to actually understand how llms work. still struggling to visualize all those dimensions. https://twitter.com/brianrey_x/status/2120589317575954770/photo/1
Sebastian Raschka
Hillclimbing: Make the model better (best intentions). Benchmarking: Measure how much better (best effort). Benchmaxxing: Make the numbers look better (best optics).
Sebastian Raschka
Currently working towards a bigger open LLM roundup. But in the meantime, just one of the interesting trends that stood out. I.e., looks like the transition from full to hybrid attention continues. In 2025, there were still lots of full attention models, with a shift to "some full attention" hybrids. In the first half of 2026, the trend towards "some full attention" hybrids continued. And now, in the second half of 2026, we have a 50/50 split between "some full attention" hybrids and models that don't use full attention at all anymore. And yes, there are also no full attention models anymore. The plot legend here means, - Full attention throughout = Global MHA, GQA, dense MLA, CCA in EVERY layer. - Some full attention = Full global attn mixed with: sliding-window/chunked attention, Gated DeltaNet, KDA, Mamba-2, Lightning Attention, convolutions, sparse attention. - No full attention = Zero dense global layers. The main implication is that the trend goes towards making long contexts cheaper to use. This means, it makes the architectures more suitable for long documents and conversations, large code bases, and of course agent usecases that rely on a lot of tool calls. In particular, there are two distinct efficiency gains here: 1) Less attention computation, since sparse attention and the like select tokens or blocks from the context and performs the expensive attention operation from only that subset. (Note that it can still retrieve information from distant positions.) 2) Less memory for retaining context in some architectures, meaning that recurrent layers such as Gated DeltaNet maintain a fixed-size state. Of course, this saves memory, but compressing the history creates challenges for exact retrieval, so they are usually intermixed with traditional attention methods (sparse or full).
Sebastian Raschka
Sebastian Raschka
You can find more details and higher res figures in the full gallery: https://sebastianraschka.com/llm-architecture-gallery/
Sebastian Raschka
Catching up on the 10 (!) open LLM architecture releases from the past month. Quite a lot happened in October. I guess we can call it "Open October"! 1. Kolibri-1 (78B): A notable model from Germany. Features classic Grouped Query Attention (GQA) and Sliding Window Attention (SWA) attention module. 2. Ling 3.1 Flash (560B): Uses Kimi Delta Attention and the eighth uses gated Multi-head Latent Attention (MLA) inspired by DeepSeek. 3. Muse Spark Open (816B): Besides Musse Glimmer, the first major open weight release from Meta (since Llama). Uses classic GQA + SWA but adds a LatentMoE. 4. Nemotron 3.5 Super VL (120B): Combines Mamba-2 layers with just eight attention layers. Also LatentMoE 5. Dory1.0 (4B): A looped transformer design. 6. Reflection Beam (501B): GQA+SWA architecture. 7. Recursive Flint (40B): Note that "Recursive" is the company name; the architecture is a fairly standard MoE with GQA and SWA. 8. MiniMax M3.1-Flash (428B): Uses their own MiniMax Sparse Attention module. 9. LFM3 (1.7B): Hybrid architecture that mixes short convolutions and attention. 10. Mistral Large 4 (1T) combines MLA with sparse attention. Will probably cover/discuss things in more depth in the coming weeks!
Sebastian Raschka
The complete reasoning-from-scratch video series is now up (and linked) here: https://magazine.sebastianraschka.com/p/building-reasoning-models (Taking a short break but will be back with LLM model and research updates in November!)
Sebastian Raschka
Reasoning From Scratch round 8, the finale! This last lecture in the series covers distillation as an efficient alternative to the previous reinforcement learning training runs. (Planning to take a brief break, but I will be back!) 00:00 Introduction and series recap 01:07 Why distill a reasoning model? 02:51 Soft vs. hard distillation 11:06 On-policy vs. off-policy distillation 18:09 Preparing data for reasoning distillation 22:35 Loading the DeepSeek R1 MATH dataset 28:04 Inspecting reasoning traces and final answers 31:27 Tokenization and chat templates 35:58 Pre-tokenizing the training dataset 39:01 Sequence lengths and the 2,048-token limit 42:38 Creating training and validation splits 45:32 Loading the Qwen3-0.6B base model 46:24 Computing answer-token log probabilities 54:10 Cross-entropy loss for distillation 57:25 Training and validation loss helpers 1:02:03 Implementing the distillation training loop 1:07:26 Running the standalone training script 1:09:41 Plotting training and validation losses 1:11:31 Evaluating checkpoints on MATH-500 1:14:09 Comparing teachers and distillation results 1:16:34 Future directions for reasoning models 1:19:41 Bonus exercises and next steps
🎬
视频
Sebastian Raschka
And one more time, the YouTube link: https://www.youtube.com/watch?v=msp69FR5NZs
中文: 还有一次,YouTube 链接:
Sebastian Raschka
Reasoning From Scratch: Reinforcement Learning with Verifiable Rewards (RLVR) round 2. Covering clipped policy ratios, KL loss term, format rewards, and other GRPO tips & tricks. 00:00 Introduction and recap 01:52 Interpreting basic GRPO training metrics 06:34 Planned improvements to GRPO 08:58 Running longer training jobs with Python scripts 13:39 Running the baseline GRPO training script 17:29 Loading and plotting training logs 19:29 Diagnosing unstable training 23:55 Evaluating checkpoints on MATH-500 26:26 Downloading existing checkpoints 30:09 Tracking advantage statistics 34:53 Understanding entropy 40:32 Computing entropy in PyTorch 44:17 Interpreting entropy values 48:58 Adding entropy tracking to GRPO 53:36 Analyzing advantage and entropy metrics 56:18 Stabilizing GRPO with clipped policy ratios 1:03:27 Implementing the clipped policy loss 1:09:39 Analyzing clipped policy training results 1:11:25 KL divergence and reward hacking 1:15:12 Adding a KL loss term 1:20:34 Limitations of the simplified KL loss 1:23:04 Format rewards and think tags 1:25:47 Adding special tokens to the tokenizer 1:30:29 Implementing the format reward 1:35:56 Analyzing format reward training 1:38:25 Rewarding format only for correct answers 1:40:48 Further GRPO improvements from research 1:45:43 Next steps and distillation
🎬
视频
Sebastian Raschka
And here's the YouTube version: https://www.youtube.com/watch?v=VxfUrUrrczs
中文: 以下是YouTube版本:
Sebastian Raschka
Spontaneous morning chat with Juergen Schmidhuber and Jake Newfield philosophizing about AI. Sry my mic somehow disconnected but Juergen had the more interesting points anyways!
中文: 与尤尔根·施密德胡伯和杰克·纽菲尔德在人工智能领域进行自发的早晨聊天。 打个趣说我的麦克风,但尤尔根却有着更有趣的点!
Sebastian Raschka
And a link to the YouTube version: https://www.youtube.com/watch?v=237Hf7Q3lgg
中文: 以及YouTube版本的链接:
Sebastian Raschka
Reasoning from scratch, round number 6! An introduction (and implementation) of Reinforcement Learning with Verifiable Rewards (RLVR) and Group Relative Policy Optimization (GRPO). 00:00 Introduction 01:54 What makes a reasoning model different? 04:25 Reasoning traces and model capability 08:29 Accuracy and format rewards 11:34 Aha moments and DeepSeek-R1 training 14:41 Reasoning effort and answer length 18:38 RLHF and RLVR 23:04 GRPO vs. PPO 26:40 GRPO explained with a cooking analogy 31:43 The KL term and simplified GRPO 35:04 Loading the pretrained model 36:07 Loading the MATH training data 39:26 Sampling model responses 46:30 Computing verifiable rewards 49:55 Computing advantages 51:54 Token and sequence log probabilities 55:29 Implementing sequence log probabilities 57:37 Fixing the inference-mode error 1:02:24 Computing the GRPO loss 1:04:37 Putting the GRPO step together 1:09:19 The GRPO training loop 1:12:57 Training settings, logging, and checkpoints 1:17:24 Running training and inspecting outputs 1:19:28 Loading and evaluating checkpoints 1:22:33 MATH-500 results and training stability 1:24:05 Memory requirements and next steps
🎬
视频
Sebastian Raschka
Interestingly, just overheard in @swyx podcast interviewing an OpenAI engineer, their Decision API is literally built on GPT-6 Luna adding a decision head.
中文: 有趣的是,刚刚在@swyx播客采访一位OpenAI工程师时,他们的决策API实际上是基于GPT-6 Luna添加决策头而构建的。
Sebastian Raschka
@KVCacheStore And here's Jev playing Tetris (Btw I am not trying to hype Jev, I am just saying that there are lots of quick Jev clones, but they don't capture what makes Jev so popular/useful). https://twitter.com/rasbt/status/2105383373342753010/video/1
中文: @KVCacheStore 和 Jev 饰演 Tetris (我并不是在炒《杰夫》,我只是说有很多快速的杰夫克隆,但它们并没有捕捉到杰夫如此受欢迎/有用的内容。)
🎬
视频
Sebastian Raschka
@KVCacheStore Yes, Lev is definitely not Jev level (Jev got 96.5% on the same benchmark for ref) PS: glad you are liking my book(s)!
中文: @KVCacheStore 是的,Lev绝对不是Jev级别(Jev在相同的 ref 基准上获得了 96.5% PS:很高兴你喜欢我的书!
Sebastian Raschka
RT @rasbt: Update: OpenAI just added a Jev clone 😆 https://twitter.com/rasbt/status/2104985996517355691/photo/1
中文: RT @rasbt:更新:OpenAI 刚刚添加了一个 Jev 克隆 😆
Sebastian Raschka
Update: OpenAI just added a Jev clone 😆 https://twitter.com/rasbt/status/2104985996517355691/photo/1
中文: 更新:OpenAI 刚刚添加了一个 Jev 克隆 😆
Sebastian Raschka
@OpenAI Ok someone ELI5 pls. Regarding the examples just given, migrate my website off the legacy code base for example, how is that different/better than using a Codex prompt? Is it an outer loop on the Codex chat loop?
中文: @OpenAI Ok 某人 ELI5 请关于刚才给出的示例,请将我的网站从旧代码库中迁移,例如,这与使用 Codex 提示符有什么不同/更好? 是Codex聊天环路上的外环吗?
Sebastian Raschka
中文: 以下是完整文章的链接:
Sebastian Raschka
Took a while, but here it is, a mega write-up on language models for text classification and, of course, Jev. It's basically a visual guide to RNNs, CNNs, transformers, and calibration, with hands-on experiments on accuracy and efficiency. https://twitter.com/rasbt/status/2104923910039040173/photo/1
中文: 花了一段时间,但在这里,一篇关于文本分类语言模型、当然还有Jev语言模型的大写作。 它基本上是对RNN、CNN、变压器和校准的可视化指南,并通过实践实验来准确且高效。
Sebastian Raschka
@AndrewYNg There used to be a saying for this, “move fast and break things” 😅
中文: @AndrewYNg 以前常说一句“快动,把事情打碎”😅
Sebastian Raschka
Also kudos to fireworks AI for admitting that they built on top of Kimi (I remember the awkward Mistral 3 release) https://x.com/rasbt/status/1999557830131494977?s=20
Sebastian Raschka
A little Ember-1 tl;dr. Seems like a great model! (Was recently asked on a podcast, given $ xx million, what's the best way to develop a frontier LLM today? My recommendation was: start with an existing one and spend that budget on post-training. Great example here.) https://twitter.com/rasbt/status/2104326522354147793/photo/1
Sebastian Raschka
And a link to the video on YouTube: https://www.youtube.com/watch?v=TVMyOJ_3Gxo
中文: 以及YouTube上视频的链接:
Sebastian Raschka
Reasoning from scratch, round number 5! This time, talking about log-probability scoring (also a great fundamental concept for loss functions like cross-entropy in pre-training and distillation) and self-refinement. 00:00 Introduction and inference-time scaling recap 05:02 Loading the pretrained LLM 08:00 Comparing and scoring model answers 10:18 Building a rule-based scorer 17:53 Token probabilities and sequence likelihood 26:47 Computing token probabilities in PyTorch 30:12 Token indexing and shifted targets 37:27 Log probabilities and numerical stability 45:57 Scoring answers with average log probabilities 56:24 How self-refinement works 59:07 Generating critiques and revised answers 1:01:00 Implementing the self-refinement loop 1:05:57 MATH-500 evaluation results 1:07:35 Takeaways and next steps
🎬
视频
Sebastian Raschka
中文: RT @NoContextHumans:黄金时代。
Sebastian Raschka
The main appeal of open-source agent harnesses isn't that they are free, but that we can inspect what they are doing on our computers.
中文: 开源代理利用工具的主要吸引力不在于它们是免费的,而在于我们可以检查它们在我们计算机上的使用情况。
Sebastian Raschka
MiMo-V2.6 is "simply" the best (for now). Despite its simple architecture design it's currently No.1 in the open-weight benchmarks (weighted average). With "simple," I mean a classic Grouped Query Attention (GQA) with Sliding Window Attention (SWA) at a tiny 128-token window size. So, that underlines one of the points I've been trying to make in recent months: most of the progress still comes from the data and post-training recipe improvements. Fancy attention variants are just mostly efficiency tweaks. What are some of the training data improvements and recipe improvements? The MiMo team shared a pretty detailed technical report. Lots to carefully digest there, but in short, there are a few things that stood out: 1. An increase in agent tasks; also training across different harnesses (the average DeepSWE pass@1 accuracy on held-out harnesses improved from approximately 50% -> 66%). 2. Better reward signals: they replaced a simple correctness verifier with an agentic grader that looks at the execution traces as well. 3. Large RL batches (1,568 prompts × 16 rollouts = 25,088 trajectories) and 2.7–3.7 billion training tokens per update (unclear, though, what the predecessor used).
Sebastian Raschka
@Adamlags An example project of what you are describing: https://github.com/rasbt/ai-detector-from-scratch
中文: @Adamlags 你所描述的示例项目:
Sebastian Raschka
@Adamlags That’s a classic encoder-style classifier basically, no?
Sebastian Raschka
It’s easy to dismiss Jev it as “just a classifier”. But people (me included) who have been training encoder-style models for classification for many years know they were usually special-purpose and limited in some way. The breakthrough of Jev is that it generalizes well. And I’d say the secret sauce is probably more in the data than in the training algorithm. (Plus a nice API design on top of it.)
中文: 很容易将Jev视为“一个分类器”。 但多年来,那些(包括我)一直在训练编码器式模型进行分类的人,都知道它们通常具有特殊用途,且在某种程度上是有限的。 耶夫的突破在于它具有良好的概括性。 而且我认为,这种隐秘的味道可能更多地在数据中,而在于训练算法。(此外,还有一个不错的API设计。)
Sebastian Raschka
And a link to the video on YouTube: https://youtu.be/t5y-kS9nNxU
中文: 以及YouTube上视频链接:
Sebastian Raschka
Inference scaling part 1. Starting with a modded text generation function (temperature scaling, top-p filtering, multinomial sampling) to generate diverse outputs for self-consistency and best-of-N (improving answer accuracy by>2x) 00:00 Introduction and recap 00:31 Training-time and inference-time scaling 07:52 What we'll implement 11:47 Notebook setup and model loading 17:43 Building a flexible text generation function 24:40 Chain-of-thought prompting 28:26 Sampling and output diversity 33:43 Next-token logits and greedy decoding 38:20 Temperature scaling step by step 42:46 Softmax and token probabilities 47:42 Multinomial sampling 54:51 Adding temperature sampling to text generation 59:31 Top-p filtering step by step 1:10:23 Adding top-p filtering to text generation 1:13:43 Sampling and LLM watermarking 1:16:01 Self-consistency and majority voting 1:20:36 Implementing self-consistency 1:29:02 MATH-500 results 1:35:01 Accuracy and compute tradeoffs 1:36:50 Next steps and self-refinement
中文: 推理缩放第1部分 从修改的文本生成函数(温度缩放、顶点过滤、多点采样)开始,生成多种输出,实现自我一致性和最佳一致性(通过2x改进答案精度) 00:00 介绍与回顾 00:31 训练时间与推理时间缩放 07:52 我们将实施什么 11:47 笔记本设置和模型加载 17:43 构建灵活的文本生成功能 24:40 思维链提示 28:26 抽样与产出多样性 33:43 次代币日志记录和贪婪的解码 38:20 一步步扩大温度 42:46 Softmax 和令牌概率 47:42 多音检 54:51 为文本生成添加温度采样 59:31 Top-p 循波过滤 1:10:23 为文本生成添加 pop-p 过滤 1:13:43 取样和LLM水印 1:16:01 自我一致性和多数投票 1:20:36 实现自我一致性 1:29:02 数学-500 结果 1:35:01 准确度与计算权衡 1:36:50 下一步和自我改进
🎬
视频
Sebastian Raschka
Interesting new insights into the old AdamW vs Muon debate: Muon seems to do better because it reduces memorization.
中文: 关于过去的亚当·威斯康星与穆恩辩论的有趣新见解:穆恩似乎做得更好,因为它减少了记忆。
Sebastian Raschka
Some food for thought when designing benchmarks... So, here's a little computer-use (visual) comparison between GPT-5.6 Astra and Qwen3.8 Max. The task here was to recreate the image in the center using the Paint UI. Super interesting how the two different LLMs+Harnesses approached this totally differently by default. I.e., Astra tried to approach this by drawing and layering geometric shapes. Qwen approached this pixel by pixel. (Of course, the pixel-by-pixel result looks closer to the original, it's essentially a low-res version of that by nature.) So, the Qwen-generated image would surely score higher in the sense that it's closer to the original. But I wouldn’t conclude from this example that one LLM generalizes better than the other on other tasks. Also, I wouldn't say Qwen has better compute-use capabilities or better visual understanding than Astra. But it highlights an interesting point about how slippery benchmarks are when they only compare final results.
🎬
视频
Sebastian Raschka
Potentially also related to the pacing, since fewer releases = fewer expenses
中文: 可能也与节奏有关,因为更少的发布 = 更少的费用
Sebastian Raschka
Also, if mildly regulated, I think there's also a "Sorry that this happened, but we did everything right and followed the framework" kind of incentive that makes this attractive to companies to deflect blame and cope with the anti AI sentiment.
中文: 此外,如果受到轻微监管,我认为也“很抱歉发生了这种情况,但我们做对了一切,并遵循了框架”的激励措施,这种激励机制使得企业能够转移责任并应对反人工智能情绪。
Sebastian Raschka
Since I had to discuss the "pacing" with a lot of people this weekend, here are my two cents: I don't think pacing literally means that these companies will be "slowing down" training and development in any way. "Pacing" here means adding a framework for more checks. We have seen some of that "pacing" already in recent months, when Mythos wasn't released as-is but instead a delayed, nerfed Fable variant was released. Or when Astra wasn't released right away / there is an existing Astra model that hasn't been released yet. These Mythos/Fable and Astra pacing decisions were ad hoc. If you are a company, you have to weigh the pros and cons of a delayed release in terms of keeping up with the competition, making money, pleasing shareholders, mitigating risks and harms, and so on. I f there is a formal framework that everyone has to abide by, that essentially relieves some of the pressure on a company to rush out its model just to take the top spot on the leaderboard, since it knows that the competition "has to" play by the same rules. Based on the discussions today, I think "pacing" primarily means just that, rather than a halt in training the models. TL;DR: Pacing != pacing development.
Sebastian Raschka
And the YouTube version: https://youtu.be/JQJ_8_jSAoY
中文: YouTube版本:
Sebastian Raschka
Reasoning from scratch round 3: This time, I cover generating a verifier for... a) ...evaluation (base model versus any future model improvement) b) ...the reinforcement learning with verifiable rewards (RLVR) training later on 00:00 Introduction 01:21 Four approaches to LLM evaluation 07:20 Verifiers and reinforcement learning with verifiable rewards 10:52 Notebook setup and dependencies 13:43 Section 3.1 Building a math verifier 18:57 Section 3.2 Loading a pre-trained model to generate text 24:34 Generating and displaying model answers 29:23 Section 3.3 Implementing a wrapper for easier text generation 34:00 Section 3.4 Extracting the final answer box 37:29 Handling answers without boxes 43:17 Section 3.5 Normalizing the extracted answer 46:56 Section 3.6 Verifying mathematical equivalence 53:32 Implementing the equality check 57:48 Section 3.7 Grading answers 59:20 Building and testing the answer grader 1:03:18 Section 3.8 Loading the evaluation dataset (MATH-500) 1:07:51 Section 3.9 Evaluating the model 1:08:34 Prompt templates for evaluation 1:10:47 Prompt sensitivity and memorization 1:13:55 A minimal evaluation example 1:15:32 Building the evaluation loop 1:20:27 Comparing CPU, MPS, and CUDA results 1:21:54 Reproducibility and floating-point math 1:23:37 Base model vs. reasoning model 1:25:30 Summary and next steps
中文: 从头开始推理:第三次,我负责生成一个验证器...... a)......评估(基础模型与任何未来模型的改进) b) 稍后进行可验证奖励(RLVR)培训的强化学习 00:00 引言 01:21 四个LLM评估方法 07:20 验证与强化学习,可验证奖励 10:52 笔记本设置和依赖 13:43 第3.1节 构建数学验证器 18:57 第3.2节 加载预训练模型以生成文本 24:34 生成并显示模型答案 29:23 第3.3节 实施包装,便于文本生成 34:00 第3.4节 提取最终答案框 37:29 处理无盒处理答案 43:17 第3.5节 将提取的答案进行规范化 46:56 第3.6节 验证数学等价 53:32 实施平等检查 57:48 第3.7节 评分答案 59:20 建造并测试答案分级 1:03:18 第3.8条 加载评估数据集(MATH-500) 1:07:51 第3.9节 对模型的评估 1:08:34 评估的提示模板 1:10:47 及时的敏感和记忆 1:13:55 一个极少的评价示例 1:15:32 构建评价循环 1:20:27 比较 CPU、MPS 和 CUDA 结果 1:21:54 可重复性与浮点运算 1:23:37 基本模型与推理模型 1:25:30 摘要及下一步步骤
🎬
视频
Sebastian Raschka
中文: 我知道,抱歉,但很难抗拒
Sebastian Raschka
Big overhaul on DeepSeek V4.1 using an encoder-decoder setup. Tbh they should have called it DeepSeek V5! Super cool and refreshing, though! https://twitter.com/rasbt/status/2098142625819672603/photo/1
中文: 采用编码器-解码器设置,对 DeepSeek V4.1 进行重大改进。 他们本该称之为DeepSeek V5! 超级酷炫,令人耳目一新!
Sebastian Raschka
Nice showcase that interesting LLM work can be done on single GPU!
中文: 很好的展示,有趣的LLM工作可以在单个GPU上完成!
Sebastian Raschka
中文: 文章链接如下:
Sebastian Raschka
I put together a mega write-up on GPT-6 Astra & looped transformers. How looped transformers / recurrent depth works, cost-tradeoffs, whether it hides reasoning traces, with lots of figures and a tour of recent looped transformer research. https://twitter.com/rasbt/status/2097677950262939931/photo/1
中文: 我在GPT-6 Astra &环形变压器上整理了一篇大型文章。 循环式变压器/循环深度如何工作,成本权衡,是否隐藏推理痕迹,并拥有大量数据,并参观最近的循环变压器研究。
Sebastian Raschka
Btw I don't mean to imply that this is necessarily related or cause for said incident. Just a general reminder for a general data privacy hygiene.
Sebastian Raschka
Re today's incident, maybe not a bad idea to check your settings (Settings → Data Controls) https://twitter.com/rasbt/status/2097319324721557964/photo/1
Sebastian Raschka
And here's the YouTube version: https://youtu.be/BJua0yjO5dk
Sebastian Raschka
Reasoning from scratch round 2: In this video, I cover the text generation process in LLMs and KV caching (to prepare the base model before adding reasoning techniques in the upcoming ones). 00:00 Introduction and reasoning model demo 01:55 How to work through the book 05:00 Chapter 2 overview 08:25 Checking PyTorch and hardware support 10:26 Apple silicon and MPS caveats 15:00 Cloud GPU options 16:08 Tokens and tokenization 18:20 Qwen3 and the Reasoning From Scratch package 23:05 Encoding and decoding text 26:24 Downloading weights and selecting a device 31:01 Loading the pretrained Qwen3 model 34:32 How LLMs generate text 36:47 Input tensors and batch dimensions 41:48 Running the model in inference mode 44:11 Logits and next-token predictions 49:21 Greedy decoding with argmax 52:28 Building a streaming text generator 01:01:28 Generating text and handling end-of-sequence tokens 01:06:00 Benchmarking text generation 01:14:34 How KV caching works 01:17:22 Adding KV caching and measuring the speedup 01:24:31 Model compilation with torch.compile 01:30:33 Combining compilation with KV caching 01:32:53 Comparing CPU and GPU performance 01:35:32 Recap and next steps
🎬
视频
Sebastian Raschka
Maybe the best tl;dr here is: The looped aspect is not explicitly hiding reasoning tokens. Sure, GPT 6 Astra uses fewer tokens than GPT 5.6 Sol. But that's because it's a smarter model in general (more training, bigger, etc). We can observe the same thing in previous generations: If we compare GPT 5.6 Sol with GPT 5.6 Luna, Sol uses ~46% fewer output tokens in the intelligence index but no one is complaining the Sol hides the reasoning more than Luna.
Sebastian Raschka
中文: 此版本的 YT:
Sebastian Raschka
@Blum_OG haha yes
Sebastian Raschka
A lot of hype around OpenAI's Astra model here on my timeline today. Apparently, this goes back to a new article from The Information, which said Astra is a "recurrent depth or looped transformer". It's always interesting to read about new or different approaches (including rumors about what the closed labs may be up to), but let's debunk this a bit. About 2 months ago, I shared the architecture details of Nanbeige, for example, where "Nanbeige4.2-3B is pretrained from scratch on 28T tokens with a Looped Transformer that reuses the layer stack to increase capacity without adding parameters." Yes, that's it. The looped transformer idea is just reusing layers in the transformer block. In the case of Nanbeige, the main idea is to reuse the same 22-layer stack (=transformer block) twice instead of once. So, effectively it extends the 22-layer architecture to 44 layers, but without duplicating the weights. In simple terms, this roughly doubles the size of the model (if we ignore the embedding and output layers for a second). But instead of requiring 2x the storage and RAM to host this model, it stays at the same size since we reuse the components. However, it's almost 2x as expensive in terms of compute, because we run the embedded text through almost 2x as many layers. Why? In the Nanbeige 4.2 technical report, the researchers found that 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.) While, as far as I know, Nanbeige 4.2 is the first notable open-weight model that adopted this approach, the idea goes back to the NeurIPS paper "Mixture-of-recursions: Learning dynamic recursive depths for adaptive token-level computation". Actually, this paper proposes a mechanism that is a bit more sophisticated by adding a learned router that determines whether each token receives one, two, or more passes. So, easy tokens can exit early while harder tokens receive additional computation. In sum, Astra may be a really good model, but this shouldn't be about this "looped transformer aspect," which is just a tiny architectural tweak. Also, the statement "the new technique works in a way that obscures some or all of the AI's reasoning, otherwise known as 'chain-of-thought'" is not necessarily true with respect to the looped transformer method. It's possible that The Information journalist refers to some other technique or misunderstood the looped transformer method. Reusing layers does not by itself suppress visible chain of thought. It adds computation in hidden states before the next token is emitted, just as ordinary transformer layers do. But based on the information we have, the only plausible interpretation here is that if a model uses more of these recurrent passes, it may need to generate fewer intermediate reasoning tokens. So then more of its computation happens in latent activations that cannot be read as text. But we would get the same effect if we were scaling up the model size, like GPT 5.6 Luna -> GPT 5.6 Sol.
Sebastian Raschka
And a link to the youtube version: https://www.youtube.com/watch?v=Kh9mqTzjuEQ
Sebastian Raschka
A little video that - explains the relationship between conventional LLMs and reasoning models (and agents), - philosophizes a about "from scratch" approaches, - and explains how to install Python & PyTorch requirements with uv. https://twitter.com/rasbt/status/2094057793506439492/video/1
🎬
视频
Sebastian Raschka
Thanks everyone for all the nice feedback on Build a Reasoning Model (From Scratch) so far! I am also flattered that 2 book clubs are discussing it. I look forward to join for live Q&As on Thu, Sep 3, at 10 am (and 2 pm CT). Please join us & bring your questions!
中文: 感谢大家对Build a Reasoning Model(来自Scratch)的所有好评! 我也对两家读书会正在讨论这个问题感到欣慰。 我期待于9月3日(星期四)上午10点(以及美国东部时间下午2点)参加现场问答。 请加入我们,带上您的问题!
Sebastian Raschka
And if you can't make it at 10 am, here is the second Q&A, hosted by Sage Elliott’s AI Book Club at 2 pm CT. Model (From Scratch): https://x.com/sagecodes/status/2093543717538013442?s=20
中文: 如果上午10点无法预订,以下是第二款由Sage Elliott的AI图书俱乐部于美国东部时间下午2点举办的Q&A。 模型(来自Scratch):
Sebastian Raschka
@lexfridman @dhh Also TIL the “archy” in Omarchy isn’t pronounced like “Archi”tecture but more like Tamago”tchi” 😆
中文: @lexfridman @dh 也 在《Omarchy》中,“archy”的发音与“Archi”技术不如,而更像是 Tamago’tchi。😆
Sebastian Raschka
@lexfridman @dhh Love the blade runner reference 😊
中文: @lexfridman @dh 喜欢刀片跑者参考文献 😊
Sebastian Raschka
@ThePrimeagen want to clarify that this is, in spirit of @ThePrimeagen humorous takes, a humorous (not serious) take
中文: @ThePrimeagen 想要澄清的是,这在 @ThePrimeagen 幽默的 ta 精神上是一种幽默(并非严肃)
Sebastian Raschka
Now 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...
Sebastian Raschka
@ThePrimeagen But does it work and passes the tests? I mean future generations will be like: what's a code? 🤪 I.e. how often do we look into a car's engine or even just under the hood. When something breaks, parts get replaced, not fixed 😆
中文: @ThePrimeagen 但它能通过测试吗?我的意思是,未来几代人会是什么样子:什么是代码?🤪 即我们多久查看一次汽车发动机,甚至就在引擎盖下。当东西坏了时,零件会被更换,而不是固定的【EE1】
Sebastian Raschka
Here's a link to the video + slides + transcript: https://magazine.sebastianraschka.com/p/claude-watermarking
Sebastian Raschka
A couple of days ago, I did a quick explainer on Claude’s new watermarking process and implementation. Since it’s such a popular topic and sparked such a lively discussion, I thought it might be interesting to go into a bit more detail when explaining how it works. So, instead of the usual text article, I recorded a little lecture on the topic (to change it up a bit from my usual articles). It ended up a bit longer than intended, but I hope it clarifies a lot of things: - Sampling the next token in an LLM and pseudorandom number generators - How watermarking relates to the regular LLM sampling process - Whether watermarking makes text "worse" - How to remove watermarks - Tournament sampling - How new text is checked for watermarks without rerunning the LLM I ended up with ~50 slides, but I hope that these explain it well, though! Happy watching!
Sebastian Raschka
Nice case study on using optimized functions whenever possible (except for educational purposes, though 😆)
Sebastian Raschka
Nvm, I just saw your article (https://t.co/9PPtrNJAFI). Really good one. I should have profiled this better. I plan to do some profiling for the bonus materials and will link your article as a good case-study. > I'm not that sure why the hand-rolled version is in there -- he covers the maths, but the specific implementation isn't explained in that much depth Yeah, I think it was the page limits for this chapter... > the hand-written code from the book uses an approximation using tanh btw the reason for the approximate one was that the original model weights assumed that the model was using this approximation (gpt-2 was trained with tensorflow where the approximate version is the default); you'd notice slight differences in inference if you don't use the approximate version with the pretrained weights. > On the other hand, I do intend to have a look at torch.compile in the future, to see what kind of speedup I can get from it. Yeah, I can imagine that'll get close to the built-in one. > But anyway, for now, lesson learned: use built-in PyTorch modules when you can. It's a pretty obvious one ;-) 100%. The handrolled ones are just for educational purposes. Some function benefit from it a lot (like cross entropy), because they simplify terms in the backward pass, e.g., I discussed this a bit here https://t.co/jFDeu4eMTT)
Sebastian Raschka
Clarification here. Somewhere in the comments, I agreed that one might have to rerun the LLM for checking for watermarks. That's not correct. I am not 100% which exact technique they use, but they mentioned that they base their method on the SynthID-Text method from https://www.nature.com/articles/s41586-024-08025-4 So, in that method, they have so-called watermarking functions that give 1’s for certain terms and 0’s for others, and then they do a tournament-style selection. Those that survive have a lot of 1’s, i.e., are high-scoring. So, to later check if a text is watermarked, they basically just have to (re)apply the watermarking functions to some text and if it’s above a score threshold (which you reach if you have a lot of those watermark-words that score highly), then the text is likely watermarked. I.e., you don’t need to rerun the LLM to check, just the “cheap” watermark functions (it’s kind of like hashing).
Sebastian Raschka
A 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? 🤔
Sebastian Raschka
It's been a while! 4 nice additions to the open-weight local-LLM-on-consumer-hardware ecosystem: https://twitter.com/rasbt/status/2062235700636873082/photo/1
中文: 已经有一段时间了!开源本地-LLM-on-Consumer-硬件生态系统的4个不错附加功能: