Introducing Gigaton

Learn more
Perspectives

My Bayesian answer to a sticky cement-optimisation problem

By Nathan Carey

How a two-week design sprint laid the foundation for solving a key scaling issue – and one of the trickiest challenges in industrial automation

Optimising cement production is an ML nightmare.

You’re working in a non-stationary environment, where data is always noisy and confounding variables abound. You only ever have partial visibility over the system, and even that can be lost at a moment’s notice.

Needless to say, it’s not a problem you can stick on Kaggle.

And that’s exactly why I love it. Few challenges test an ML engineer’s skills and creativity like this one; even fewer offer the chance to get so close to real-world application, at this scale and speed.

Earlier this year, I built a Bayesian optimisation algorithm to tune a cement plant’s control system, online – a problem not yet cracked by the big players in industrial automation. Though it was a simple pilot experiment, it had to overcome all the messy hurdles inherent in applying ML to cement.

The algorithm worked: it led to a step change in the way plant controllers are tuned.

But more importantly, it paved the way to resolving a technological bottleneck that, until now, has stood in the way of optimising cement plants at scale.

This is how it came about.

An industry losing control

Before I worked at Gigaton, I never thought about cement, but I'm now brutally aware it’s crucial to our built environment. It’s the key ingredient in concrete, the world’s most-used construction material. Making it means emitting a lot of carbon: 8% of global emissions, with nearly half of that coming from fuel burned to run the process.

From the mid-1900s until the 2010s, the core cement production process remained relatively unchanged. But around ten years ago, volatile fuel prices and tightening carbon-pricing laws began driving up costs for producers – pushing them to seek out cheaper, lower-carbon fuel sources to stay competitive.

That change had big impacts on the delicately balanced cement pyroprocess.

Where previously, most producers relied on fuels with predictable heat values – coal and petcoke – they’ve since begun rapidly shifting toward substitutes, like tyres, commercial waste and sewage sludge. Those fuel sources have wildly varying heat values and consistencies, making it harder for plants to keep their process stable.

Now the industry faces a technological pinch point. The control-optimisation software that cement plants have relied on for decades – known as ‘advanced process control’, or APC – wasn’t designed to operate with this level of fuel-source fluctuation. The variability causes APC to drift and lose performance; often within two years after it’s been installed, the optimised control becomes no more effective than manual control.

The result: operators have a harder time reaching targets and plants burn more fuel than they should, emitting unnecessary carbon.

This is the problem we solve at Gigaton. We build closed-loop control systems that learn from plant data to optimise efficiency – reducing fuel use and emissions, while freeing up operators to focus on other critical plant functions.

Sizing up a scaling puzzle

By early 2026, we’d deployed our models in cement plants in seven countries across Europe, the Middle East and South America. They were making measurable improvements in process efficiency, and were getting better each month.

But we faced a scaling problem.

In the non-stationary plant environment, benchmarking our models’ online performance was extremely difficult. We had no clear performance indicator – no ‘golden metric’ – and no stable hill to climb. Without it, our models’ improvement loops needed recurring input from our engineers, creating manual workload and limiting our capacity.

We also faced a reward-attribution problem: because our models’ outputs passed through multiple layers of control and had impact at varying residence times, their effects took time to show. So when we observed a change in performance, we couldn’t tell whether it was caused by our model or by other disturbances in the plant. And because those outcomes weren’t automatically recorded, matching them to changes meant more manual work for our engineers.

We needed a fast answer to the question, ‘How can we be sure changes we make to the live system actually help?’

A Bayesian-sized problem

In May, I decided to tackle that question by building an experiment harness and learning framework.

First, the harness would apply a change to the plant, record the response and score it; this would address our reward-attribution problem. Then, the learning framework would use that score to propose the next change.

A critical thing to get right was choosing the best learning framework, and my decision came down to the messy realities of running ML in a live plant.

The main challenge is noise: plant disturbances mean two tests at the same settings can score very differently. I needed a method that models the noise explicitly rather than trusting any single result.

This precalciner temperature controller is a pretty typical cement production time series. yellow = coal, green = rdf, grey = co, light blue is temp, dark blue is the temp set point. The two fuels, Coal (yellow) and Refuse-derived fuel (green), are oscillating, with big swings in temperature (blue) and spikes in carbon monoxide (grey).

The other consideration is cost. Running experiments in a live plant takes hours, and the wrong settings can hurt product quality and cost our customer money. I needed a framework that could progressively reduce uncertainty to home in on optimal settings quickly.

All signs pointed to Bayesian optimisation. The Bayesian method builds a statistical model of how settings will likely perform and tracks how uncertain that model is. Each trial updates both, so the framework can choose the next trial where it expects to learn or gain the most.

In practice, that meant a Gaussian process surrogate to model tracking error across the parameter space, and a noisy expected-improvement acquisition function to pick the next trial.

To get started, I’d build an optimisation algorithm to automate the tuning of PID controllers, the cement plant’s lowest-level control software.

If the algorithm worked, it would validate a self-learning approach that could be applied to our higher-level plant optimisations, solving our scaling puzzle. And in the short term, it could improve an otherwise time-consuming and error-prone task for control engineers.

Getting in tune

PID controllers – short for Proportional-Integral-Derivative – are the bread and butter of industrial control engineering. They regulate equipment by responding to the tracking error between measured values and setpoints, accounting for error in the present, past and future.

PID controllers are the lowest level of control in the plant, sitting below APCs and Gigaton’s main optimisations.

PIDs are an elegant control mechanism, but equipment wear, sensor degradation and changing feedstocks can cause them to fall out of sync with the cement pyroprocess. Over time, that drift makes them either slow to reach setpoints or quick to overshoot, resulting in a less stable process.

So to keep PIDs accurate, control engineers periodically tune them.

Tuning involves finding the best combination of the three PID parameters: proportional gain (kp), integral gain (ki) and derivative gain (kd). Engineers set each parameter to a chosen value, make a step change in the plant – like increasing fuel – then observe the response.

PID controllers apply gains to scale the current error value (P), error accumulation over time (I) and rate of change of error (D). These gains map to the tuning coefficients kp, ki and kd.

It’s a largely manual, guess-and-check method, so I figured it would suit my Bayesian approach well. With each trial, the algorithm could update its uncertainty and move towards areas of expected improvement (1); the model could then home in on the best combinations faster than the typical method of tuning one parameter at a time.

And since PIDs are the lowest level of control in the plant, their feedback loops are less noisy than higher-level loops, making them a nice hill to climb on.

With my design doc taking shape, I began leading the two-week sprint. Within a few days, I had buy-in and approval to build the MVP. And since there was a real need to improve the existing tuning process, we classified it as a priority-zero development.

After a week of sandbox testing on a first-order plus dead time model (FOPDT) (2), the algorithm was ready to trial in a live plant – 1,700 km away, in Portugal.

Trials and errors

Optimising cement production is the opposite of a theoretical ML experiment.

In theory, the process is simple: limestone and clay are ground into a fine powder, burned in a kiln to form clinker, then ground with gypsum to make cement.

In reality, the process is much more complicated.

Limestone feed varies constantly, changing process chemistry. Feedback from adjustments made to the plant takes minutes to appear. Sensors drift, degrade and fail, eliminating visibility of the signal you’re trying to optimise; and at any moment, plant operators might make manual changes that instantly override your experiment.

The cement production process: raw meal enters the preheater cyclones before passing through the precalciner and kiln, where it is converted to clinker. The clinker is then cooled and mixed with gypsum to become cement.

So it was no surprise that when we began trialling the tuning algorithm in the plant, things didn’t go quite as planned.

We chose to tune the temperature controller of the precalciner, the plant’s first combustion chamber, where limestone breaks down into lime and CO2. It’s a straightforward, fast-response PID loop – when temperature falls below the setpoint, fuel increases; when temperature rises above it, fuel decreases.

PID control of precalciner temperature: as temperature falls below the setpoint, the error (purple line) increases, driving the PID to increase fuel flow (yellow, green).

The day came for our first live plant trial. We began running our algorithm in open loop, letting the Bayesian optimisation propose parameters without many constraints, but allowing us to check for extreme combinations before manually modifying the PID.

After testing an initial set of tuning parameters based on a Sobol sequence (3), the algorithm’s first proposal went live. We watched as the plant returned temperature data in 60-second updates.

Precalciner temperature fell, then fell again.

With the falling temperature quickly pushing the precalciner towards an unstable state, plant operators stepped in, turning our controller off and reverting to manual control.

Trial 1: aborted. Hmm.

Failed trials aren’t always a bad thing – bad parameters help build your dataset, after all. Still, we were keen to avoid the plant switching us off a second time, so I carefully modified the search space and re-ran the algorithm.

This time we completed the two-hour window, with temperature stable enough. Our framework had its first set of tuning parameters to learn from.

The PID tuning loop

Over the next few weeks, the algorithm showed promising results. Tracking error in subsequent trials trended downward, indicating we were closing in on near-optimal PID tuning; we also found entirely new regions in parameter space where we saw good control.

The real test would be switching the algorithm to run in closed loop. With no one verifying settings before they went live, we had to trust both the algorithm to choose safe parameters and the harness to apply them directly to the plant’s control system.

Closing the loop

Making changes in the physical world is my favourite part of ML engineering. But it’s also the most nerve-wracking. Get it right and you’ve made tangible progress; get it wrong and there are real consequences.

And in the case of my tuning algorithm, that meant putting the precalciner into an unstable state – or worse, bringing the plant’s continuous processing of 100 tonnes of limestone per hour to a stop.

So when we set the algorithm to run in closed loop, safety boundaries were key: we defined a trust region to prevent the optimisation from wandering into dangerous areas and sending the PID wildly out of tune or out of balance.

Our solutions engineers stood by, in live contact with operators in the control room; a terminal with a ‘kill switch’ to revert the controller to its original tuning sat ready on my second screen.

Trials commenced.

To my relief, the algorithm performed well from the start: with each two-hour window, it narrowed in on parameters that pushed the controller’s tracking error from 20°C to below 5°C. The optimisation was self-learning, online, and tuning multiple PID dimensions faster than could be done manually.

A shot of excitement ran through me. This thing’s working!

Tracking error (z-axis) for proportional gain and integral time settings (holding derivative gain fixed). The Bayesian optimisation found combinations of kp, ki and kd that drove down error in successive trials (circled), achieving near-optimal PID tuning.

The algorithm showed us that a Bayesian approach was a promising route to online self-learning – not only for PID tuning, but also for higher-level control loops in the plant.

Since those trials, we’ve started applying the approach to our preheater and cooler optimisations. That’s a serious challenge for our engineers: the higher you go in a plant’s control hierarchy, the longer the feedback and the noisier the data.

But to achieve fully autonomous plant control, it’s a challenge we need to overcome, and we’re getting closer every month.

Life at the frontier of applied ML

Cement is a really tough problem space to work on. But that's why I love it.

There’s no clear path to solving one of the world's toughest decarbonisation problems – this is uncharted ML-engineering territory. The only way is to explore, burn some tokens and investigate.

That’s what I value most about working here. You own what you ship: I have the autonomy to come up with my own ideas and the ownership to pursue them, in a very real way.

Like how just six weeks after my idea for the tuning algorithm was first sparked, it was live in a cement plant.

This is ML engineering that actually improves machines in the physical world, and it’s incredibly rewarding.

TL;DR – it’s not a bad gig.

Sources

1)https://botorch.readthedocs.io/en/stable/acquisition.html#botorch.acquisition.analytic.ExpectedImprovement

(2) Nathan to send

(3) Nathan to send updated link


Gigaton is looking for ambitious machine learning engineers who are eager to take on the world’s hardest decarbonisation challenges.

If you’re up for it, check out the open roles on our careers page.

Nathan Carey

Machine Learning Engineer