  The interpretation of observations of atomic and molecular tracers in the
galactic and extragalactic interstellar medium (ISM) requires comparisons with
state-of-the-art astrophysical models to infer some physical conditions.
Usually, ISM models are too time-consuming for such inference procedures, as
they call for numerous model evaluations. As a result, they are often replaced
by an interpolation of a grid of precomputed models.
  We propose a new general method to derive faster, lighter, and more accurate
approximations of the model from a grid of precomputed models.
  These emulators are defined with artificial neural networks (ANNs) designed
and trained to address the specificities inherent in ISM models. Indeed, such
models often predict many observables (e.g., line intensities) from just a few
input physical parameters and can yield outliers due to numerical instabilities
or physical bistabilities. We propose applying five strategies to address these
characteristics: 1) an outlier removal procedure; 2) a clustering method that
yields homogeneous subsets of lines that are simpler to predict with different
ANNs; 3) a dimension reduction technique that enables to adequately size the
network architecture; 4) the physical inputs are augmented with a polynomial
transform to ease the learning of nonlinearities; and 5) a dense architecture
to ease the learning of simple relations.
  We compare the proposed ANNs with standard classes of interpolation methods
to emulate the Meudon PDR code, a representative ISM numerical model.
Combinations of the proposed strategies outperform all interpolation methods by
a factor of 2 on the average error, reaching 4.5% on the Meudon PDR code. These
networks are also 1000 times faster than accurate interpolation methods and
require ten to forty times less memory.
  This work will enable efficient inferences on wide-field multiline
observations of the ISM.
