Build and Train a GLM-5.3-Flash Model From Scratch with Python

This post was originally published on this site.

GLM-5.3-Flash combines linear and sparse attention, a mixture-of-experts design, and manifold constrained hyperconnections. A scaled-down version with 25 million parameters can be built in Python and trained on a standard CPU.

We just published a course on the freeCodeCamp.org YouTube channel that will teach you how to build and train a multimodal language model from scratch, covering both pre-training and post-training. The course is from @vukrosic, and all of the code, slides, and experiments are in the GitHub repository linked in the video description.

The model uses a 260-token byte-level vocabulary, a 192-token context, and a small vision encoder that turns a 32 by 32 image into 16 tokens.

In this course, you will learn:

  • Tokenization & Embeddings
    Why a small model needs a small byte-level vocabulary and how weight tying shares one matrix between the embeddings and the output head.
  • Linear & Sparse Attention
    How linear attention keeps a fixed-size memory of recent tokens while every fourth layer uses sparse attention with an indexer to find distant details.
  • Mixture of Experts
    How tokens are routed to a few chosen experts plus a shared expert that learns information common to every token.
  • Adding Vision
    How images are split into patches with 2D RoPE and merged into image tokens so the model can recognize digits.
  • Pre-Training Experiments
    How data diversity, interleaving, and curriculums affect learning, including how interleaving helps prevent catastrophic forgetting.
  • Reinforcement Learning
    How to design reward functions, compute advantages as in GRPO, update only the final layers, and test group size, temperature, and seeds.

After reinforcement learning, the model goes from solving 0 of 24 Python tasks to 16 of 24.

Watch the full course on the freeCodeCamp.org YouTube channel (44-minute watch).

Don’t miss these tips!

We don’t spam! Read more in our privacy policy

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Hot this week

COP31: Johan Rockström Warns of Climate Tipping Points and Efforts to Sideline Science

ANTALYA, Türkiye, November 17 (IPS) - The world...

Oura Ring Adds a Jet Lag Feature for Time Zone Travelers

Traveling to new places is good for the soul,...

Zsela Invites You to The Party With New Album

CommentLoaderSave StorySave this storyCommentLoaderSave StorySave this storyZsela is getting...

Over a Third of Gen Z-ers Rely on AI for Friendship

As generational cohorts go, Gen Z has been saddled...

ART X Lagos 2026 Art Across Borders: Redefining Value

Exploring human anatomy through sustainable materials: Ghizlane Sahli’s Histoires...

Topics

Zsela Invites You to The Party With New Album

CommentLoaderSave StorySave this storyCommentLoaderSave StorySave this storyZsela is getting...

Oura Ring Adds a Jet Lag Feature for Time Zone Travelers

Traveling to new places is good for the soul,...

ART X Lagos 2026 Art Across Borders: Redefining Value

Exploring human anatomy through sustainable materials: Ghizlane Sahli’s Histoires...

25+ Must-Haves for Any SPED Teacher

Being a special education teacher is tough, but so...

Over a Third of Gen Z-ers Rely on AI for Friendship

As generational cohorts go, Gen Z has been saddled...

Featured Artist | Darrell Black

Darrell Black Frankfurt, Germanyhttp://darrell-black.pixels.com/@definismart My Darrell Urban Black, an American visual...

Related Articles

Popular Categories

News Feed

49ers win in Mexico and Bills stay top – NFL week 11

49ers win in Mexico and Bills stay top - NFL week 11To play this video you need to enable JavaScript in your browser.This video...

UK Championship match schedule, seeds & BBC TV coverage

UK Championship match schedule, seeds & BBC TV coverageTo play this video you need to enable JavaScript in your browser.This video can not be...

My weekend in Verbier – the Swiss ski resort where royalty and glamour meet family fun

 Standing at the summit of a 3,330-metre-high mountain, I wondered how on earth I had agreed to this as I prepared to launch off....

Inside fast-growing consumer brand Clean Cult’s carton crusade

Paper-based cartons and other fiber packaging alternatives to plastic continue to expand in the food and beverage sector, with sales nearing $500 billion in...

‘MobLand’ Adds ‘The Forsytes’ Actor Gregg Sulkin For Season 3

EXCLUSIVE: Paramount+ began rolling cameras on Season 3 of MobLand last week — and now the gangland drama has added a new recruit. Gregg Sulkin,...

‘The Hunger Games: Sunrise on the Reaping’ Dominates U.K., Ireland Box Office as ‘Ramayana’ Sets All-Time Indian Record

Lionsgate UK’s dystopian prequel “The Hunger Games: Sunrise on the Reaping” stormed to the summit of the U.K. and Ireland box office, debuting at...

Billy Ray Cyrus on Miley’s Wedding: ‘I’m the Proudest Dad Alive’

Trending on Billboard Billy Ray Cyrus has shared a series of photos from daughter Miley Cyrus’ wedding to Maxx Morando, with the “Achy Breaky Heart”...

Benny Benassi and Fedde Le Grand Set Three Australian Shows for January

Benny Benassi and Fedde Le Grand have added two Australian shows in January, expanding a run that until now consisted of a single appearance...

Adam Driver Teases His ‘X-Men’ Villain Mister Sinister to Seth Meyers

Robert Pattinson isn’t the only A-lister who has appeared in multiple massive movie franchises. Adam Driver starred as the lightsaber-wielding antagonist Kylo Ren in the...

Willow iOS 2.0

Popular articles

49ers win in Mexico and Bills stay top – NFL week 11

49ers win in Mexico and Bills stay top - NFL week 11To play this video you need to enable JavaScript in your browser.This video...

UK Championship match schedule, seeds & BBC TV coverage

UK Championship match schedule, seeds & BBC TV coverageTo play this video you need to enable JavaScript in your browser.This video can not be...

My weekend in Verbier – the Swiss ski resort where royalty and glamour meet family fun

 Standing at the summit of a 3,330-metre-high mountain, I wondered how on earth I had agreed to this as I prepared to launch off....

Inside fast-growing consumer brand Clean Cult’s carton crusade

Paper-based cartons and other fiber packaging alternatives to plastic continue to expand in the food and beverage sector, with sales nearing $500 billion in...

‘MobLand’ Adds ‘The Forsytes’ Actor Gregg Sulkin For Season 3

EXCLUSIVE: Paramount+ began rolling cameras on Season 3 of MobLand last week — and now the gangland drama has added a new recruit. Gregg Sulkin,...

‘The Hunger Games: Sunrise on the Reaping’ Dominates U.K., Ireland Box Office as ‘Ramayana’ Sets All-Time Indian Record

Lionsgate UK’s dystopian prequel “The Hunger Games: Sunrise on the Reaping” stormed to the summit of the U.K. and Ireland box office, debuting at...

Billy Ray Cyrus on Miley’s Wedding: ‘I’m the Proudest Dad Alive’

Trending on Billboard Billy Ray Cyrus has shared a series of photos from daughter Miley Cyrus’ wedding to Maxx Morando, with the “Achy Breaky Heart”...

Benny Benassi and Fedde Le Grand Set Three Australian Shows for January

Benny Benassi and Fedde Le Grand have added two Australian shows in January, expanding a run that until now consisted of a single appearance...

Adam Driver Teases His ‘X-Men’ Villain Mister Sinister to Seth Meyers

Robert Pattinson isn’t the only A-lister who has appeared in multiple massive movie franchises. Adam Driver starred as the lightsaber-wielding antagonist Kylo Ren in the...

Willow iOS 2.0