{kindling} is an R (R Core Team, 2025) package that provides a higher-level interface to the {torch} package (Falbel and Luraschi, 2025), R’s native implementation of PyTorch, for defining, training, and tuning neural networks. This package supports MLPs with the same topology, including the standard deep feedforward neural networks and recurrent variants (RNN, LSTM, GRU), while reducing the boilerplate typically required to write {torch} neural network architecture expression and training loops by hand. The package is organized around three levels of abstraction. At the lowest level, generator functions (for example ffnn generator()) return unevaluated torch::nn module() expressions that users can inspect or modify directly, since {kindling} builds its models through code generation rather than opaque wrapper objects. At an intermediate level, functions such as ffnn() and rnn() train a model directly from a formula and data frame, handling data preparation, the optimization loop, and, optionally, early stopping and a validation split. At the highest level, mlp kindling() and rnn kindling() register these models as {parsnip} model specifications (Kuhn and Vaughan, 2026), so they can be fit, tuned, and evaluated using the rest of the {tidymodels} ecosystem (Kuhn and Wickham, 2020): {recipes} for preprocessing, {workflows} for bundling preprocessing and modeling steps, and {tune}/{dials} for hyperparameter search over layer widths, network depth, activation functions, the output activation, the optimizer, and other architectural choices. Fitted models can also be inspected with variable-importance methods from {NeuralNetTools} (Beck, 2018), implementing the algorithms of Garson (Garson, 1991) and Olden and Jackson (Olden and Jackson, 2002), and with the {vip} package. Figure 1 shows an example of this last capability applied to the feedforward network trained in the package’s own README usage example.
Soetewey, A., & Marie, J. (2026). kindling: A Higher-Level torch Interface for Generating, Training, and Tuning Neural Networks in R (LIDAM Discussion Paper ISBA 2026/26). https://hdl.handle.net/2078.5/278607