Stable Diffusion from Scratch
Convolutions, attention, VAEs, diffusion, UNet and CLIP, explained with the maths and implemented in TensorFlow. Every part builds on the one before it.
PhD · AI Researcher
I'm Yasser Khalafaoui, an AI researcher. I make AI models reliable enough to put in front of real people, and I teach the next generation how to ship them.
I lead AI research at Kompanion, where we build digital therapeutics for brain health. My current research focuses on LLM safety and hallucination mitigation, building on a PhD in multimodal and unsupervised learning applied to recommender systems.
In parallel, I’m driven by a passion for using multimodal AI to support investment decisions: combining market data, text and other signals to act in real time, with proper risk management at the core.
I also teach and write. Cracking AI is my technical blog about AI: each post builds the intuition, explains the ideas properly, and comes with a hands-on implementation you can run yourself.
Yasser Khalafaoui, PhD
[now · Kompanion]
I build Kompanion's conversational agent end to end, from multi-agent orchestration and MCP servers to product evaluation datasets and dashboards checked against ground truth, for us and our partners.
[research]
Detecting and reducing hallucinations, hardening models against adversarial prompts, and measuring both with evaluations that reflect real use rather than leaderboards.
[AI advisor · MentorAI]
Designing a guarded conversational agent that gives users a genuine mentoring experience, with content recommendations tailored to their profile and grounded in psychology frameworks such as RIASEC.
[on the side]
Using multimodal AI to support investment decisions, with risk management built in and decisions made in real time.
Convolutions, attention, VAEs, diffusion, UNet and CLIP, explained with the maths and implemented in TensorFlow. Every part builds on the one before it.
The short version, without skill bars or star ratings. If you’d like my full CV as a PDF, get in touch and I’ll send it over.
AI researcher at Kompanion, shipping LLM features for digital therapeutics. Before that, R&D at Alteca on speech, emotion recognition and recommender systems, and research coordination for the open-source Sound of AI project.
PhD at CY Cergy Paris University (CIFRE with Alteca and the ETIS lab): Advancements in Multimodal and Unsupervised Learning with Application to Recommender Systems. Multi-view clustering, matrix factorization and multimodal recommendation.
I teach MLOps, Data Wrangling and The Future of AI to third-year undergraduate and fifth-year graduate students. Earlier, data visualization and systems programming at CY Cergy Paris University.
An engineering degree in computer science at INSEA (Morocco), then a master's degree in data science and analysis at Sorbonne Paris Nord University, which led me into research on multimodal and unsupervised learning.