Abstract Since coffee bean roasting is a complicated process involving transient transport processes along with complex chemical reactions, modeling and optimizing such process is a challenge. Here, machine learning was first used to formulate models that allowed predictions of selected quality indicators of coffee beans undergoing hot air or superheated steam roasting at various conditions. Starling particle swarm optimization (SPSO) as well as other swarm intelligence and gradient-based algorithms were then used to determine conditions that would yield roasted beans with quality indicators similar to those of benchmarks. Test was also performed to determine if Robusta beans could be roasted at conditions depicted by SPSO to yield the beans with quality indicators similar to those of commercial blend of Arabica and Robusta beans. SPSO predicted values of quality indicators with average errors of lower than 9% and 13% when laboratory-scaled Robusta beans and commercial blend of beans were used as benchmarks.