mlr3torch: A Deep Learning Framework in R based on mlr3 and torch

arXiv stat.ML / 4/21/2026

📰 NewsDeveloper Stack & InfrastructureTools & Practical UsageModels & Research

Key Points

  • The mlr3torch project introduces an extensible deep learning framework for R that integrates tightly with the mlr3 ecosystem.
  • Built on top of the torch package, it streamlines defining, training, and evaluating neural networks for both tabular data and tensor inputs like images, supporting classification and regression.
  • It includes predefined neural architectures and enables converting torch models into mlr3 learners, helping reuse existing PyTorch-style models within mlr3.
  • Users can model end-to-end workflows as graphs—covering preprocessing, data augmentation, and network architecture—leveraging mlr3pipelines’ graph language.
  • The announcement also presents design details, customization/extension guidance, three demonstrated use cases (hyperparameter tuning, fine-tuning, multimodal architectures), and runtime benchmarks.

Abstract

Deep learning (DL) has become a cornerstone of modern machine learning (ML) praxis. We introduce the R package mlr3torch, which is an extensible DL framework for the mlr3 ecosystem. It is built upon the torch package, and simplifies the definition, training, and evaluation of neural networks for both tabular data and generic tensors (e.g., images) for classification and regression. The package implements predefined architectures, and torch models can easily be converted to mlr3 learners. It also allows users to define neural networks as graphs. This representation is based on the graph language defined in mlr3pipelines and allows users to define the entire modeling workflow, including preprocessing, data augmentation, and network architecture, in a single graph. Through its integration into the mlr3 ecosystem, the package allows for convenient resampling, benchmarking, preprocessing, and more. We explain the package's design and features and show how to customize and extend it to new problems. Furthermore, we demonstrate the package's capabilities using three use cases, namely hyperparameter tuning, fine-tuning, and defining architectures for multimodal data. Finally, we present some runtime benchmarks.