United University Students: Debugging a Failing Model, a Troubleshooting Flowchart for AI Interns

United University Students: Debugging a Failing Model, a Troubleshooting Flowchart for AI Interns

Facebook
Twitter
LinkedIn
WhatsApp
Email

When a model performs badly, debug it in a fixed order: check the data first, then look for leakage, then compare against a trivial baseline, then diagnose underfitting versus overfitting, and only then tune the learning rate and other settings. Most failures in student projects come from the first three steps, not from the algorithm. The flowchart below turns that order into a routine you can run in a single sitting.

Why a fixed order beats random tweaking

A common intern habit is to change the model whenever accuracy disappoints: swap a random forest for a neural network, add layers, try another optimiser. This wastes days because you never learn what was actually wrong. Each change also muddies the picture, since you cannot tell which edit helped.

A fixed order works because problems upstream hide problems downstream. If your labels are wrong, no learning rate will fix it. If a feature leaks the answer, your validation score looks wonderful and the model collapses on new data. Debugging from the data outward means every later step stands on something you have already checked.

Two habits make the whole process work:

  • Change one thing at a time and record the result in a simple log (date, change, metric before, metric after).
  • Fix the random seed and the split while you debug, so differences in scores come from your change and not from luck.

The troubleshooting flowchart for a failing model

Read this top to bottom. Stop at the first step where you find a problem, fix it, re-run, and restart from that step. Each stage is a yes/no question.

START: metric is poor or suspicious
  |
  v
[1] Does the pipeline run end to end on a tiny sample (say 50 rows)?
  NO  -> fix shapes, dtypes, loading, label encoding. Then restart.
  YES
  |
  v
[2] Is the data sound? (labels correct, no duplicates, sensible ranges,
    missing values handled, classes counted)
  NO  -> clean, relabel, deduplicate, impute. Then restart.
  YES
  |
  v
[3] Is there leakage? (future info, target-derived features, IDs,
    preprocessing fitted before the split, duplicates across splits)
  YES -> remove or rebuild the feature; split first, then fit
         preprocessing on train only. Restart.
  NO
  |
  v
[4] Does the model beat a trivial baseline (majority class / mean /
    simple linear or logistic model)?
  NO  -> the problem is the data or the features, not the model.
         Return to [2], then improve features.
  YES
  |
  v
[5] Can it overfit a tiny training subset (about 20-100 examples)?
  NO  -> bug in training loop, loss, labels, or learning rate far
         too low or high. Go to [7].
  YES
  |
  v
[6] Compare train vs validation score.
  Both poor            -> UNDERFITTING: richer features, bigger model,
                          train longer, lower regularisation.
  Train good, val poor -> OVERFITTING: more data, augmentation,
                          regularisation, simpler model, early stopping.
  Both good, test poor -> split mismatch or leakage; revisit [3].
  |
  v
[7] Is optimisation healthy? (loss falls smoothly; learning rate
    sensible; inputs scaled; gradients not exploding or vanishing)
  NO  -> adjust learning rate, scaling, initialisation, batch size.
  YES
  |
  v
[8] Is the metric right for the problem? (accuracy on imbalanced data,
    threshold, per-class results, confusion matrix)
  NO  -> switch to precision/recall/F1/AUC or tune the threshold.
  YES -> inspect errors by hand; log findings; iterate on features.

Free 2-Week CareerSwami Internship

Online, 14 days, with a free offer letter and a free completion certificate once you finish the work. Check with your college that it fits your requirement before you enrol.

Apply for the free internship

Step 1 and 2: sanity-check the pipeline and the data

Run a tiny end-to-end test

Before training anything seriously, push 50 rows through loading, preprocessing, training and prediction. If this fails or gives nonsense, you have a plumbing bug. Typical culprits are mismatched array shapes, labels stored as strings in one place and integers in another, and image or text inputs that were never normalised.

Audit the data itself

Spend real time here. A short checklist:

  • Class balance: count each label. A 95/5 split makes 95% accuracy meaningless.
  • Label quality: read 30 random rows by hand. Are the labels actually right?
  • Duplicates: exact or near-duplicate rows inflate scores when they appear in both train and validation.
  • Missing values: how many, in which columns, and how were they filled?
  • Ranges and units: ages of 400, negative prices, or mixed units (cm and inches) signal entry errors.
  • Distribution shift: does the training data resemble what the model will meet later?

Step 3: how to find data leakage

Leakage means the model sees information during training that it would not have at prediction time. It is the most dangerous failure because it makes results look excellent. If your score seems too good, suspect leakage before celebrating.

  • Target-derived features: a column computed from, or recorded after, the outcome (for example, “refund issued” when predicting complaint severity).
  • Preprocessing before splitting: scaling, imputing or selecting features on the full dataset lets validation statistics seep into training. Split first, then fit transformers on the training set only.
  • Time leakage: random splits on time-ordered data let the model learn from the future. Split by date instead.
  • Group leakage: the same patient, user or document appearing in both train and test. Split by group.
  • ID-like columns: row numbers or file names that correlate with the label.

A quick test: look at feature importances or coefficients. If one feature dominates absurdly, ask whether it would really exist at prediction time. Another test: drop that feature and see if the score falls to something believable.

Step 4 and 5: baselines and the tiny-subset overfit test

A baseline gives your number meaning. For classification, predict the majority class; for regression, predict the training mean. Then fit a plain logistic or linear model. If your complex model barely beats these, the signal in your features is weak, and tuning the model will not rescue it.

The tiny-subset test is a powerful bug detector. Take 20 to 100 training examples and try to drive training loss close to zero. A healthy model and loop can memorise a handful of rows. If it cannot, something is broken: wrong loss for the task, labels misaligned with inputs, a frozen layer, a learning rate that is far too small or too large, or a missing activation or output layer.

Step 6: underfitting versus overfitting by reading the gap

Compare training and validation scores side by side. The gap tells you which way to move.

  • Both low: the model cannot capture the pattern. Add informative features, increase capacity, train longer, or reduce regularisation.
  • Training high, validation low: the model memorises. Collect more data, add augmentation, apply dropout or weight decay, simplify the model, or stop earlier.
  • Validation high, final test low: you may have tuned too much on validation, or the test set differs in distribution. Re-check the split and leakage.

Learning curves (score versus training set size) help: if validation keeps improving with more data, collect more; if both curves plateau low, improve features or the model.

Step 7: learning rate and optimisation diagnostics

For neural networks and gradient-boosted models, the learning rate is usually the first setting to check. Watch the loss curve:

  • Loss explodes or becomes NaN: learning rate too high, unscaled inputs, or unstable loss. Lower the rate by a factor of 10 and scale inputs.
  • Loss barely moves: learning rate too low, vanishing gradients, or a dead activation setup. Raise the rate gradually and check initialisation.
  • Loss zigzags: rate is a bit high or batch size is tiny. Lower the rate or use a schedule.
  • Loss falls, then validation rises: overfitting; use early stopping.

A simple search approach: try rates on a logarithmic grid (for example 1e-1, 1e-2, 1e-3, 1e-4) for a few epochs each and compare early loss curves. Only after this should you tune depth, width or regularisation.

Step 8: choose a metric that tells the truth

Accuracy hides failure on imbalanced data. If only 3% of transactions are fraud, a model that always says “not fraud” scores 97%. Use a confusion matrix, then precision, recall, F1 or area under the ROC or PR curve depending on the cost of each error. Also check performance per class and per subgroup, and tune the decision threshold rather than assuming 0.5.

Symptom-to-fix quick-reference table

Symptom Likely cause First check Typical fix
Accuracy near random guessing Label misalignment or broken pipeline Print 10 inputs with labels; run the 50-row test Realign labels, fix preprocessing
Validation score unbelievably high Leakage or duplicates across splits Feature importance; duplicate count between splits Remove leaky feature; split before preprocessing
High accuracy but useless predictions Class imbalance Label counts; confusion matrix Use F1/recall; class weights; resampling; threshold tuning
Train high, validation low Overfitting Train-validation gap; learning curves More data, regularisation, simpler model, early stopping
Train and validation both low Underfitting or weak features Baseline comparison Better features, larger model, longer training
Loss becomes NaN Learning rate too high; bad inputs Check for NaN/inf in data; scale inputs Lower learning rate; clip gradients; clean data
Loss flat from the start Rate too low; vanishing gradients; wrong output layer Tiny-subset overfit test Raise rate; change activation or initialisation
Good offline, poor on new data Distribution shift Compare feature distributions, old vs new Refresh data; retrain; time-based validation
Score changes a lot between runs Small data or unfixed seeds Re-run with several seeds Cross-validation; report mean and spread
Fails on one subgroup or class Under-representation Per-group metrics Collect or reweight data for that group

Worked example: diagnosing a failing churn model (illustrative)

This scenario is invented to show the flowchart in use; no code was run and the numbers are made up for teaching.

An intern builds a model to predict which telecom customers will leave. Validation accuracy is 96%, which looks great, but in a trial on fresh records it drops sharply.

  1. Step 1: the 50-row test runs cleanly.
  2. Step 2: label counts show 94% stayed and 6% churned. Accuracy of 96% is only slightly above the 94% a “never churns” rule would give. Flag: imbalance.
  3. Step 3: feature importance shows a column called “cancellation_reason” dominating. It is filled only after a customer cancels. That is target leakage. The intern removes it.
  4. Step 4: after removal, accuracy falls to 94.5%, barely above the majority baseline. The honest picture: the features carry little signal yet.
  5. Step 8: recall on churners is just 12%. The intern switches to recall and F1, adds class weights, and tunes the threshold.
  6. Next: engineered features (months since last plan change, number of support calls) lift churn recall in the log, and the intern records each change separately.

The lesson: the “failing” model was not the 94.5% one; the 96% one was the real failure, hidden by leakage and a misleading metric.

A 14-day plan for practising model debugging

If you are doing a short two-week project, such as the free two-week online internship at CareerSwami, schedule debugging deliberately rather than leaving it to the last day. One workable split:

  • Days 1-2: pick a dataset, define the metric, write the baseline.
  • Days 3-4: data audit: balance, duplicates, missing values, label spot-checks.
  • Days 5-6: first model, tiny-subset test, leakage review.
  • Days 7-9: diagnose fit using learning curves; apply one fix at a time.
  • Days 10-11: learning rate and optimisation sweeps, with a logged table of runs.
  • Days 12-13: error analysis by hand, per-class metrics, threshold tuning.
  • Day 14: write up the debugging log: what failed, what you changed, what improved.

The write-up matters as much as the score. A log that shows disciplined diagnosis is stronger evidence of skill than one lucky accuracy figure.

United University AI students: connecting debugging practice to your coursework

United University, Prayagraj was established in 2021 under a Uttar Pradesh act, according to its University Ordinances. The university’s syllabus page lists PDFs for several programmes close to this topic, including a BCA specialisation in Artificial Intelligence (IBM), B.Tech (Hons.) in CS with AI & ML, B.Tech (Hons.) in Cloud Computing & AI (IBM), CS with Data Science & Analytics, and MCA-IBM. If you are in one of these, the debugging routine above maps neatly onto any model-building assignment or mini project you do.

What the published material does not settle is how an outside internship fits your programme. The Ordinances say Summer Training, Project, Seminar and similar activities carry credits as stated in each programme’s details, but they give no duration, semester, evaluation scheme or online-internship rule. So do not assume a short online internship counts toward credit or a required training slot; the rules sit in your own programme documents. The Ordinances also leave exact dates to the Academic Calendar, and a tentative Semester I 2026-27 calendar is listed on the university’s news page; check its current version before planning your 14 days around exams.

The university’s placements page presents the Corporate Relations Cell as handling industry collaboration, training and placements, which makes it a sensible office to ask about internship documentation.

Verification steps for United University students before you start a model-debugging project

  1. Open the syllabus PDF for your programme and session and look for Summer Training, Project or Seminar entries; note their credits, semester and evaluation scheme.
  2. Ask your department coordinator in writing whether an online internship is accepted for that requirement, and what proof (offer letter, certificate, report) is needed.
  3. Open the current Academic Calendar and mark exams, recess and the Summer Term so your 14 days do not clash.
  4. Ask the Corporate Relations Cell whether a self-found internship needs prior registration or approval.
  5. Ask your AI or ML course instructor whether your debugging log can be used as a project or lab submission, and in what format.

Keeping a debugging log you can show to recruiters and faculty

A simple table is enough. Use these columns for every run:

  • Run number and date
  • Single change made
  • Seed and split used
  • Train, validation and baseline metric
  • Observation and next hypothesis

Keep notebooks reproducible: pin library versions, save the data split, and store the config for each run. Anyone reading the log should see why each decision was made.

Frequently Asked Questions

What should I check first when my model has poor accuracy?

Run the pipeline on about 50 rows, then audit the data: label correctness, class balance, duplicates and missing values. Most poor results trace back to these, not to the algorithm.

How do I know if my model is suffering from data leakage?

Suspect it when validation scores seem too good, one feature dominates importance, or performance collapses on fresh data. Check for features created after the outcome, preprocessing fitted before splitting, and duplicate rows or the same person across splits.

How can I tell underfitting from overfitting?

Compare training and validation scores. Both low means underfitting; high training with low validation means overfitting. Learning curves against training set size make the pattern clearer.

What learning rate should I start with?

There is no universal value, because it depends on the optimiser, model and input scaling. Try a logarithmic grid such as 1e-1 down to 1e-4 for a few epochs and compare loss curves, after scaling your inputs.

Why is my accuracy high but the model predicts nothing useful?

This is typical of imbalanced classes, where predicting the majority label scores well. Look at the confusion matrix and use recall, precision, F1 or PR-AUC, and consider class weights or threshold tuning.

Why does my score change every time I run the notebook?

Unfixed random seeds, small datasets and random splits all cause variation. Fix seeds while debugging, then use cross-validation and report the mean with its spread.

Can I use a short online internship project to practise this for my United University programme?

You can use the flowchart on any project, but whether an internship counts for your programme depends on your own syllabus PDF and department. Ask your coordinator in writing before assuming it satisfies any training or project requirement.

Is a debugging log really useful in interviews?

Yes, because it shows how you reason: what you suspected, what you tested and what changed. Keep it factual, with each run’s single change and its measured effect.

Related Artificial Intelligence guides

Ready to put this into practice?

Join the free two-week CareerSwami online internship in Artificial Intelligence. The internship, the offer letter and the completion certificate are free.

Start your free 2-week internship

Web Stories

Scroll to Top