Relm – 作为 R 基础对象的本地大语言模型,具备可解释性
Relm – local LLMs as base-R objects, with interpretability

原始链接: https://github.com/Vadale/R-ebirth

**R-ebirth** 是一项旨在将 R 打造为数据科学与 AI 研究首选环境的新计划。其核心软件包 **relm** 提供了一个基于 Rust 的高性能内核,可将本地大语言模型(LLM)直接集成到 R 工作流中。 通过嵌入经修改的 `llama.cpp`,`relm` 使研究人员能够利用标准的 R 惯用法和数据结构(如 `data.frames` 和矩阵),执行复杂的 AI 任务,包括文本生成、嵌入、分词、激活追踪、模型引导和消融研究。这支持了强大的工作流,例如无需 Python 即可直接在 R 中进行主题建模。 0.1.0 版本的主要功能包括: * **原生集成:** 提供用于模型管理和机械可解释性研究的直接 R 函数。 * **准确性:** 每个数值功能均通过严格的参考测试框架进行了验证。 * **易用性:** 提供预编译二进制文件以便快速安装,并为从源码构建的用户提供了开发工具。 该项目采用双重许可(MIT/Apache-2.0),目前专注于纯文本模型,计划在 0.2.0 版本中加入图像支持(视觉)。仓库中提供了包括快速入门指南和可运行演示在内的完整文档。

抱歉。
相关文章

原文

R-ebirth aims to make R a first-class environment for scientific research on data and AI — mechanistic interpretability ("AI neuroscience"), machine learning including topic modelling, and the life sciences — while staying simple for researchers.

It is delivered as relm: an R package with a Rust native core that embeds a patched llama.cpp, exposing local LLMs (loading, generation, embeddings, activation tracing, steering, and ablation) as base-R-idiom functions returning plain data.frames and matrixes.

relm topic map: eight clusters of scientific abstracts, each named by the model

Topic modelling with no Python: llm_embed() → UMAP → HDBSCAN → the model names each cluster. One of two runnable demos — see the package README.

Using the package? Start with the package README (quickstart, examples, the two demos) and docs/getting-started.md (install options — binaries or from source — a first run, and troubleshooting). This page is the repository/developer overview.

Status: v0.1.0 (text-only)

The first public release is here. relm loads local GGUF models and exposes, as base-R objects:

  • llm() model loading, llm_tokens() tokenization;
  • llm_generate() text generation, llm_logits() next-token distributions;
  • llm_embed() text embeddings;
  • llm_trace() activation tracing, llm_steer() steering, llm_ablate() ablation — the mechanistic-interpretability core;
  • llm_download() checksum-verified fetch of pinned models.

Every numerical feature is validated value-for-value against an independent reference (harness B). Vision (image inputs) is the next release (v0.2.0); v0.1.0 is text-only. The full plan is in ROADMAP.md.

rebirth/            the R package (R/, src/ + src/rust/ extendr crate, tests/, vignettes/)
rust/               Cargo workspace: rebirth-ffi (R <-> Rust boundary), rebirth-llm (engine)
rebirth/src/llama.cpp/   pinned, patched llama.cpp (vendored; see its VENDORING.md)
tests/llm-golden/   Harness B numerical goldens
tests/demos/        the two reference demos (anatomy lab; topics without Python)

Planning documents (the single source of truth)

CLAUDE.md, SOLO-PHASE-PLAN.md, ROADMAP.md, API-GRAMMAR.md, ARCHITECTURE.md, DECISIONS.md, and THESIS-PLAN.md. If anything else disagrees with these files, the files win.

Building from source (developers)

End users install prebuilt binaries from r-universe (no toolchain required). Building from source requires R (>= 4.5), a C toolchain, a Rust toolchain (rustup; the pinned channel is in rust-toolchain.toml), and CMake (>= 3.28) for the vendored engine.

# native workspace
cd rust && cargo test && cargo clippy --all-targets -- -D warnings

# R package
R CMD build rebirth && R CMD check relm_0.1.0.tar.gz

Dual-licensed MIT OR Apache-2.0 — see LICENSE.md. The vendored llama.cpp is MIT (see NOTICE). The name is protected: modified redistributions must rename (see TRADEMARK.md).

联系我们 contact @ memedata.com