relm: Local Large Language Models as Base-R Objects

Load and run local large language models (through a vendored, patched 'llama.cpp') from R and work with them as plain data frames and matrices in base-R idiom. Provides model loading and tokenization (llm(), llm_tokens()), text generation (llm_generate()), next-token distributions (llm_logits()), embeddings (llm_embed()), and mechanistic interpretability tools – activation tracing (llm_trace()), activation steering (llm_steer()), neuron ablation (llm_ablate()), and grouped statistical probes (llm_probe()). Vision-language models loaded with their projector take image input in generation and embeddings. A checksum-verified downloader (llm_download()) fetches pinned models.

Version: 0.5.0
Depends: R (≥ 4.5.0)
Imports: methods, nanoarrow
Suggests: testthat (≥ 3.0.0), later (≥ 1.4.8), promises (≥ 1.5.0), glmnet, uwot, dbscan, quarto
Published: 2026-10-29
DOI: 10.32614/CRAN.package.relm (may not be active yet)
Author: Alessandro Vadala [aut, cre, cph], ggml authors [ctb, cph] (Bundled llama.cpp and ggml (MIT)), Authors of the bundled Rust and native dependencies [ctb, cph] (Individual authors, copyrights and licenses are listed in AUTHORS, RUST-NOTICES and THIRD-PARTY-NOTICES)
relm author details
Maintainer: Alessandro Vadala <vadale93 at gmail.com>
BugReports: https://github.com/Vadale/R-ebirth/issues
License: MIT + file LICENSE | Apache License (== 2.0)
Copyright: See inst/AUTHORS, inst/RUST-NOTICES and inst/THIRD-PARTY-NOTICES for bundled source authorship, copyrights and licenses.
URL: https://github.com/Vadale/R-ebirth, https://vadale.r-universe.dev/relm
NeedsCompilation: yes
SystemRequirements: Cargo (Rust's package manager) >= 1.85.0, rustc >= 1.85.0, cmake (>= 3.28), xz
Materials: README, NEWS
CRAN checks: relm results

Documentation:

Reference manual: relm.html , relm.pdf
Vignettes: The anatomy lab: locating sentiment in a language model (source, R code)
Build, preserve and evaluate a contrast direction (source, R code)
See, compare and record model interventions (source, R code)
Generation as a stream of R data (source, R code)
Topic modelling without Python (source, R code)
Seeing machines: a VLM answering questions about an image, locally (source, R code)

Downloads:

Package source: relm_0.5.0.tar.gz
Windows binaries: r-devel: not available, r-release: not available, r-oldrel: not available
macOS binaries: r-release (arm64): not available, r-oldrel (arm64): not available, r-release (x86_64): not available, r-oldrel (x86_64): not available

Linking:

Please use the canonical form https://CRAN.R-project.org/package=relm to link to this page.