Learn R Programming

⚠️There's a newer version (1.2.1) of this package.Take me there.

localLLM (version 1.0.1)

Running Local LLMs with 'llama.cpp' Backend

Description

The 'localLLM' package provides R bindings to the 'llama.cpp' library for running large language models. The package uses a lightweight architecture where the C++ backend library is downloaded at runtime rather than bundled with the package. Package features include text generation, reproducible generation, and parallel inference.

Copy Link

Version

Install

install.packages('localLLM')

Monthly Downloads

344

Version

1.0.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Yaosheng Xu

Last Published

October 15th, 2025

Functions in localLLM (1.0.1)

set_hf_token

Configure Hugging Face access token
smart_chat_template

Smart Chat Template Application
generate_parallel

Generate Text in Parallel for Multiple Prompts
get_lib_path

Get Backend Library Path
quick_llama_reset

Reset quick_llama state
detokenize

Convert Token IDs Back to Text
.with_hf_token

Temporarily apply an HF token for a scoped operation
ag_news_sample

AG News classification sample
apply_chat_template

Apply Chat Template to Format Conversations
context_create

Create Inference Context for Text Generation
backend_init

Initialize localLLM backend
generate

Generate Text Using Language Model Context
download_model

Download a model manually
list_cached_models

List cached models on disk
lib_is_installed

Check if Backend Library is Installed
tokenize

Convert Text to Token IDs
model_load

Load Language Model with Automatic Download Support
backend_free

Free localLLM backend
apply_gemma_chat_template

Apply Gemma-Compatible Chat Template
localLLM-package

R Interface to llama.cpp with Runtime Library Loading
quick_llama

Quick LLaMA Inference
get_model_cache_dir

Get the model cache directory
tokenize_test

Test tokenize function (debugging)
install_localLLM

Install localLLM Backend Library