You exported 160 historical batches from the ELN, loaded them into a gradient boosting model, and the cross-validated R² came back at 0.41. The model is not wrong because formulation chemistry is unpredictable. It is wrong because the columns you handed it do not describe the chemistry. Percent-by-weight columns that always sum to 100, raw material names typed three different ways, a mixing temperature buried in a free-text comment field: none of this is learnable as-is. Feature engineering is the step between "we have data" and "we have a formulation AI model that a formulator would trust," and on the small, messy datasets typical of chemical R&D it usually moves the needle more than the choice of algorithm does.
This article walks through seven techniques that formulation scientists and R&D data teams use most often, when each one helps, and the traps that make a model look good on screen and fail at the bench. Nothing here requires a PhD in statistics; most of it is chemical reasoning turned into columns.
Why formulation AI depends more on features than on algorithms
A formulation dataset is almost never big. A typical coatings, adhesives, or personal care lab has somewhere between 80 and 600 well-documented batches per product family, spread across years, with inconsistent columns and a handful of targets measured at different times. In that regime, XGBoost, Random Forest, and a neural network will all overfit if the inputs are noisy, and all three will do reasonably well if the inputs encode real chemical structure.
Consider an anonymized adhesives team with 212 batch records predicting peel strength. Trained on raw ingredient percentages and supplier names as plain text, their best model reached R² of 0.52 in cross-validation. After the ingredients were regrouped by function, two ratios were added, and the cure profile was converted from a comment string into numeric columns, the same algorithm reached 0.79 with no change to hyperparameters. The data had not grown; it had been translated.
If your records are not yet in a usable table at all, start with the guidance on how to structure your R&D data before using an AI platform, which covers the column-level cleanup that has to happen before any of the techniques below. The rest of this article assumes you have one row per batch with ingredients, process conditions, and measured outcomes.
Technique 1: Encode ingredients by function, not only by trade name
The most common failure in formulation ML is treating every trade name as an independent categorical variable. A dataset with 45 distinct raw materials across 160 batches gives the model 45 sparse columns, most of which appear in fewer than ten rows. The model cannot generalize from "Surfactant A at 2%" to "Surfactant B at 2%" because it has no idea they do the same job.
The fix is a two-level representation. Keep the trade name column for traceability, but add functional-class columns: total nonionic surfactant, total anionic surfactant, total plasticizer, total rheology modifier, total active, and so on. Each is simply the sum of the percentages of ingredients in that class. In the adhesives example above, this single step collapsed 38 ingredient columns into 9 functional columns plus a few key individual ingredients that the chemists insisted mattered on their own. A model trained on functional totals can make sensible predictions for a new raw material it has never seen, as long as the material is tagged with the correct class.
Where a structure-aware descriptor is available (a SMILES string or a supplier-provided HLB, molecular weight, or acid number), add it as a numeric property of the ingredient rather than a label. That lets the model learn that a surfactant with HLB 11 behaves more like one with HLB 12 than one with HLB 4.
Technique 2: Handle the sum-to-100% constraint explicitly
Percent compositions are compositional data: raising one ingredient necessarily lowers the others. Tree models tolerate this better than linear models, but all of them get confused when the "water" or "solvent" column is just the remainder. The column carries no independent information and inflates feature importance for whatever it is anticorrelated with.
Two practical approaches work well. The first is to drop the filler component entirely and let the remaining columns define the formulation; the model implicitly knows the balance is solvent. The second, more rigorous for linear or Elastic Net models, is a log-ratio transform: express each component as the log of its percentage divided by the filler percentage. This converts the closed composition into unconstrained real numbers that regression handles cleanly. For most formulation AI projects using tree ensembles, dropping the filler and adding ratios (Technique 3) is sufficient and much easier to explain to a formulator.
Technique 3: Add chemically meaningful ratios
Formulators already think in ratios: pigment-to-binder, resin-to-hardener, oil-to-emulsifier, active-to-solvent, crosslinker-to-polymer. A model given only raw percentages has to rediscover these relationships from a few hundred rows, and often cannot. Adding the ratio as an explicit column hands the model the knowledge for free.
Ratios are also the first place to look when a model predicts well inside the historical range and poorly outside it. In a coatings dataset of 140 batches, a pigment volume concentration column (computed from pigment and binder densities, not just weights) explained hiding power variance that no combination of raw percentages could capture. The rule of thumb: for every property the lab measures, ask which two or three quantities a senior formulator would compare to predict it, and encode those comparisons as columns. Keep the count disciplined; five well-chosen ratios beat forty automatic pairwise divisions.
Technique 4: Turn process conditions into numeric features
Formulation outcomes depend on how the batch was made, not only on what went into it. Mixing speed, addition order, holding time at temperature, cure schedule, and shear during dispersion are routinely recorded as text ("added slowly at 60°C, held 20 min, cooled") and therefore ignored by the model.
Parse these into numeric columns: peak temperature, time above a threshold, number of addition stages, total mixing time, and a binary flag for high-shear equipment. Where the order of addition matters chemically (preservatives after cooling, thickener pre-dispersed in glycol), an ordinal column such as "stage at which emulsifier was added" captures it. A personal care team that spent two days extracting cure and cooling parameters from 190 batch comments found that cooling rate alone ranked third in feature importance for final viscosity, ahead of two ingredient columns they had expected to dominate.
Technique 5: Encode raw material lot and supplier variability
Two batches with identical recipes and identical processes can still differ because a polymer lot had a different molecular weight distribution or a pigment came from a second supplier. If lot identity is in the record, it can be encoded as a categorical feature, but with dozens of lots and few batches per lot, the model mostly learns noise.
A more useful representation uses the certificate-of-analysis values themselves: lot viscosity, acid value, moisture content, particle size D50. These are continuous, chemically meaningful, and shared across lots, so the model learns "higher polymer lot viscosity shifts final viscosity up" rather than "Lot 0417 was weird." For teams that have not yet connected CoA data to batch records, a supplier-level categorical plus a numeric "months since lot received" column is a reasonable interim step and often surfaces aging effects nobody had quantified.
Technique 6: Transform targets that span orders of magnitude
Viscosity, particle size, microbial counts, and cure time often span two or three orders of magnitude across a dataset. A model trained on the raw value spends its capacity fitting the handful of very high values and treats everything below 1,000 cP as roughly identical. Taking the logarithm of the target before training, then exponentiating the prediction, produces errors that are proportional rather than absolute, which is how formulators actually judge accuracy anyway.
The same logic applies to features. A percentage that ranges from 0.01% to 2% (a preservative or catalyst) is better represented on a log scale, or as a binary "present/absent" plus a log level. Skewed inputs are not fatal for tree models, but they are for Elastic Net and neural networks, and the transformation costs nothing.
Technique 7: Add interaction terms only when chemistry justifies them
Automated feature generators will happily produce every pairwise product of your columns. On 300 rows, that is a shortcut to overfitting. The better practice is to add a small number of interaction terms that encode known chemistry: surfactant level multiplied by oil phase fraction for emulsion stability, crosslinker multiplied by cure temperature for hardness, acid plus base combinations for buffer capacity.
This is also where explainability pays off. After a first model is trained, SHAP values or permutation importance will show which pairs of features behave non-additively; those are candidates for explicit interaction terms in the next iteration. Tree ensembles can learn interactions without being told, but on small data they do so inconsistently, and an explicit term makes the model both more accurate and easier to explain to a regulatory or quality reviewer.
A comparison of the seven techniques
| Technique | Best for | Main risk | Effort |
|---|---|---|---|
| Functional-class encoding | Many raw materials, few batches | Misclassifying multifunctional ingredients | Medium (chemist input) |
| Compositional handling | Any percent-based recipe | Log-ratios undefined at 0% | Low |
| Chemically meaningful ratios | Extrapolation, interpretability | Ratio explosion if automated | Low |
| Process-condition parsing | Properties sensitive to mixing or cure | Inconsistent text records | High (one-time) |
| Lot and CoA features | Batch-to-batch variability | CoA data not linked to batches | Medium |
| Log transforms and interactions | Skewed targets, known synergies | Overfitting from unjustified terms | Low |
A workflow for building formulation AI features without leakage
The order in which these steps happen matters almost as much as the steps themselves. Feature engineering done before the train/test split, using statistics from the whole dataset, is a classic source of models that look excellent in validation and disappoint in the lab. The guide on why machine learning chemistry models fail in the lab covers the validation side in depth; the flow below shows where feature work sits relative to it.
Step 2 is the one most teams skip, and it is the one that cannot be automated away. A data scientist can compute log-ratios and parse temperatures, but deciding that a particular ester belongs in the emollient class rather than the solvent class, or that resin-to-hardener ratio matters more than either percentage alone, is formulation knowledge. Platforms built for chemical R&D, ChemCopilot among them, let a formulator define functional groupings and ratios directly in the modeling interface and then run model sweeps across XGBoost, Random Forest, Elastic Net, and neural networks without code, which keeps the chemist in the loop at exactly the step where the chemist adds the most value.
Step 3 deserves a note. Random row-wise splits leak information when the same product family or the same raw material lot appears in both training and test sets. Splitting by time (train on batches before a date, test on batches after) or by family gives a far more honest estimate of how the model will behave on next quarter's work.
Key takeaways
Feature engineering is where chemical reasoning enters a formulation AI model. Functional-class encoding and ratios give the model the vocabulary a formulator already uses. Compositional handling and log transforms remove mathematical artifacts that confuse every algorithm. Process and CoA features capture the variance that recipe columns alone cannot explain. Interaction terms should be few and justified. And all of it has to be fitted inside the training split, then confirmed with a handful of real batches, before anyone changes a recipe based on a prediction.
FAQ
How many batches do I need before feature engineering is worth the effort?
Feature engineering matters most on small datasets, not least. With 50 to 100 batches, a model on raw percentages is often unusable, while the same data with functional classes and two or three ratios can give directional predictions good enough to prioritize experiments. Above a few thousand rows, algorithms start to learn some of these relationships on their own, but explicit features still improve interpretability.
Should I use functional classes or SMILES-based descriptors for ingredients?
Use both when you can. Functional classes capture the role an ingredient plays in the recipe; structural descriptors or embeddings capture its chemistry. For commercial raw materials that are mixtures or polymers without a clean SMILES string, functional class plus supplier-provided properties (HLB, molecular weight, acid value) is usually the practical choice.
Can feature engineering be done without coding?
Yes. Grouping ingredients, computing ratios, applying log transforms, and defining splits are all available in no-code chemistry ML tools designed for formulators. What cannot be delegated is the chemical judgment about which groupings and ratios make sense; that remains the formulator's job regardless of the tooling.
Does feature engineering introduce bias into the model?
It introduces chemical assumptions, which is the point. The safeguard is validation on held-out batches and inspection of feature importance: if a ratio you added ranks highly and the direction of its effect matches bench experience, the assumption is doing useful work. If it ranks highly in a direction no chemist can explain, treat it as a signal of leakage or a data error.
Ready to see how your historical batches perform once the features reflect the chemistry? Talk to the ChemCopilot team about running a formulation modeling pilot on your own data.