r/MachineLearningAndAI • • Apr 20 '26

eBook [P] Built GPT-2, Llama 3, and DeepSeek from scratch in PyTorch - open source code + book

1 Upvotes

I spent the past year implementing five LLM architectures from scratch in PyTorch and wrote a book documenting the process.

What's covered:

  • Vanilla encoder-decoder transformer (English to Hindi translation)

  • GPT-2 (124M), loading real OpenAI pretrained weights

  • Llama 3.2-3B, showing the exact 4 component swaps from GPT-2 (RMSNorm, RoPE, SwiGLU, GQA), loading Meta's pretrained weights

  • KV cache mechanics, MQA, GQA

  • DeepSeek: Multi-Head Latent Attention with absorption trick and decoupled RoPE, DeepSeekMoE with shared experts and fine-grained segmentation, Multi-Token Prediction, FP8 quantisation

All code is open source: https://github.com/S1LV3RJ1NX/mal-code

The book (explanations, derivations, diagrams) is on Leanpub with a free sample: https://leanpub.com/adventures-with-llms

I'm a Senior Forward Deployed Engineer at TrueFoundry, where I work with enterprises on LLM systems. I wrote this because I wanted a resource that went past GPT-2 and into the architectures actually running in production. Happy to discuss any of the implementations.


r/MachineLearningAndAI • • Apr 16 '26

Machine Learning Explained - The Quiet Revolution Reshaping Everything

Thumbnail
accordingto.ca
1 Upvotes

r/MachineLearningAndAI • • Apr 14 '26

eBook Machine Learning Yearning (ebook link)

Thumbnail
github.com
1 Upvotes

r/MachineLearningAndAI • • Apr 13 '26

eBook Fundamentals of Deep Learning (ebook link)

Thumbnail dn790002.ca.archive.org
1 Upvotes

r/MachineLearningAndAI • • Apr 08 '26

"OpenAI quietly removed the one safety mechanism that could shut the whole thing down — and nobody is talking about it"

Thumbnail
youtube.com
1 Upvotes

r/MachineLearningAndAI • • Apr 07 '26

Has anyone successfully applied ML to predict mechanical properties of steel from composition alone, without running tensile tests?

1 Upvotes

Been working on a project where we need to estimate yield strength and hardness for different steel grades before committing to physical testing. The traditional approach (run a batch, test it, iterate) is expensive and slow — especially when you're evaluating dozens of composition variants.

I stumbled across an approach using gradient boosting models trained on historical metallurgical datasets. The idea is to use chemical composition (C, Mn, Si, Cr, Ni, Mo content, etc.) plus processing parameters as features, and predict tensile strength, elongation, or hardness directly.

There's a walkthrough of this methodology here: LINK

It covers feature engineering from alloy composition, model selection, and validation against known ASTM grades.

Curious what others here have tried:

  • What features end up mattering most in your experience — composition ratios, heat treatment temps, or microstructural proxies?

  • How do you handle the domain shift when the model is trained on one steel family (e.g. carbon steels) but needs to generalize to stainless or tool steels?


r/MachineLearningAndAI • • Mar 19 '26

eBook Programming Computer Vision with Python (ebook link)

Thumbnail ia903402.us.archive.org
1 Upvotes

r/MachineLearningAndAI • • Mar 16 '26

eBook Mathematics for Machine Learning (ebook link)

Thumbnail ia601807.us.archive.org
1 Upvotes

r/MachineLearningAndAI • • Mar 16 '26

Are agent failures really just distributed systems problems?

Thumbnail reddit.com
1 Upvotes

r/MachineLearningAndAI • • Mar 14 '26

I built an AI that uploads your CSV and answers questions about it — writes and runs the Python itself

Thumbnail
reddit.com
1 Upvotes

r/MachineLearningAndAI • • Mar 13 '26

I WANT TO LEARN MATH

1 Upvotes

Hello everyone

I want to get in to machine learning but my math level is very low as I'm not in academics since 2012

I want to rebuild my fundamental from zero I need help please

I NEED suggestions on books that I can buy to restart everything

THANK YOU ALL I WILL REALLY APPRECIATE YOUR HELP


r/MachineLearningAndAI • • Mar 13 '26

Stanford Researchers Release OpenJarvis

1 Upvotes

A Local-First Framework for Building On-Device Personal AI Agents with Tools, Memory, and Learning

GitHub Link: https://github.com/open-jarvis/OpenJarvis
Website Link: https://open-jarvis.github.io/OpenJarvis/


r/MachineLearningAndAI • • Mar 09 '26

👋 Welcome to r/MachineLearningAndAI - Introduce Yourself and Read First!

1 Upvotes

Hey everyone! I'm u/l0_o, a founding moderator of r/MachineLearningAndAI.

This is our new home for all things related to Machine Learning and Artificial Intelligence. We're excited to have you join us!

What to Post
Learn, build, share and show off your machine learning, artificial intelligence, data science and robotics creations. LLM, AI agents. Links to e-books at copyright/DMCA honoring websites welcome. Self-promotion and commercial posts OK unless spammy.

Community Vibe
We're all about being friendly, constructive, and inclusive. Let's build a space where everyone feels comfortable sharing and connecting.

How to Get Started

  1. Introduce yourself in the comments below.

  2. Post something today! Even a simple question can spark a great conversation.

  3. If you know someone who would love this community, invite them to join.

  4. Interested in helping out? We're always looking for new moderators, so feel free to reach out to me to apply.

Thanks for being part of the very first wave. Together, let's make r/MachineLearningAndAI amazing.


r/MachineLearningAndAI • • Mar 08 '26

Brahma V1: Eliminating AI Hallucination in Math Using LEAN Formal Verification — A Multi-Agent Architecture

Thumbnail medium.com
1 Upvotes

r/MachineLearningAndAI • • Mar 02 '26

eBook Probability and Statistics for Data Science (ebook link)

1 Upvotes

r/MachineLearningAndAI • • Feb 22 '26

[P] Building a Stateful "Cognitive OS" to Solve the LLM Fresh Mind Problem (Synthetic OS & Carter)

1 Upvotes

Hello everyone,

Most AI today uses orchestration frameworks (e.g., LangChain or agent stacks) to build reactive tools. But a normal language model instance is fundamentally stateless (i.e., each prompt is effectively a fresh mind).

I’ve been working on a project that approaches this differently. Instead of simulating persistence by stuffing chat history into a context window, I built a continuous identity construct layered over an LLM substrate. The LLM is treated purely as cortex-like language machinery, while a separate cognitive runtime handles governance, memory, and continuity.

I’m the sole developer on this, having completed a research-stage prototype, and I am looking to share notes, get architectural critique, and connect with others working on persistent agents, neuro-symbolic systems, or cognitive architectures.

1. Synthetic OS: The Cognitive Runtime

Synthetic OS is the modular cognitive runtime governing LLM-based agents. It treats cognition itself as an OS-managed resource, orchestrating perception, memory, reasoning, and safety.

OS metaphor → architecture mapping:

Modules = Processes
AMS (Active Memory Subsystem) = Persistent memory retrieval
RAG = I/O retrieval layer
PGM (Prompt Governance Module) = Scheduler / policy engine
SSAM / MGM = Integrity monitors (self-consistency auditing)
CAM / TAP = System clock & session continuity
SERP = Boundary enforcement / sandboxing

The LLM runs inside this governed sandbox. All outputs are audited before becoming actions or memory, which prevents drift and preserves identity constraints across sessions.

2. Carter: A Persistent Synthetic Agent

Carter is the agent instantiated inside Synthetic OS (i.e., a stateful cognitive entity with guarded epistemic boundaries).

Human analogy mapping:

LLM substrate = Linguistic intelligence
Carter architecture = Executive self
AMS = Long-term / active memory
PGM = Metacognitive control

Carter doesn’t just answer prompts; it maintains a continuous session identity and audits its own reasoning policies and knowledge boundaries.

Example capability:

Carter maintains epistemic boundaries across sessions. If prompted with a fabricated prior event, it flags the memory as unverifiable instead of assimilating it. This is enforced by AMS provenance tagging and PGM audit gates, not by prompt wording alone. Standard chat-history persistence tends to absorb such fabrications.

3. Next Phase: Strategic–Tactical Split & Embodiment

The next goal is translating this architecture toward physical embodiment via an existing robotic platform (e.g., Atlas-class or similar research chassis).

Planned split:

- Tactical layer (robot native OS): low-level physics, actuation, stability
- Strategic layer (Synthetic OS): semantic planning, memory checks, governed intent

Synthetic OS would ingest telemetry APIs, evaluate state against AMS/PGM constraints, and issue high-level governed intent commands down to the robot SDK.

This is currently at simulator / architecture exploration stage rather than hardware deployment.

Engineering notes

- Current bottleneck: latency from governed prompt routing and audit layers.
- Mitigations explored: cached AMS retrieval tiers, structured prompt templates, pre-audit pruning before LLM invocation.
- Still investigating better approaches for constrained-prompt throughput.

Looking for feedback / collaborators

If you’re working on:

- persistent memory subsystems
- OS-level LLM governance
- neuro-symbolic or cognitive architectures
- robotic simulator bridging (ROS, Isaac, etc.)

…I’d really value exchanging notes.

Carter is currently accessible via a web interface backed by the Synthetic OS runtime:

https://carter.syntheticoslabs.com

If you’re interested in interacting with Carter or discussing architecture, feel free to DM.


r/MachineLearningAndAI • • Feb 06 '26

Honestly the hardest part of learning deep learning is just figuring out what to learn

1 Upvotes

Been trying to get into deep learning for like 8 months now and the weirdest thing? It's not actually the hard concepts that mess with me.

It's more like... I'll finish some course and feel pretty good, then I'll see people casually talking about transformers or attention mechanisms and I'm just sitting there like "wait what, when was I supposed to learn that?"

There's just so much stuff everywhere. YouTube videos, blog posts, research papers, online courses. And nobody really tells you what order to do things in or what actually matters vs what's just trendy right now.

I've definitely spent way too much time googling things like "should I learn PyTorch first or TensorFlow" and then reading 50 different opinions that all contradict each other lol.

Something that's been helping though: I've been replacing my morning Instagram scrolling with like 5-10 minutes on this site called Repoverse. It's basically Tinder but for GitHub repos? You just swipe through ML/AI projects and it figures out what you're into.

I know it sounds kinda silly but I've actually found a bunch of repos and learning stuff I never would've discovered otherwise. And it feels less guilty than doomscrolling reels at least.

Anyway just wanted to share in case anyone else feels lost with where to even start. The amount of content out there is genuinely overwhelming sometimes.

Anyone else feel this way or is it just me?


r/MachineLearningAndAI • • Feb 03 '26

Multimodal Fine-Tuning 101: Text + Vision with LLaMA Factory

Thumbnail medium.com
1 Upvotes

r/MachineLearningAndAI • • Feb 01 '26

Advice on forecasting monthly sales for ~1000 products with limited data

1 Upvotes

Hi everyone,

I’m working on a project with a company where I need to predict the monthly sales of around 1000 different products, and I’d really appreciate advice from the community on suitable approaches or models.

Problem context

  • The goal is to generate forecasts at the individual product level.

  • Forecasts are needed up to 18 months ahead.

  • The only data available are historical monthly sales for each product, from 2012 to 2025 (included).

  • I don’t have any additional information such as prices, promotions, inventory levels, marketing campaigns, macroeconomic variables, etc.

Key challenges

The products show very different demand behaviors:

  • Some sell steadily every month.

  • Others have intermittent demand (months with zero sales).

  • Others sell only a few times per year.

  • In general, the best-selling products show some seasonality, with recurring peaks in the same months.

(I’m attaching a plot with two examples: one product with regular monthly sales and another with a clearly intermittent demand pattern, just to illustrate the difference.)

Questions

This is my first time working on a real forecasting project in a business environment, so I have quite a few doubts about how to approach it properly:

  1. What types of models would you recommend for this case, given that I only have historical monthly sales and need to generate monthly forecasts for the next 18 months?

  2. Since products have very different demand patterns, is it common to use a single approach/model for all of them, or is it usually better to apply different models depending on the product type?

  3. Does it make sense to segment products beforehand (e.g., stable demand, seasonal, intermittent, low-demand) and train specific models for each group?

  4. What methods or strategies tend to work best for products with intermittent demand or very low sales throughout the year?

  5. From a practical perspective, how is a forecasting system like this typically deployed into production, considering that forecasts need to be generated and maintained for ~1000 products?

Any guidance, experience, or recommendations would be extremely helpful.
Thanks a lot!


r/MachineLearningAndAI • • Jan 30 '26

AI successfully reads doctor's hospital admission notes and predicts where patients go afterwards with LLMs

Thumbnail nature.com
1 Upvotes

r/MachineLearningAndAI • • Jan 19 '26

How to Denoise Industrial 3D Point Clouds in Python: 3D Filtering with Vitreous from Telekinesis

Thumbnail medium.com
1 Upvotes

r/MachineLearningAndAI • • Jan 13 '26

Visual Agent Orchestration: How CrewAI-Studio Empowers Non-Developers

Thumbnail medium.com
1 Upvotes

r/MachineLearningAndAI • • Dec 16 '25

NVIDIA Nemotron 3 Nano - How To Run Guide

Thumbnail
docs.unsloth.ai
1 Upvotes

r/MachineLearningAndAI • • Dec 16 '25

Problems with my Ml model that i have been making

Thumbnail reddit.com
1 Upvotes