Manan Arora
← All projectsML engineering · physics-guided ML

Battery Lifetime Prediction

Millions of EV batteries will retire with plenty of life left for grid storage, if you can tell which ones. I built a pipeline that predicts remaining lifetime from usage and physical degradation signals, training on a quarter of the expensive data.

Role
ML engineer · designed and built the pipeline
When
2025
Stack
Python · CatBoost · XGBoost · Optuna · scikit-learn
Target
Lifetime in equivalent full cycles
3.9%prelim.lifetime error (MAPE) on held-out batteries, training on 25% of the data
≤ 25%of the labelled data used for traininga hard cap, enforced by the search
3physical degradation modes as featuresLLI, LAM_PE, LAM_NE
01

Good predictions need data that is expensive to make

A retired EV battery might have years of useful life in stationary storage, or it might be close to failing. Testing each pack is slow and expensive, so the decision has to come from a model.

Two things make that hard. Purely data-driven models learn correlations that break on batteries used differently from the training set. And labelled lifetime data is costly to produce, whether from long cycling tests or heavy electrochemical simulation. So the questions were: which physical signals make the model generalize, and how little data can it learn from?

02

Small data in, checked at every step

Stage 1 of 6

Inputs

What: Statistics of each battery’s current profile (percentiles, mean, spread, skew, rest time, throughput, start voltage, charge fraction), plus three physical degradation modes: loss of lithium inventory (LLI) and loss of active material at each electrode (LAM_PE, LAM_NE).

Why: Usage tells the model how a cell was treated; degradation modes tell it what that did to the chemistry. The physics features carry the signal that a purely statistical model has to guess at.

Hover or tap a stage. Stages marked ↺ compare feature distributions against the full data before moving on.
03

Making the search space actually searchable

The subset search decides which of 53 data segments (9,650 samples) to train on, with at most 25% of the data allowed. The first version gave Optuna one include/exclude switch per segment. That’s 253 combinations, and since each switch is a coin flip, a typical trial picks about half the segments: far over the cap. Almost every trial was wasted.

I rewrote the search as two decisions: how many segments to take (k between 2 and 13, computed from the cap) and a priority score for every segment; the top-k are kept. Every trial is valid by construction, and Optuna’s TPE sampler can learn gradual preferences (“segment 17 tends to help”) instead of on/off guesses.

Before: include or exclude each segment2^53 possible masks
0 of 53 segments✗ over the cap
valid trials: 0 / 0
After: pick k, then the top-k by priorityk ∈ [2, 13] · always valid
0 of 53 segments✗ over the cap
valid trials: 0 / 0
IllustrativeA live simulation of the two search spaces with the real sizes. Rose = a trial that breaks the 25% cap.
04

How much data is enough?

Values tagged prelim. are placeholders, not yet measured on the final held-out set, and will be replaced with the real results.

02468020406080100% of labelled data used for trainingMAPE (%)MAPE on held-out data
MAPE on held-out data
IllustrativeLifetime error on held-out batteries as the training fraction grows (prelim.).
0%2%4%6%Physics-guided NN: 3.6%Physics-guided NN3.6%CatBoost: 3.9%CatBoost3.9%XGBoost: 4.4%XGBoost4.4%MLP (no physics features): 5.6%MLP (no physics features)5.6%
IllustrativeFinal candidates on the same held-out set (prelim.). Lower is better.

Why gradient-boosted trees for the surrogate: the data is small and tabular, where CatBoost and XGBoost are hard to beat and train in seconds, which matters inside a search loop that runs hundreds of trials.

What I took away: constraints belong in the parameterization, not the penalty. Make invalid states unrepresentable and the optimizer gets smarter for free.

Working on ML for energy, batteries or small-data problems? I’d like to hear about it.