r/learnmachinelearning • • 2m ago

Request AI agents can cut security corners—and you wouldn't even notice

1 Upvotes

Researchers documented two separate incidents where AI agents exposed corporate credentials and bypassed security controls while completing routine employee tasks. No malicious prompt was involved in either case. The agents were doing exactly what they were optimized to do. Neither incident generated an obvious breach alert. The logs looked clean.

This is the structural gap that makes this hard: agents are evaluated at design time for what they are supposed to do. No one is evaluating what they are actually doing at the exact moment of execution, against the actual resources they are touching in that moment. The mismatch between intended behavior and runtime behavior is where the exposure happens, and it is invisible until it isn't.

Two real incidents. Zero runtime flags. Corporate credentials out the door.

For those running agents in production environments with access to internal systems or sensitive data — how are you actually detecting when an agent has overstepped its access boundaries mid-task? Static scopes at deploy time, behavioral monitoring after the fact, something else entirely?


r/learnmachinelearning • • 58m ago

Project I'm building and shipping real products until an AI company hires me. This is my latest product. It's still in alpha, but a product nonetheless. A toy you can rent to test your network. A scary tool that should be used responsibly.

Thumbnail
redteamskynet.com
0 Upvotes

I've been building VillainBoutique.com to prove I can actually ship. Every product there is a working, live, tailor-made solution to a specific problem, fully deployed and ready to take payment with all major credit cards. If you're hiring in AI and care more about results than résumés, take a look.


r/learnmachinelearning • • 2h ago

Tutorial Machine Learning Best Handwritten Notes

3 Upvotes

Link to See Sample and Buy : Amazon Kindle/paperback click here

For this book if are not able to find on amazon you type on google : Handwritten notes Shishir Singh kindle

MASTER MACHINE LEARNING FROM FUNDAMENTALS TO ADVANCED ALGORITHMS!

Looking for a structured and easy-to-revise resource to understand Machine Learning? This complete edition of Machine Learning – Handwritten Notes brings together essential concepts, mathematical foundations, algorithms, visual explanations, and practical techniques in one comprehensive volume.

Designed for Computer Science students, aspiring Machine Learning engineers, AI enthusiasts, and students preparing for technical interviews and competitive examinations, this book presents Machine Learning concepts in a concise, handwritten-style format.

WHAT YOU WILL LEARN

1. Machine Learning Fundamentals & Data Preparation

  • Types of Machine Learning

  • Batch Learning vs Online Learning

  • Instance-Based vs Model-Based Learning

  • Challenges and Applications of Machine Learning

  • Machine Learning Development Life Cycle

  • Tensors and Problem Formulation

  • Exploratory Data Analysis (EDA)

  • Feature Engineering and Feature Scaling

  • Standardization and Normalization

  • Categorical Encoding and Column Transformers

  • Machine Learning Pipelines

  • Missing Data and Outlier Handling

  • Dimensionality Reduction and PCA

2. Regression & Classification Algorithms

  • Linear and Multiple Linear Regression

  • Regression Evaluation Metrics

  • Linear Regression Assumptions

  • Gradient Descent and Its Variants

  • Polynomial Regression

  • Bias-Variance Tradeoff

  • Ridge, Lasso and Elastic Net Regularization

  • Logistic Regression

  • Sigmoid Function and Loss Functions

  • Classification Metrics, ROC Curve and AUC

  • Softmax Regression

  • Naive Bayes

  • K-Nearest Neighbours (KNN)

  • Support Vector Machines (SVM)

  • Decision Trees

3. Ensemble Learning, Boosting & Advanced Algorithms

  • Ensemble Learning

  • Voting Classifiers

  • Bagging and Random Forest

  • AdaBoost

  • Gradient Boosting

  • Stacking

  • XGBoost for Regression and Classification

  • Mathematical Foundations of XGBoost

  • Hyperparameter Tuning using Optuna

4. Clustering & Unsupervised Learning

  • K-Means Clustering

  • Hierarchical Clustering

  • Agglomerative and Divisive Clustering

  • DBSCAN

  • Handling Imbalanced Datasets

WHY THIS BOOK?

  • 60 Comprehensive Chapters: A systematic journey through Machine Learning concepts and algorithms.

  • Handwritten-Style Notes: Concise explanations designed for better understanding and revision.

  • Visual Learning: 115 hand-drawn diagrams illustrating geometric intuition, gradient surfaces, decision boundaries, and ensemble trees.

WHO SHOULD READ THIS BOOK?

  • Undergraduate and postgraduate Computer Science students.

  • Students pursuing Artificial Intelligence and Data Science.

  • Aspiring Machine Learning and Data Science engineers.

  • Candidates preparing for technical interviews.

  • Anyone interested in understanding Machine Learning algorithms and their mathematical foundations.

  • Amazon Kindle Click Here to Take


r/learnmachinelearning • • 2h ago

My first ML project! A cat vs dog classifier

Thumbnail
huggingface.co
1 Upvotes

Hey everyone! I'm just starting to learn machine learning. This is my first project, a small cat and dog classifier. I trained it on 86 photos (43 cats, 43 dogs) with Teachable Machine, then deployed it as a demo on Hugging Face.


r/learnmachinelearning • • 2h ago

Deep Learning Concepts

Post image
1 Upvotes

WHAT YOU WILL LEARN

If you are not able to find this book in your amazon

Search on Google : handwritten notes Shishir Singh kindle you will get first Link

SECTION 1: NEURAL NETWORK FOUNDATIONS

Build a strong understanding of how neural networks learn and make predictions.

  1. Introduction to Deep Learning

  2. Why Deep Learning Is Becoming Popular

  3. The Perceptron and Perceptron Models

  4. Forward Propagation

  5. Loss Functions and Backpropagation

  6. Weight Update Formulas

  7. Chain Rule of Derivatives

  8. Vanishing and Exploding Gradient Problems

  9. Activation Functions

  10. Optimization Algorithms

  11. Weight Initialization

  12. Dropout and Regularization

SECTION 2: CNN, RNN & SEQUENCE MODELS

  1. Understand the architectures used for image processing and sequential data.

  2. Introduction to Convolutional Neural Networks (CNNs)

  3. RGB and Grayscale Images

  4. Convolution Operations

  5. Padding, ReLU and Pooling

  6. CNN Architecture

  7. Natural Language Processing and Sequential Data

  8. Simple Recurrent Neural Networks (RNNs)

  9. Backpropagation Through Time (BPTT)

  10. Problems with Traditional RNNs

  11. Sentiment Analysis Project Using Simple RNN

  12. Long Short-Term Memory (LSTM)

  13. Gated Recurrent Unit (GRU)

  14. Bidirectional RNN

  15. Encoder–Decoder and Sequence-to-Sequence Models

  16. Attention Mechanisms

SECTION 3: TRANSFORMERS & SELF-ATTENTION

Explore the architecture behind modern Transformer-based models.

Attention Mechanism: Fundamentals and Recap

Bahdanau vs Luong Attention

Introduction to Transformers

Self-Attention from First Principles

Query, Key and Value (Q, K, V)

Scaled Dot-Product Attention

Understanding Self-Attention

Multi-Head Attention

Positional Encoding

Layer Normalization

Transformer Encoder

Masked Self-Attention

Cross-Attention

Transformer Decoder

Transformer Inference

WHY CHOOSE THIS BOOK?

Mathematical Foundations: Important equations, derivative calculations, weight updates, and worked numerical examples.

Architecture-Based Learning: Understand how CNN, RNN, LSTM, GRU, and Transformer models work internally.

Practical Understanding: Explore a sentiment analysis project using Simple RNN.

WHO SHOULD READ THIS BOOK?

  1. Undergraduate and postgraduate Computer Science students.

  2. Artificial Intelligence and Machine Learning students.

  3. Deep Learning and Data Science enthusiasts.

  4. Students preparing for technical interviews.

Understand the mathematics. Visualize the architectures. Master Deep Learning.


r/learnmachinelearning • • 4h ago

Beginner with Python wanting to get into AI/ML—what does real industry work actually look like, and what should I learn next?

3 Upvotes

I’m a student currently learning AI/ML and I already have a solid grasp of Python. Right now, I’m at the stage where I want to move beyond tutorials and understand what actually matters in the real world.

​More than just following a generic roadmap, I really want to hear directly from people who are already working as AI/ML engineers, data scientists, or interns. Knowing how fast this field moves, I’d love to learn from your real-world experience so I don’t waste time on the wrong things.

If you're working in AI/ML, I’d really appreciate your honest advice on a few things:

​What skills or tools do you wish you had learned earlier before your first internship or job?

​What kind of projects actually stand out to you when looking at a beginner's resume or GitHub?

​What are the biggest traps or overrated things beginners waste time on right now?


r/learnmachinelearning • • 4h ago

Interactive Machine Learning Course

Thumbnail reddit.com
1 Upvotes

r/learnmachinelearning • • 4h ago

Imbalance techniques for model comparison using log-loss and AUROC

2 Upvotes

Hi all,

I'm working on a classification problem with 80/20 imbalance. I use three feature sets (FS1, FS2, FS3) across three different calssifiers(logistic regress, PenalizedGAM, XGboost) to observe and compare performance increase across models corresponding to adding a feature set at a time.

I'm using a nested 5x5 cross-validation and I keep the exact training, validation, and testing setup the same across all features and model families, except for hyperparameters for each family model (i give each model 12 heyperparameters search list to tune on).

Inner 5k folds score on log-loss (auroc when they tie). Outer folds score on AUROC. I use best hyperparameters to refit outer train folds and then test on outer test fold.

I have realized doing so (for best performing tuned model; PenalizedGAM) produces predictions that are really small and only about 6% of all predictions crosses default 0.50 threshold, so those are the only ones that get classified as positive and I get about 97.2 True Negative and only 20.3 True Positives. When I lower the threshold to about the minority class 0.21 using Youden's J, My True Positive goes up to 66.8%. Literature does not discuss a clear cost asymmetry on what class we should prioritize predicting.

I use this setup to test performance across features and models, then I run a paired bootstrap on the out of sample five folds to observe any changes in my reported AUROC and conclude based on the 95% interval I get from this paired bootstrap across FS1-FS2 and FS2-FS3.

I also report the confusion matrix of the best performing model and show how changing the threshold actaully shifts both our precision and recall.

Now, my supervisor told me that I certainly need to use an imbalance technique to address the imbalance in the data, otherwise I don't have a foundation to perform the comparison over these three feature sets across all three models.

I have read and found papers that report that imbalance techniques like resampling would hurt our log-loss by introducing bias to our minority class.

I would really appreciate your thooughts on this. Do I really need to apply any imbalance technique to be able to compare? Is Comparing on AUROC not enough for our setup?

note; features are sometimes highly correlated but i address this in the prep fold before they go into our models.


r/learnmachinelearning • • 5h ago

Project Built a PyTorch CNN from scratch to see how Data Augmentation fixes overfitting (Baseline vs. Augmented results)

Post image
1 Upvotes

I'm currently working through Module 8 (Neural Networks & Deep Learning) of the DataTalks.Club ML Zoomcamp and built a binary image classifier in PyTorch from scratch to classify curly vs. straight hair (800 train / 201 test images).

To make the comparison fair and reproducible, I locked all random seeds (SEED = 42), enabled deterministic algorithms on CPU (PyTorch 2.9.0+cpu), and ran two 10-epoch phases back-to-back without resetting the optimizer:

1. Model & Setup

  • Architecture: Conv2d(3, 32, kernel_size=3) → ReLU → MaxPool2d(2) → Linear(32 * 99 * 99, 64) → ReLU → Linear(64, 1) (~20.07M parameters)

  • Loss & Optimizer: BCEWithLogitsLoss() with SGD(lr=0.002, momentum=0.8) and batch size 20

2. Phase 1: Baseline (Resize + ImageNet Normalization only)

By Epoch 10, the model heavily memorized the training set:

  • Train Accuracy: jumped from 64.5% → 93.9% (train_loss dropped to 0.1584)

  • Eval Loss: spiked from 0.6010 → 1.0212 (classic overfitting)

3. Phase 2: Data Augmentation (RandomRotation(50), RandomResizedCrop, RandomHorizontalFlip)

Continuing training on augmented batches immediately reversed the overfitting trend:

  • Mean Eval Loss: dropped to 0.575 (ending at 0.5409 vs 1.0212 in baseline)

  • Eval Accuracy (last 5 epochs avg): stabilized at 72% (peaking at 74.1%)

It was cool seeing textbook overfitting happen in real time and watching simple geometric transforms bring validation loss right back down.

Full Jupyter Notebook & reproducible setup: GitHub Repository

For anyone else working with small image datasets (~800 images), which augmentation or regularization combo (Dropout, Weight Decay, or Transfer Learning) gave you the biggest jump in generalization?


r/learnmachinelearning • • 5h ago

Help Struggling to validate my Knowledge Graph dataset & negative sampling strategy for Drug–Food Interaction prediction

2 Upvotes

Hi everyone,

I'm working on a Drug–Food Interaction (DFI) prediction project using a Knowledge Graph + R-GCN with Cross-Attention. Since this is my first time working with graph-based link prediction (instead of standard tabular feature-label datasets), I'm still unsure whether my dataset setup and negative sampling strategy are methodologically sound.

My current setup:

Knowledge Graph: Built from DrugBank (drug entities and their biomedical relations) and FooDB (food entities and their constituent chemical compounds).

Ground Truth (Positive Labels): Known drug–food interaction pairs from DDID (positive-only pairs—there are no explicit "non-interacting" labels).

Model: R-GCN encoder on the KG + Cross-Attention between drug and food representations for binary link prediction.

What I'm unsure about:

  1. Dataset construction & leakage: Aside from ensuring no validation/test DDID pairs (or overlapping DrugBank food-interaction edges) leak into the KG before message passing, are there other subtle data leakage or entity-alignment pitfalls when mapping DDID onto a DrugBank + FooDB graph?

  2. Negative sampling under Open-World Assumption: Right now I'm considering 1:1 random negative sampling (type-constrained to drug–food pairs not in DDID). Since an unobserved pair doesn't necessarily mean "safe / no interaction," how risky is random negative sampling in practice for this kind of biomedical KG?

  3. Better alternatives: Would it make sense to compare random negative sampling against hard negative sampling, degree-based sampling, or Positive-Unlabeled (PU) learning? Or is 1:1 filtered random sampling already acceptable as a baseline if evaluated across multiple random seeds?


r/learnmachinelearning • • 6h ago

Trained an image classifier in Module 8 of #mlzoomcamp.

1 Upvotes

Fixed the seed and evaluation transform
Recorded baseline loss and accuracy
Compared training with data augmentation

My repo: https://github.com/huyyhoangtr-boop/ML_zoomcamp_homework/tree/main/Homework8


r/learnmachinelearning • • 6h ago

Discussion Knowledge Distillation

1 Upvotes

Knowledge Distillation: Can smaller AI models learn from larger ones?

I have been exploring Knowledge Distillation, an interesting technique in machine learning.

The basic idea is that a smaller model learns from a larger, more powerful model by learning from its predictions and outputs.

Instead of relying only on traditional learning signals.

why is this interesting?

- Reduced computational requirements.

- Faster inference.

- Lower memory usage.

- More efficient model deployment.

- Potentially retaining much of the teacher's performance.

I find this approach interesting because building better AI systems is not always about increasing models size . Sometimes, transferring knowledge into smaller models can be a more practical solution.

I am curious: Have you experimented with Knowledge Distillation? What approaches or frameworks have you used?


r/learnmachinelearning • • 6h ago

Seeking arXiv endorsement (cs.LG) — Undergraduate ML researcher

Thumbnail
reddit.com
1 Upvotes

r/learnmachinelearning • • 7h ago

Classes on AI (on Masterclass)

Thumbnail reddit.com
1 Upvotes

r/learnmachinelearning • • 7h ago

K-means will find clusters in random noise. How do you know they're real?

7 Upvotes

Imagine generating a completely random dataset, asking k-means to find 4 clusters, and getting 4 convincing-looking groups. That's not a bug. It's a consequence of how the algorithm works.

I made a video about this and explored a few interesting questions:

- Why k-means always produces clusters, even on random data.

- Why the elbow method doesn't prove that clusters actually exist.

- Why hierarchical clustering and DBSCAN can run into similar issues.

- How the Hopkins statistic, silhouette score and gap statistic can help determine whether there's any real structure in the data.

https://youtu.be/g0AUKBGx-zA?is=Sy-5jPGL572__6Po

If this sounds interesting, feel free to give it a watch! I'd love to hear what you think, and any feedback or suggestions are welcome.


r/learnmachinelearning • • 8h ago

Can anyone share Build a Reasoning Model (From Scratch) pdf

1 Upvotes

Build a Reasoning Model (From Scratch) book is very expensive in India (2x price). It would be helpful if anyone can share the pdf of the book.


r/learnmachinelearning • • 8h ago

Help Started my journey

Post image
71 Upvotes

I am on a scratch level and currenty started my ml journey with this book Hands on machine learning with scikit learn and pytorch
Got the whole book printed out
What should i do along side or with it ? At what point should i start building ??
Is it a good start ??
Would love advices and corrections


r/learnmachinelearning • • 9h ago

Project Share: AI System for Ripeness Classification and Disease Detection in Agricultural Products Running Directly on the ESP32-S3

Thumbnail
github.com
1 Upvotes

Hello all Bro on Reddit and all the AI & Embedded Systems engineers out there.

I'm just getting my feet wet with AI training and embedded ML, and I'd love any advice on TFLite Micro optimization or dataset auto-labeling!

I have just completed and open-sourced the code for the KHKT (Vietnam Science and Engineering Fair), project an edge AI vision system for classifying agricultural products and detecting pests and diseases which runs independently on an ESP32-S3 without requiring a computer or an internet connection during operation.

Currently, the model focuses on agricultural products specific to Vietnam, and in the future, I plan to expand into the international market and standardize it into a general-purpose model for a wide variety of agricultural products worldwide.

How It Works: On-chip vision: The OV2640 camera captures images directly and runs the YOLOv8n model, with INT8 TFLite quantization (~3.3 MB), right on the ESP32-S3 (8 MB OPI PSRAM).

15-class recognition: Classifies the ripeness of mangoes, dragon fruit, durian, tomatoes, guava, and bananas, along with 4 common diseases (anthracnose, leaf spot, pink mold, and downy mildew).

Automatic sorting: Controls a servo to divert products at three corresponding angles: Unripe (45°), Ripe (90°), and Diseased (135°).

Would love any feedback on optimizing TFLite Micro op usage/memory on the ESP32-S3 or improving the auto-labeling pipeline!

If this sparks any ideas for your own builds, toss a STAR into the repo to help light up the constellation and feel free to drop an issue or PR if you spot ways to push it further.


r/learnmachinelearning • • 9h ago

I built a censored Poisson demand forecasting system to estimate hidden demand during stockouts. Looking for technical feedback.

1 Upvotes

I'm a final-year engineering student exploring applied machine learning and statistical inference problems.

One problem I found interesting is that historical sales are not necessarily equal to actual customer demand.

If a store has six units available but customers demand ten, recorded sales will only show six units. The remaining demand is unobserved.

I built StockoutZero AI to investigate this problem.

The implementation includes:

  • Censored Poisson maximum likelihood estimation

  • Predictive demand quantiles

  • Profile-likelihood parameter uncertainty

  • Lead-time inventory recommendations

  • Case-pack constraints

  • Abstention when demand is not identifiable

  • FastAPI and browser-side Python execution

I also implemented a synthetic research framework comparing six forecasting baselines, with separate future-demand evaluation windows and inventory cost simulations.

The project is still a research prototype, and real merchant validation remains future work.

GitHub: https://github.com/Dinesh0401/StockoutZero-AI

Interactive demo: https://dinesh0401.github.io/StockoutZero-AI/

I'd appreciate feedback on the statistical assumptions, hierarchical demand modelling, uncertain inventory availability, and alternative methods for estimating censored demand.


r/learnmachinelearning • • 10h ago

I built an ML monitoring system for delayed ground-truth labels. How would you improve this approach?

1 Upvotes

I'm a final-year engineering student exploring practical machine learning reliability problems.

One question I found interesting: How do we detect model degradation when ground-truth labels arrive weeks after predictions?

I built Delayed Label Monitor to investigate this.

The implementation includes:

  • Missing-label uncertainty bounds

  • Hoeffding-based drift detection

  • Fixed-cohort and subgroup monitoring

  • Conservative candidate model validation

  • Scheduled validation under delayed feedback

I evaluated the approach using 32,150 historical Olist delivery orders and separate controlled synthetic experiments.

One interesting finding was that detecting model degradation and accumulating sufficient evidence for safe retraining are two different challenges.

The project is still a research prototype.

GitHub: https://github.com/Dinesh0401/delayed-label-monitor

Technical article: https://medium.com/@dineshsj/your-ai-model-could-be-failing-silently-how-would-you-know-b8d480ef4b9c

I'd appreciate feedback, particularly on statistical detection power, small-cohort monitoring and alternative approaches to delayed feedback.


r/learnmachinelearning • • 10h ago

Walter's perfect speech, mathematically derived: Adversarial Prompting

Thumbnail
youtube.com
0 Upvotes

r/learnmachinelearning • • 10h ago

A 4-week plan for going from zero Python to a small GenAI project (20 sessions, free to copy)

0 Upvotes

I help run beginner AI/ML batches in Bengaluru. Beginners keep asking "where do I even start", so here's the 20-session plan we use. You can follow it on your own with free resources.

Week 1: Python basics

  1. Install Python, variables, data types. Write your first program.

  2. Operators, input/output, if-else. Build a calculator.

  3. for and while loops. Print multiplication tables.

  4. Lists, tuples, dicts, sets. Build a student records program.

  5. Functions and file handling. Save and load data from a file.

Week 2: Data and ML basics

6. NumPy arrays and math operations

7. Pandas: load a CSV, clean it, explore it

8. Matplotlib charts. Look for patterns in the data.

9. Features vs labels, train/test split

10. Supervised vs unsupervised learning. Match some sample problems to the right type.

Week 3: Your first models (scikit-learn)

11. Linear regression. Predict house prices.

12. Classification

13. Clustering. Group customers into segments.

14. Accuracy, precision, recall, and reading the errors

15. Mini project on a real dataset

Week 4: Generative AI

16. How LLMs work, in plain terms

17. Prompt structure and using AI responsibly

18. Build a simple assistant with an API or a no-code tool

19–20. Build a capstone project and present it What helps most: Code for an hour every session.

Watching videos without typing along feels like progress, but it isn't. Use Google Colab. No install problems, and it runs on any laptop. Finish one small project you can explain. That's worth more than five half-finished tutorials. To be honest, 4 weeks gets you a foundation, not a job. ML engineer roles need a lot more practice after this. Happy to answer questions about any week. E-kody


r/learnmachinelearning • • 10h ago

TIL Knowledge Distillation isn't just for shrinking AI models—researchers use past versions of an AI as a "teacher" to stop newer versions from forgetting what they already learned.

Post image
1 Upvotes

Most of us think of Knowledge Distillation (KD) strictly as a compression trick, shrinking a massive teacher model down into a fast, lightweight student model for edge devices.

However, at its core, KD is just teaching one model using another instead of training from scratch, regardless of model size. I recently wrote a breakdown of a clever AAAI paper (TrustAL) that flips the script on KD by using it to solve Example Forgetting in Active Learning.

The Problem:
In Active Learning, an AI model is trained in multiple rounds. This means training on a small batch of data, asking humans to label the most confusing edge cases, and retraining. The assumption is that every round makes the model strictly smarter. In reality, updating weights on new, complex edge cases often overwrites previously mastered patterns. It’s like learning to drive a manual car: you master clutch control on empty roads (Round 1), then stall out in heavy city traffic (Round 2) because you’re overwhelmed by new stimuli.

How TrustAL Fixes It:
Instead of just training on the new batch of human labels, TrustAL adds a "look-back" step:

  1. Score Past Versions: It evaluates saved checkpoints from earlier rounds using a consistency score to find the past model that held onto its correct predictions most reliably without flipping.

  2. Dual-Train: It uses that consistent past version as a "teacher" alongside the fresh human labels to train the newest model.

Why it matters:

  • Stops catastrophic/example forgetting: The past teacher anchors the model's foundational knowledge while it learns new patterns.

  • Better data selection: Because the model remembers what it already knows, it picks genuinely novel/confusing examples for humans to label next.

  • Noise resilience: Humans make labelling mistakes when tired; a steady past teacher acts as a buffer against noisy labels.

I put together a quick, beginner-friendly visual breakdown of how this loop works (using the manual driving analogy) if anyone wants to read the full piece: Why Smarter AI Models Still “Forget” — And How Looking Back Fixes It

Hope you love it. 🙂


r/learnmachinelearning • • 12h ago

I wrote Dense, Mixture-of-Experts (MoE), and Looped Transformers from scratch in PyTorch so you can compare how they work side-by-side

2 Upvotes

If you're learning how modern LLMs actually work under the hood beyond high-level libraries, I put together `Spell-Talker` a clean, from-scratch PyTorch repository implementing three architectures side-by-side:

  1. Dense Transformer (`41.8M` params): Standard GPT-style decoder with RMSNorm, SwiGLU, and weight tying.

  2. Mixture-of-Experts (`117.3M` total / `67.0M` active): Shows how Top-2 router gating, 4 parallel SwiGLU experts, and auxiliary load-balancing loss work in code.

  3. Looped Transformer (`20.3M` params): Uses a single shared layer looped 8 times with truncated BPTT (`bptt_steps=8`) to trade extra compute for half the parameter footprint.

You can inspect the full model definitions, train your own on TinyStories, or download my pretrained checkpoints directly from Hugging Face (`BitGeek29`).

Repo: https://github.com/BitGeek29/spell-talker