Package 'Rlimite'

Title: Native 'torch' Inference for Limite Mathematical Language Models
Description: Implements the Limite mathematical language-model architecture <https://github.com/paradigma-inc/limite-violetto> directly with 'torch'. Loads the published Base, Base Soup, and Violetto 'safetensors' checkpoints and tokenizers from the 'Hugging Face' Hub without a Python runtime or model-serving process. Provides cached autoregressive generation and the official single-turn prompt format used by the math-specialized Violetto checkpoint.
Authors: Sounkou Mahamane Toure [aut, cre], Paradigma contributors [ctb, cph] (Limite architecture)
Maintainer: Sounkou Mahamane Toure <[email protected]>
License: GPL (>= 2)
Version: 0.1.0
Built: 2026-09-22 19:31:14 UTC
Source: https://github.com/sounkou-bioinfo/Rlimite

Help Index


Construct a Limite language model

Description

Construct a Limite language model

Usage

limite(config = limite_config())

Arguments

config

A configuration produced by limite_config() or loaded from a checkpoint.

Value

A torch::nn_module implementing LimiteForCausalLM.


Generate a Limite response

Description

Violetto is intended for direct, independent mathematical problems rather than general multi-turn assistant use.

Usage

limite_chat(model, messages, tokenizer = limite_tokenizer(), ...)

Arguments

model

A pretrained Limite model.

messages

Conversation messages accepted by limite_chat_prompt().

tokenizer

A tokenizer returned by limite_tokenizer().

...

Arguments passed to limite_generate().

Value

A scalar response string with generated token IDs attached as the token_ids attribute.


Format messages with the published Limite template

Description

Adds the Limite end-of-text and ChatML control tokens. A default system message is inserted when the first message is not a system message.

Usage

limite_chat_prompt(messages, add_generation_prompt = TRUE)

Arguments

messages

A list of messages. Each message contains scalar role and content fields. Supported roles are system, user, and assistant.

add_generation_prompt

Append the assistant prefix.

Value

A scalar prompt string.


Published Limite checkpoints

Description

Returns the model identifiers and immutable revisions covered by Rlimite's real-model tests. Violetto is the math-specialized single-turn solver; Base and Base Soup are published family checkpoints.

Usage

limite_checkpoints()

Value

A data frame with checkpoint labels, model identifiers, revisions, and profiles.


Limite model configuration

Description

Creates the architecture contract used by the published 1B checkpoints. Values can be overridden to construct smaller models for experiments.

Usage

limite_config(...)

Arguments

...

Named configuration overrides.

Value

A validated Limite configuration list.


Construct Limite from checkpoint configuration

Description

Construct Limite from checkpoint configuration

Usage

limite_from_config(identifier, revision = "main", local_files_only = FALSE)

Arguments

identifier

Model identifier or local path.

revision

Hugging Face revision.

local_files_only

If TRUE, do not download missing Hub files.

Value

An uninitialized Limite model with the requested architecture.


Load a pretrained Limite model

Description

The model is created on the meta device and then attached to the checkpoint tensors, avoiding a second initialized copy of the 1B parameters.

Usage

limite_from_pretrained(
  identifier = "paradigma-inc/limite-1b-violetto",
  revision = "main",
  local_files_only = FALSE,
  device = NULL
)

Arguments

identifier

Model identifier or local path.

revision

Hugging Face revision.

local_files_only

If TRUE, do not download missing Hub files.

device

Optional torch device such as "cpu" or "cuda".

Value

A pretrained Limite model in evaluation mode.


Generate tokens with a Limite model

Description

Public token IDs follow the zero-based Hugging Face convention. The model uses a key/value cache after the prompt prefill.

Usage

limite_generate(
  model,
  input_ids,
  max_new_tokens = 64L,
  temperature = 0.8,
  top_k = 50L,
  eos_token_id = model$config$eos_token_id,
  seed = NULL,
  include_prompt = FALSE,
  callback = NULL
)

Arguments

model

A model returned by limite_from_pretrained() or limite().

input_ids

Zero-based token IDs for one prompt.

max_new_tokens

Maximum number of tokens to generate.

temperature

Sampling temperature. Use zero for greedy decoding.

top_k

Number of highest-scoring tokens retained for sampling, or NULL for the complete vocabulary.

eos_token_id

Zero-based end token. Defaults to the model config.

seed

Optional torch random seed.

include_prompt

Include the prompt IDs in the returned vector.

callback

Optional function called with each generated token ID.

Value

An integer vector of zero-based token IDs.


Load a Limite checkpoint state dictionary

Description

Loads safetensors directly as R torch tensors. identifier may be a Hugging Face model identifier, a checkpoint directory, or one safetensors file.

Usage

limite_state_dict(identifier, revision = "main", local_files_only = FALSE)

Arguments

identifier

Model identifier or local path.

revision

Hugging Face revision.

local_files_only

If TRUE, do not download missing Hub files.

Value

A named list of torch tensors.


Load the Limite tokenizer

Description

Load the Limite tokenizer

Usage

limite_tokenizer(
  identifier = "paradigma-inc/limite-1b-violetto",
  revision = "main",
  local_files_only = FALSE
)

Arguments

identifier

Model identifier or local path.

revision

Hugging Face revision.

local_files_only

If TRUE, do not download missing Hub files.

Value

A tok_tokenizer.