Abstract Forecasting the amount of required energy is a primary task for sustainable building design. In recent decades, machine learning (ML) has provided effective solutions to this problem, particularly thermal energy forecasting. This study aims to develop new ML paradigms for predicting annual thermal energy demand (EDAT) based on the building’s architecture. A valid dataset is obtained from the previous literature to feed the ML models. It is then synthesized with four of the most recent optimization algorithms, namely gazelle optimization algorithm (GOA), incomprehensible but intelligible-in-time logics (ILA), osprey optimization algorithm (OOA) and sooty tern optimization algorithm (STOA), which are responsible for training the ML. The quality of training and validation of the ensembles used are checked using relative and absolute accuracy quantifiers. According to the results, all four ensembles of ML-GOA, ML-ILA, ML-OOA and ML-STOA are trained and validated with excellent accuracy, and therefore, they can be recommended for the practical forecast of the EDAT. A comparison, however, disclosed the superiority of the GOA-based model. This model has also been successfully validated against several hybrid algorithms used in earlier efforts. In short, the introduced models can directly contribute to the energy–construction sectors by assisting decision-makers in effectively designing residential buildings and their energy systems.