Skip to content

KushalRegmi61/AI_Fellowship_FuseMachines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 

Repository files navigation

Fusemachines AI Fellowship: Weekly Progress Log

Welcome to my 24-week journey through the Fusemachines AI Fellowship. This repository serves as a public log of my learning progress, challenges, and hands-on projects. Each week includes a short summary, key takeaways, and links to related code or notes.

Why this Fellowship?
I joined this program to sharpen my skills in AI/ML, build real-world projects, and grow with a learning community. This log helps me stay accountable and reflect on my growth.


CERTFICATE OF COMPLETION

image

CERTIFICATE VERIFICATION LINK: https://verifycertificates.fuseclassroom.com

LINKEDIN POST LINK: CLICK HERE


Table of Contents


Weekly Learning Logs

Week 1: Introduction to AI/ML

Pre-Session Prep

  • Intermediate Python: Lists, Tuples, Dictionaries, Sets, Strings, Collections, Itertools, Lambda, Exceptions, Logging, JSON, Decorators, Generators, Threading & Multiprocessing
  • Mathematics: Linear Algebra, Matrix Calculus, Probability Theory
  • AI/ML: Applications, typical ML workflow

Live Session Recap

  • Discussed AI evolution, real-world impact, and fellowship roadmap

Post-session Work

  • Created a personalized learning plan and defined focus areas

Key Insight

I learned that setting clear goals early helped me stay focused and intentional throughout the program.


Week 2: 12-Factor App for Machine Learning Systems

Pre-Session Prep

  • Git basics, project templates with Cookiecutter, and Python ML libraries
  • Topics included:
    • 12-Factor App methodology
    • REST APIs with FastAPI
    • Async programming
    • Logging and debugging
    • Docker containerization

Live Session Recap

  • Applied 12-Factor principles to real ML system design
  • Explored deployment-ready architecture and development best practices

Post-session Work

I built a FastAPI microservice applying as many 12-Factor principles as possible, focusing on structure, clarity, and portability.

Implementation Details:
GitHub – Explore Cafe API

Key Insight

I realized that engineering best practices are essential to turn ML projects into reliable, scalable systems.


Week 3: Data Wrangling Pandas and SQL

Pre-Session Prep

  • Pandas basics and SQL queries: filtering, joins, aggregation
  • Data validation with Pydantic and real-world data cleaning scenarios

Live Session Recap

  • Worked through hands-on challenges integrating Pandas and SQL for real-world data analysis

Post-session Work

  • Completed 20 SQL queries involving customers, employees, subqueries, ranking, and data updates
  • In Pandas: created/loaded datasets, cleaned and transformed them, and ran exploratory analysis on product ratings

Implementation Details:
GitHub – Data Wrangling with SQL and Pandas

Key Insight

I found that combining SQL and Pandas made data cleaning and analysis much more efficient and flexible.


Week 4: Data Visualization and Presentation

Pre-Session Prep

  • Studied visualization types, chart selection, layout, typography, and ethical design
  • Explored libraries including Altair, Matplotlib, Plotly, and Seaborn

Live Session Recap

  • Practiced exploratory vs explanatory visualization techniques
  • Built and evaluated charts for 1D, 2D, and multi-dimensional datasets

Post-session Work

  • Analyzed and visualized the Seaborn Tips dataset with exploratory and explanatory approaches
  • Focused on clarity, relevance, and ethical presentation of data insights

Implementation Details:
GitHub – Data Visualization

Key Insight

I learned how effective visual storytelling can make insights clearer and more impactful.


Week 5: Linear Models

Pre-Session Prep

  • Linear and polynomial regression
  • Performance metrics: R², RMSE
  • MLE and least squares
  • Regularization: Lasso, Ridge, ElasticNet
  • Logistic regression: binary, multiclass (OvR, OvO)
  • Optimization: gradient descent for simple and multiple models

Live Session Recap

  • Implemented real-world linear model use cases
  • Interpreted model coefficients and compared regularized vs non-regularized models

Post-session Work

Using a student performance dataset:

  1. Regression Modeling: Predicted final grades (G3) using linear regression, evaluated with R² and RMSE
  2. Classification Task: Predicted pass/fail outcomes with logistic regression using accuracy, precision, recall, and F1-score

Key steps:

  • Feature selection using correlation heatmaps
  • Categorical encoding
  • Performance benchmarking with dummy classifiers

Implementation Details:
GitHub – Linear Models

Key Insight

I saw how linear models, despite their simplicity, offer both predictive power and interpretability.


Week 6: Beyond Linear Models

This week focused on Beyond Linear Models: Discriminative and Generative Techniques, covering non-linear, interpretable classifiers and probabilistic methods beyond the limitations of linear decision boundaries.

Pre-Session Prep

  • Decision Trees: impurity metrics (Gini, Entropy), continuous variable handling, pruning, early stopping
  • K-Nearest Neighbors (KNN): classification, regression, distance metrics (Brute Force, KD-Tree, Ball Tree)
  • Naive Bayes: conditional independence, probabilistic modeling, sentiment analysis
  • Support Vector Machines (SVM): margin maximization, kernel methods (linear, RBF, polynomial), C-SVM, ν-SVM

Live Session Recap

  • Compared tree-based models with linear baselines
  • Demonstrated pruning and interpretability techniques

Post-session Work

Using a hotel booking dataset:

  1. Classification Task: Predicted booking cancellations (is_canceled) with a Decision Tree Classifier

    • Evaluated using accuracy, confusion matrix, and classification report

Key steps:

  • Imputing missing variables
  • Label encoding of categorical variables
  • Hyperparameter tuning (max_depth, min_samples_split)
  • Early stopping to prevent overfitting
  • Comparison of full vs shallow tree performance

Detailed Repo For Week_6:
Beyond Linear Models

Key Insight

I explored how models like SVM, KNN, Naive Bayes, and Decision Trees offer flexible, interpretable, and often more effective alternatives to linear models across diverse tasks.


Week 7: Ensemble Learning and Optimization Strategies

Overview This week I Covered ensemble learning techniques—Bagging, Boosting (AdaBoost, Gradient Boosting, XGBoost)—to improve model accuracy and generalization. Also focused on hyperparameter tuning with GridSearchCV and RandomizedSearchCV.

Pre-Session Prep

  • Reviewed bias–variance decomposition and its implications
  • Studied Bagging, Random Forest, AdaBoost, Gradient Boosting, and XGBoost
  • Covered model tuning strategies and validation techniques

Live Session Recap

  • Compared Bagging vs Boosting approaches
  • Discussed XGBoost internals: second-order optimization, regularization, shrinkage
  • Demonstrated tuning with scikit-learn pipelines

Post-Session Work

  • Implemented Decision Tree, Random Forest, AdaBoost, GradientBoost, and XGBoost
  • Applied GridSearchCV and RandomizedSearchCV for hyperparameter tuning
  • Evaluated and compared performance improvements using ensemble methods

Detailed Repo For Week_7:
Ensemble Learning and Optimization Strategies

Key Insight Ensemble learning reduces bias and variance. When combined with proper tuning, it leads to scalable, accurate, and production-ready models.


Week 8: Feature Engineering and ML Pipelines

Overview This week I Focused on designing high-quality features and building reusable ML pipelines. Covered techniques for transforming, selecting, and extracting features from various data types (text, images, time), handling outliers and imbalanced datasets, and implementing robust workflows using scikit-learn pipelines.

Pre-Session Prep

  • Introduced the importance of feature engineering and types of features (numerical, categorical, datetime, text, image)
  • Explored encoding methods (OHE, label, target), scaling techniques (standard, robust, min-max), and mathematical transformations
  • Studied feature selection methods: Filter (chi2, ANOVA), Wrapper (forward/backward), and Embedded (Lasso, tree-based)

Live Session Recap

  • Demonstrated feature extraction using regex (text) and datetime processing
  • Covered outlier detection techniques (Z-score, IQR, DBSCAN, Isolation Forest) and imbalance handling methods (SMOTE, cost-sensitive learning)
  • Explained ML workflow structuring using Pipeline(), FunctionTransformer(), and ColumnTransformer()

Post-Session Work

  • Created features from structured, textual, and image data using domain-specific transformations
  • Implemented pipelines to chain encoding, scaling, and model training using scikit-learn
  • Balanced imbalanced datasets using hybrid sampling methods (SMOTE+ENN) and built cost-sensitive classifiers

Detailed Repo For Week_8:
Feature Engineering and ML Pipelines

Key Insight Good features often matter more than the model itself. Structured pipelines not only ensure clean workflows but also simplify reproducibility and real-world deployment.


Week 9: Time Series Forecasting

Overview

This week I Focused on classical time series forecasting using univariate AQI data. Covered decomposition, stationarity checks, model identification via ACF/PACF, and model evaluation with time-aware validation strategies.

Pre-Session Prep

  • Introduced time series concepts: trend, seasonality, cyclicality, and noise
  • Explained additive vs multiplicative decomposition
  • Covered stationarity, transformations (log, power, differencing) to achieve stationarity, and ADF test
  • Explored ACF and PACF for ARIMA parameter selection
  • Discussed univariate vs multivariate forecasting models

Live Session Recap

  • Demonstrated resampling and seasonal-trend decomposition
  • Covered models: Naive, Holt-Winters, and ARIMA
  • Explained time series cross-validation: expanding vs sliding windows
  • Evaluated forecasts using MAE, RMSE, and residuals

Post-session Work

  • Built a 7-day AQI forecast system for Kathmandu using ARIMA
  • Interpolated missing values, ensured stationarity, and applied ADF test
  • Selected best ARIMA model (ARIMA(1,1,1)) via MAE, MAPE
  • Re-trained on full dataset to forecast AQI for July 24–30, 2025

Detailed Repo For Week_9:
Kathmandu AQI Forecasting

Key Insight Classical time series models like ARIMA can provide strong baseline forecasts if stationarity is ensured and seasonality is well-understood.


Week 10: Unsupervised ML Techniques

Overview

This week I Focused on discovering patterns in unlabeled data with clustering methods and association rule mining. Covered KMeans, hierarchical clustering, K-Prototypes, and market basket analysis for customer insights.

Pre-Session Prep

  • Reviewed supervised vs. unsupervised learning and clustering types
  • Studied KMeans assumptions, linkage methods, and Lance-Williams formula
  • Covered K-Prototypes for mixed data and association rule metrics (support, confidence, lift)

Live Session Recap

  • Implemented and evaluated KMeans using inertia and silhouette scores
  • Visualized dendrograms; applied agglomerative clustering
  • Discussed use cases in segmentation, anomaly detection, and recommendations

Post-session Work

  • Scaled numerical features after outlier handling
  • Selected optimal K for KMeans with elbow and silhouette methods
  • Built and interpreted hierarchical clusters from linkage matrix
  • Clustered full data with K-Prototypes after imputing missing categories
  • Applied association rule mining on shopping data to find frequent itemsets and buying patterns

Detailed Repo For Week_10:
Unsupervised Learning & Market Basket Analysis

Key Insight
Unsupervised methods reveal hidden data structures essential for segmentation and pattern discovery, driving actionable business decisions.


Week 11: Image Processing and Feature Extraction

Overview

This week I Covered essential image enhancement, segmentation, and feature extraction techniques foundational to computer vision.

Pre-Session Prep

  • Image enhancement with point operations and histogram equalization
  • Segmentation using masking and thresholding
  • Filtering, denoising, resizing, and interpolation

Live Session Recap

  • Applied enhancement, segmentation, filtering, resizing, and morphological operations
  • Performed feature detection and matching with Harris and SIFT

Post-session Work

  • Enhanced and segmented images; applied smoothing and sharpening filters
  • Resized images and refined masks with morphological transforms
  • Extracted and matched features using Harris corner and SIFT algorithms

Detailed Repo For Week_11:
Image Processing & Feature Extraction

Key Insight
Fundamental image processing techniques are critical for preparing visual data and enabling reliable feature extraction in computer vision models.


Week 12: Deep Neural Networks

Overview This week I built strong foundations in neural networks, explored optimization and regularization techniques, and applied them on the FashionMNIST dataset using PyTorch.

Pre-Session Prep

  • Computational graphs and backpropagation
  • Activation functions (ReLU, Sigmoid, Tanh)
  • Weight initialization: Xavier, He, LeCun
  • Optimization methods: SGD, Momentum, Adam, RMSProp
  • Normalization: Standardization, BatchNorm, LayerNorm
  • Regularization: L1/L2, Dropout, Early Stopping, Weight Decay
  • Hyperparameter tuning: LR scheduling, search strategies

Live Session Recap

  • Built and trained feedforward neural networks from scratch in PyTorch
  • Compared optimization methods and their convergence behavior
  • Explored normalization and regularization for stability and generalization

Post-Session Work (FashionMNIST)

  • Designed fully connected networks for FashionMNIST classification
  • Experimented with different activation functions
  • Applied Xavier, He, and LeCun initialization and compared results
  • Trained with SGD, Momentum, RMSProp, and Adam optimizers
  • Implemented BatchNorm and LayerNorm for performance boost
  • Used Dropout, Early Stopping, and Weight Decay for regularization
  • Tuned learning rates and hyperparameters systematically
  • Evaluated model performance and visualized accuracy/loss curves

Detailed Repo For Week_12:
Neural Networks & FashionMNIST

Key Insight

Building and optimizing neural networks is an iterative process of experimentation. Applying different initializations, optimizers, and regularization strategies on FashionMNIST highlighted how each design choice impacts learning stability and model accuracy.


Week 13: Foundations of Large Language Models-From Basics to Embeddings

Overview Focused on the foundations of LLMs, transformer architecture, and practical steps like tokenization, embeddings, and data handling.

Key Learnings

  • LLM basics: pretraining vs finetuning, BERT vs GPT
  • Transformer architecture: encoder-decoder, attention
  • GPT training: autoregressive, self-supervised learning
  • Token vs positional embeddings for semantic meaning and sequence order

Hands-On Work

  • Built a tokenizer and implemented Byte Pair Encoding (BPE)
  • Created input-target pairs using PyTorch Dataset/DataLoader
  • Implemented absolute positional embeddings and combined them with token embeddings

Repo: LLMs-from-scratch

Key Insight Moving from theory to implementation helped me understand how raw text becomes structured input for LLMs, strengthening both conceptual and practical foundations.


Week 14: Attention Mechanism in LLMs

Overview

This week was focused on the mathematical foundations and implementations of attention mechanisms, including self-attention, causal attention, and multi-head attention which are the core of modern LLMs.

Key Learnings

  • Why attention is needed: solves RNN’s long-term dependency issue.
  • Attention scores vs attention weights: raw similarity vs normalized probabilities.
  • Scaling by √d: stabilizes softmax and prevents peaky distributions.
  • Context vector: weighted sum of values, conditioned on query relevance.
  • Bahdanau vs Scaled Dot-Product: additive vs efficient dot-product attention.
  • Self-attention: each token attends to every other token.
  • Causal attention: masking ensures autoregressive prediction.
  • Multi-head attention: captures multiple dependency patterns in parallel.

Hands-On Work

  • Implemented scaled dot-product attention in PyTorch from scratch.
  • Verified dimensional flows and tensor operations step by step.
  • Built trainable self-attention, causal attention with masking, and multi-head attention with output projection.
  • Understood the full math pipeline from Q, K, V to final context vectors.

Repo: LLMs-from-scratch

Key Insight
Beyond coding, I gained a full mathematical and conceptual grasp of how attention distributes focus, why normalization matters, and how multi-head extensions enrich contextual understanding — making it the true “engine” of LLMs.


Week 15: Implementing GPT-2 from Scratch

Overview

This week I reconstructed GPT-2 from scratch, covering every block from embeddings to the autoregressive training loop. The focus was on understanding the mathematical design, the tensor dimensions at each stage, and why GPT-2’s architecture enables scalable large language models.

Key Learnings

  • Token + Positional Embeddings: how discrete tokens are mapped into continuous vector space with learned positional context.
  • LayerNorm placement: stabilizes training and controls activation scales across deep networks.
  • Multi-Head Causal Attention: parallel attention heads with masking to preserve autoregressive flow.
  • Feedforward Blocks: non-linear transformations that enrich token representations.
  • Residual Connections: critical for gradient flow and stable scaling.
  • Training loop: autoregressive loss, tokens-seen tracking, and periodic evaluation.
  • Dimension consistency: verified shapes through embeddings → attention → feedforward → logits.
  • Scaling insight: design choices here are what make billion-parameter models possible.

Hands-On Work

  • Implemented GPT-2 architecture in PyTorch block by block.
  • Rebuilt the causal attention mechanism with proper masking and projections.
  • Trained the model with custom loop including validation evaluation.
  • Debugged dimension mismatches and confirmed tensor flows end-to-end.
  • Experimented with optimizer, context length, and evaluation frequency.

Repo: LLMs-from-scratch

Key Insight
By coding GPT-2 line by line, I moved beyond “black-box” usage into fully grasping how embeddings, attention, normalization, and residual pathways combine to form a scalable transformer. This clarified why GPT-2 was the turning point for modern LLMs.


Week 16: Fine-Tuning GPT-2 for Text Classification

Overview
This week I adapted GPT-2 (124M) from a generative model into a spam classifier. The workflow covered dataset preparation, preprocessing, DataLoader design, model modification, and selective fine-tuning of transformer layers. The focus was on applying transfer learning principles to repurpose LLMs for supervised classification tasks.

Key Learnings

  • Dataset preparation: balanced spam/ham, label encoding, and proper train/val/test splits.
  • Tokenization & padding: standardized sequence length for stable gradients and efficient batching.
  • DataLoader engineering: ensured each batch contained uniform token counts.
  • Classification head: replaced GPT-2’s 50,257-dim output with a 2-class linear layer (generalizable to multi-class).
  • Selective fine-tuning: last transformer block + final LayerNorm trainable, earlier layers frozen.
  • Training dynamics: accuracy improved from ~46% baseline to 97% (train/val) and 95% (test) within 5 epochs.
  • Evaluation insight: validation accuracy slightly above test set; minimal overfitting, tunable with dropout/weight decay.

Hands-On Work

  • Implemented SpamDataset for tokenization, truncation, padding, and batching.
  • Loaded pretrained GPT-2 weights in PyTorch.
  • Added binary classification head.
  • Trained with AdamW (lr=5e-5, weight_decay=0.1) using cross-entropy loss.
  • Visualized loss and accuracy curves; confirmed synchronized decline and convergence.
  • Built classify_review function to preprocess text and return predicted labels.

Repo: LLMs-from-scratch

Key Insight
Even modest-sized LLMs like GPT-2 (124M) can achieve near-production accuracy on classification with careful preprocessing, selective layer training, and evaluation. Fine-tuning bridges research LLMs with practical, domain-specific applications like spam detection, sentiment analysis, and grievance routing.


Week 17: Instruction Fine-Tuning GPT-2 (355M)

Overview
This week I transformed GPT-2 (355M) from a generic text generator into an instruction-following assistant. Using ~1.1k Alpaca-style instruction-response pairs, the model learned to interpret human instructions and produce task-aligned outputs. The workflow covered dataset preparation, causal language modeling, full fine-tuning of all transformer layers, and structured evaluation, emphasizing practical alignment over raw scale.

Key Learnings

  • Dataset preparation: Alpaca-style JSON with {instruction, input, output}, proper train/validation/test splits.
  • Causal LM setup: each token predicts the next (inputs[:-1] → targets[1:]), pad tokens masked to stabilize loss.
  • Full fine-tuning: updated all 355M parameters using AdamW (lr=5e-5, weight_decay=0.1), achieving rapid convergence in a few epochs.
  • Evaluation strategy: combined MMLU (multi-domain reasoning), human evaluation (correctness, helpfulness, safety), and automated scoring via Meta-Llama-3-8B-Instruct; model scored 53.79/100.
  • Training dynamics: train loss collapsed from 4.197 to 0.17, validation stabilized ~0.70; rapid early convergence is expected with small datasets.
  • Practical insight: small models can achieve instruction alignment without massive compute; multi-seed and checkpoint evaluation improve stability.

Hands-On Work

  • Preprocessed dataset with tokenization, truncation, padding, and dynamic batching.
  • Loaded GPT-2 weights in PyTorch and trained with causal LM objective.
  • Saved outputs in JSON for reproducible human and automated evaluation.
  • Loss curves visualized smooth convergence, confirming stable learning.
  • Setup designed for future PEFT experiments (LoRA, QLoRA) and richer datasets.

Repo: LLMs-from-scratch

Key Insight
Instruction fine-tuning turns GPT-2 into a task-aligned assistant capable of reasoning over prompts, demonstrating that alignment and evaluation matter more than model scale. This approach provides a baseline for practical AI applications such as chatbots, civic grievance systems, and domain-specific assistants.


Week 18: Multilingual Grievance Department Classification with XLM-RoBERTa

Overview This week I built a full pipeline to classify Nepali and English civic grievances into departments. The workflow included data cleaning, bilingual augmentation, XLM-RoBERTa fine-tuning, focal vs cross-entropy loss comparison, experiment tracking, versioning, and deployment with FastAPI, Pydantic, Docker, and Hugging Face Spaces.

Key Learnings

  • Dataset prep: cleaned, encoded, and balanced bilingual data with augmentation.
  • Model fine-tuning: xlm-roberta-base, batch_size=16, lr=2e-5, 3 epochs, mixed precision.
  • Loss comparison: focal loss emphasizes hard/minority samples, improving rare-class performance over standard cross-entropy.
  • Experiment tracking & versioning: TensorBoard logs and HF Hub automated uploads with metadata and version tags.
  • Deployment: FastAPI backend with Pydantic validation, Dockerized, hosted on HF Spaces.

Hands-On Work

  • Preprocessed dataset and applied bilingual augmentation.
  • Fine-tuned model, monitored loss, accuracy, F1.
  • Tested focal vs cross-entropy; rare-class predictions improved.
  • Integrated TensorBoard tracking and automated HF Hub logging.
  • Built production-ready deployment pipeline on HF Spaces.

Repo: Private; Only Limited within Fellowship

Key Insight Focal loss + bilingual augmentation + end-to-end deployment ensures accurate, robust, and production-ready grievance classification.


Week 19: Continuous Learning System for Sambodhan AI

Overview
This week I developed a continuous learning pipeline that automatically updates Sambodhan’s Urgency and Department classifiers using real-world feedback. The system combines automated dataset preparation and model retraining on Hugging Face Spaces, fully tracked via Weights & Biases.

Key Learnings

  • Dataset Pipeline: Fetches misclassified data from PostgreSQL, cleans, splits, and pushes versioned datasets to the HF Hub.
  • Retraining Pipeline: Loads latest dataset, trains with Focal Loss + early stopping, auto-deploys only if F1-macro improves.
  • Tracking & Deployment: All runs logged in W&B; retrained weights deployed seamlessly with FastAPI backend.
  • Efficiency: Both Spaces Dockerized with auto-pause to save compute and email notifications on completion.

Hands-On Work

  • Automated end-to-end retraining flow from data fetch to deployment.
  • Integrated W&B tracking, HF Hub versioning, and metric-based deployment gating.
  • Verified performance consistency and data integrity across retraining cycles.

Repo: Private; Only Limited within Fellowship

Key Insight
Continuous learning ensures Sambodhan’s AI evolves safely and intelligently—each retrain is measurable, traceable, and genuinely better than the last.


Week 20: Continuous Learning Orchestration + Demo Video

Overview
This week, I developed Sambodhan’s CI/CD orchestrator to automate the loop from data → dataset → retraining → deployment and created a short demo video showcasing the workflow.

Key Implementations

  1. Orchestrator

    • Monitors misclassification counts from PostgreSQL and triggers dataset rebuilding only when thresholds are exceeded.
    • Polls Hugging Face Hub for updated dataset versions and restarts retraining Spaces automatically.
    • Logs all steps in GitHub Actions for full observability.
      Key Takeaway: Ensures models remain accurate, reliable, and resource-efficient.
  2. Demo Video

    • Demonstrates the end-to-end project functioning.
      Key Takeaway: Communication and presentation skills are as critical as technical engineering for conveying complex pipelines.

Personal Reflection
This week reinforced that impactful AI engineering is about building robust, auditable systems while effectively communicating them to stakeholders.

DEMO VIDEO: watch it here


Week 21: Engineering RAG Ingestion for Nutritional Chatbot

Overview This week I focused on engineering the ingestion layer for a RAG-based Nutritional Chatbot built on a 1,200-page nutrition textbook. Instead of relying on high-level text splitters, I implemented several chunking algorithms from scratch to understand how document segmentation affects retrieval quality, hallucination control, and overall system reliability in production.

Key Learnings

  • EDA on corpus revealed token distribution mismatches that could silently truncate pages during embedding and retrieval.
  • Fixed-size chunking is predictable but breaks semantic structure.
  • Semantic and LLM-based chunking preserve meaning but introduce fragmentation and high compute cost.
  • Recursive chunking offers the best engineering trade-off: structurally aware, token-safe, and computationally balanced.

Hands-On Work

  • Implemented five chunking algorithms: fixed, structure-based, semantic, recursive, and LLM-assisted.
  • Benchmarked output quality, variance, and token lengths across 1,200 pages.
  • Compared accuracy vs cost trade-offs and identified recursive chunking as the most production-ready approach.
  • Evaluated extraction tooling for different document formats (PyMuPDF, Tesseract, Dockling).

Repo: Repo Link

Key Insight Many RAG systems fail not at retrieval but during ingestion. If engineers cannot trace how documents are sliced, retrieval errors and hallucinations become impossible to debug. Understanding the ingestion pipeline at the algorithmic level is a prerequisite for production-grade RAG.


Week 22: End-to-End RAG Nutrition Chatbot with Evaluation

Overview
This week I completed a fully working RAG chatbot for nutritional question answering with a complete pipeline: ingestion, chunking, embedding, vector storage, UI interaction, LLM generation, and quantitative evaluation using Ragas. The system processes a 1200-page textbook and delivers answers through a Next.js interface deployed on Google Antigravity.

Key Learnings

  • Fixed chunking with overlap helps preserve semantic continuity but still loses some conceptual structure across page boundaries.
  • Hosting a custom embedding model (Qwen3-Embedding-0.6B) as a Dockerized FastAPI service on Hugging Face Spaces provides full control and avoids external embedding API cost.
  • Since the dataset has fewer than 100k embeddings, storing vectors directly in Supabase PostgreSQL with pgvector simplifies sync between relational data and vector search.
  • Ragas metrics revealed that retrieval is excellent, but generated answers are not grounding properly in the retrieved context.

Hands-On Work

  • Built ingestion with fixed overlapping chunks and stored all results in Supabase.
  • Deployed custom embedding inference endpoint through HF Spaces FastAPI service.
  • Added Next.js UI for user queries and Groq-backed LLM responses.
  • Performed structured evaluation using Ragas on four key metrics.

Repo: Repo Link

Key Insight
RAG systems often fail not in embedding or retrieval but in how the documents are chunked and how effectively the model grounds responses. Automated evaluation made the weaknesses visible, making future improvements data-driven.


LinkedIn Recaps

About

Crafting top-tier AI/ML skills through 24 weeks of hands-on projects and experiments.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors