Blog & Insights

Deep-dive articles on machine learning, AI engineering, and production ML systems

Featured Articles

Machine LearningFeatured8 min read

Achieving AUC 0.9648 on IEEE-CIS Fraud Detection with LightGBM Stacking

A complete walkthrough of building a stacking ensemble that achieved AUC 0.9648 on the IEEE-CIS fraud dataset — feature engineering, model selection, and meta-learner design.

LightGBMFraud DetectionFeature EngineeringKaggle
Machine LearningFeatured10 min read

Feature Engineering Playbook for Tabular ML Competitions

The 15 feature engineering techniques I use in every Kaggle tabular competition — from target encoding to frequency encoding, lag features, and interaction terms.

Feature EngineeringTabular DataKaggleTarget Encoding
Computer VisionFeatured9 min read

Medical Image Segmentation with U-Net: Reaching Dice 0.7964

How I built a U-Net pipeline for skin lesion segmentation on ISIC 2018 — augmentation strategies, loss functions, and post-processing that pushed Dice from 0.72 to 0.796.

U-NetMedical ImagingSegmentationPyTorch
Generative AIFeatured10 min read

ControlNet + Stable Diffusion: Production-Grade Image Generation

How I deployed Stable Diffusion with ControlNet at Ofoto — architecture decisions, API design, prompt engineering, and handling 100+ concurrent requests.

Stable DiffusionControlNetDiffusersProduction
NLPFeatured9 min read

Fine-Tuning BERT for Production NLP: A Battle-Tested Guide

Everything I've learned fine-tuning BERT across 10+ NLP projects — tokenization, learning rate schedules, layer freezing, and deployment with ONNX.

BERTFine-TuningHuggingFaceTransformers
AI AgentsFeatured11 min read

Building a Production RAG System with LangChain and Pinecone

Architecture and code for a production RAG system — chunking strategies, embedding models, hybrid search, reranking, and hallucination mitigation.

RAGLangChainPineconeLLM
AI AgentsFeatured12 min read

Building a WhatsApp AI Sales Agent with n8n and Ollama

How I built a production WhatsApp AI agent for a Moroccan e-commerce business — architecture, conversation memory, product catalog Q&A, and order tracking.

n8nWhatsAppOllamaLLM Agents

All Articles

Machine Learning6 min read

XGBoost vs LightGBM: When to Use Each in Production

A practical, benchmark-driven comparison of XGBoost and LightGBM across speed, accuracy, and memory — with concrete recommendations for tabular ML in production.

XGBoostLightGBMGradient BoostingBenchmarks
March 20, 2025
Machine Learning5 min read

CatBoost's Secret Weapon: Ordered Target Encoding Explained

How CatBoost handles categorical features without data leakage using ordered target encoding — and why this gives it an edge on datasets with many categoricals.

CatBoostCategorical FeaturesTarget EncodingGradient Boosting
February 18, 2025
Machine Learning7 min read

Class Imbalance in Production: What Actually Works

After 20+ imbalanced classification projects — fraud, medical, churn — here is what actually moves the needle: SMOTE, class weights, threshold tuning, and cost-sensitive learning.

Class ImbalanceSMOTEFraud DetectionClassification
February 1, 2025
Machine Learning6 min read

Optuna in Production: Smarter Hyperparameter Tuning

How to use Optuna for hyperparameter optimization beyond random search — pruning, multi-objective optimization, and persistent study databases.

OptunaHyperparameter TuningBayesian OptimizationLightGBM
January 22, 2025
Machine Learning7 min read

SHAP for Production ML: Explaining Models to Non-Technical Stakeholders

A practical guide to SHAP values — global importance, local explanations, waterfall plots, and how to turn model explanations into business insights.

SHAPExplainabilityXAIFeature Importance
January 10, 2025
Machine Learning5 min read

Cross-Validation Strategies: Which One to Use and When

K-Fold, Stratified, GroupKFold, TimeSeriesSplit — a practical guide to choosing the right CV strategy based on your data structure.

Cross-ValidationModel EvaluationTime SeriesKaggle
December 15, 2024
Computer Vision8 min read

YOLOv8 Custom Training: From Dataset to Production API

End-to-end guide to training YOLOv8 on a custom dataset — annotation, training, evaluation, and deploying as a FastAPI endpoint with ONNX export.

YOLOv8Object DetectionFastAPIONNX
March 12, 2025
Deep Learning12 min read

Building a Transformer from Scratch in PyTorch

A step-by-step implementation of the original Attention is All You Need architecture — multi-head attention, positional encoding, encoder-decoder stack.

TransformerPyTorchAttentionNLP
January 28, 2025
Deep Learning8 min read

10 PyTorch Training Tricks That Cut My Training Time in Half

Mixed precision, gradient checkpointing, DataLoader tuning, torch.compile, and 6 more tricks with measured speedups on real experiments.

PyTorchTrainingMixed PrecisionPerformance
January 15, 2025
NLP8 min read

Arabic NLP in 2025: AraBERT, CAMeL Tools, and Production Pipelines

A practical guide to Arabic NLP — the best models, preprocessing challenges, dialect handling, and deploying Arabic text classification in production.

Arabic NLPAraBERTHuggingFaceText Classification
March 1, 2025
AI Agents7 min read

Prompt Engineering Patterns That Actually Work in 2025

Chain-of-thought, few-shot, system prompts, JSON mode, and 5 more patterns with real examples from production LLM applications.

Prompt EngineeringLLMGPT-4Chain-of-Thought
April 20, 2025
Automation10 min read

5 n8n AI Automation Workflows I've Built for Real Businesses

Lead qualification, document processing, social media automation, customer support, and inventory monitoring — real workflows with real ROI.

n8nAutomationAI AgentsGPT-4
April 5, 2025
AI Agents9 min read

Designing Multi-Agent AI Systems That Actually Work

Orchestrator-worker, peer-to-peer, and hierarchical multi-agent architectures — when to use each, communication patterns, and failure recovery.

Multi-AgentLLMArchitectureOrchestration
March 15, 2025
MLOps11 min read

MLOps Pipeline from Scratch: CI/CD for ML Models

How to build a complete MLOps pipeline — data versioning with DVC, experiment tracking with MLflow, model registry, automated retraining, and deployment gates.

MLOpsDVCMLflowCI/CD
March 22, 2025
MLOps8 min read

Detecting Model Drift in Production Before It Kills Your KPIs

Data drift vs concept drift — detection methods, monitoring dashboards with Evidently AI, and automated alerting strategies for production ML systems.

Model DriftMonitoringEvidently AIProduction
February 10, 2025
MLOps7 min read

Deploying ML Models with FastAPI: A Production Checklist

From model pickle to production FastAPI — async inference, input validation with Pydantic, rate limiting, health checks, and Docker deployment.

FastAPIDockerDeploymentREST API
January 30, 2025
Machine Learning9 min read

My Kaggle Competition Strategy: From Bronze to Gold

The exact workflow I follow in every Kaggle competition — EDA, baseline, feature engineering sprints, ensemble building, and the final push before deadline.

KaggleCompetitionStrategyEnsemble
February 20, 2025
Machine Learning9 min read

Time Series Forecasting at Scale: From ARIMA to LightGBM

When classical time series methods work and when ML wins — feature engineering for time series, backtesting frameworks, and handling seasonality in production.

Time SeriesForecastingLightGBMProphet
January 5, 2025
Machine Learning13 min read

DQN from Scratch: Teaching an Agent to Play Snake

A complete from-scratch DQN implementation in PyTorch — environment, replay buffer, epsilon-greedy exploration, and the training loop that actually converges.

Reinforcement LearningDQNPyTorchGame AI
January 18, 2025
Computer Vision8 min read

Face Recognition in Production with InsightFace

End-to-end face recognition system — face detection, alignment, embedding extraction with ArcFace, and sub-millisecond search with Faiss.

Face RecognitionArcFaceInsightFaceFaiss
December 20, 2024
Computer Vision7 min read

Image Classification with EfficientNet: Transfer Learning Best Practices

How to fine-tune EfficientNet for custom image classification — unfreezing schedules, augmentation, label smoothing, and getting the most out of small datasets.

EfficientNetTransfer LearningImage ClassificationPyTorch
December 5, 2024
Generative AI10 min read

Training GANs That Don't Collapse: Lessons from DCGAN to StyleGAN

GAN training tricks that prevent mode collapse and training instability — spectral normalization, progressive growing, gradient penalty, and architecture lessons.

GANDCGANStyleGANPyTorch
November 20, 2024
Data Engineering7 min read

Pandas at Scale: 10 Optimizations for Large DataFrames

From 10 minutes to 30 seconds: downcasting dtypes, vectorization, Dask fallback, and avoiding the most common Pandas performance traps.

PandasPerformanceData EngineeringMemory
December 28, 2024
Data Engineering8 min read

PostgreSQL as a Feature Store: Design Patterns for ML Pipelines

How to use PostgreSQL effectively as a feature store — materialized views for aggregations, partitioning for time series, and indexing strategies for ML queries.

PostgreSQLFeature StoreML PipelineSQL
November 15, 2024
Machine Learning9 min read

NEAT Algorithm: Evolving Neural Networks Without Backprop

How NEAT evolves both the weights and topology of neural networks — speciation, crossover, innovation numbers, and implementing it for game AI.

NEATNeuroevolutionGenetic AlgorithmGame AI
November 28, 2024
Machine Learning10 min read

Monte Carlo Tree Search: The Algorithm Behind AlphaGo

A clear explanation of MCTS — selection, expansion, simulation, backpropagation — with Python implementation for 2048 and game tree visualization.

MCTSGame AIAlphaGoTree Search
November 10, 2024
Machine Learning8 min read

Genetic Algorithms for Real-World Optimization Problems

Using genetic algorithms for feature selection, hyperparameter tuning, and scheduling — encoding strategies, selection methods, and convergence analysis.

Genetic AlgorithmOptimizationFeature SelectionEvolutionary Computing
October 25, 2024
AI Agents7 min read

Running LLMs Locally with Ollama: A Production Guide

Setting up Ollama for production use — model selection, API integration, performance tuning, and running Llama 3.1 on-premise for data privacy.

OllamaLLMLocal AILlama
April 18, 2025
AI Agents8 min read

Vector Database Showdown 2025: Pinecone vs Weaviate vs Qdrant vs Chroma

A practical benchmark of the top vector databases — indexing speed, query latency, filtering, scalability, and when to use each for RAG applications.

Vector DatabasePineconeQdrantRAG
February 14, 2025
MLOps6 min read

Docker for ML: Reproducible Environments and Multi-Stage Builds

Best practices for containerizing ML code — multi-stage builds, GPU support, model caching, and the Dockerfile patterns that cut image sizes by 70%.

DockerMLOpsContainersReproducibility
January 8, 2025
Machine Learning6 min read

Scikit-learn Pipelines: The Right Way to Build ML Workflows

Why you should wrap everything in an sklearn Pipeline — preventing data leakage, proper cross-validation, easy serialization, and custom transformers.

Scikit-learnPipelineData LeakageBest Practices
November 5, 2024
NLP6 min read

Text Embedding Models in 2025: Which to Use for RAG?

Benchmarking OpenAI, Cohere, E5, BGE, and Jina embeddings on retrieval tasks — MTEB scores, cost, latency, and multilingual support for Arabic and French.

EmbeddingsRAGMTEBMultilingual
March 8, 2025
Machine Learning8 min read

Anomaly Detection with Autoencoders: Better Than Rules, Cheaper Than Labels

Using autoencoders for unsupervised anomaly detection — reconstruction error thresholding, LSTM autoencoders for time series, and production deployment.

Anomaly DetectionAutoencoderUnsupervisedPyTorch
December 12, 2024
Deep Learning7 min read

GPU Training Optimization: Getting the Most from Your Hardware

GPU utilization, bottleneck diagnosis, DataLoader optimization, and CUDA memory management — practical techniques for training 2x faster without new hardware.

GPUCUDAPyTorchTraining
October 15, 2024
NLP9 min read

Sentiment Analysis for Arabic Text: BERT vs Traditional ML

Building a production sentiment classifier for Arabic customer reviews — dataset curation, preprocessing challenges, model comparison, and deploying with FastAPI.

Sentiment AnalysisArabic NLPBERTAraBERT
January 25, 2025
Computer Vision8 min read

Data Augmentation Strategies When You Have < 1000 Samples

Mixup, CutMix, AugMix, synthetic data with GANs, and test-time augmentation — what to use when your dataset is tiny and performance is critical.

Data AugmentationSmall DatasetsMixupCutMix
October 1, 2024
Machine Learning10 min read

ML System Design Interview: A Framework That Works

A structured approach to ML system design interviews — problem framing, data strategy, modeling choices, serving infrastructure, and monitoring.

System DesignML InterviewArchitectureProduction
February 5, 2025
NLP7 min read

NLP Text Preprocessing: The Complete Guide for 2025

Tokenization, normalization, stemming vs lemmatization, subword encoding — and when BERT's tokenizer is better than all of them combined.

NLPText PreprocessingTokenizationBERT
November 1, 2024
Machine Learning10 min read

Building a Recommendation System: From Collaborative Filtering to Neural CF

Matrix factorization, implicit feedback, and neural collaborative filtering — practical implementation and evaluation with RecSys metrics.

Recommendation SystemCollaborative FilteringMatrix FactorizationPyTorch
October 10, 2024
NLP8 min read

Production Speech-to-Text with Whisper: Moroccan Arabic Dialect Support

Deploying OpenAI Whisper for multilingual transcription — model selection, performance optimizations, and fine-tuning for Moroccan Darija.

WhisperSpeech-to-TextArabicMoroccan Darija
January 12, 2025
MLOps9 min read

Making Models 10x Smaller: Quantization, Pruning, and Knowledge Distillation

INT8 quantization, structured pruning, and distillation — how to shrink model size by 90% while keeping 95% of accuracy for edge deployment.

Model CompressionQuantizationPruningKnowledge Distillation
September 20, 2024

Need an AI engineer or data scientist?

I build custom ML models, AI agents, computer vision, and automation — from idea to production.