Skip to main content
QUICK REVIEW

[Paper Review] rollama: An R package for using generative large language models through Ollama

Johannes B. Gruber, Maximilian Weber|arXiv (Cornell University)|Apr 11, 2024
Computational and Text Analysis MethodsSocial Sciences8 citations
TL;DR

rollama is an R package wrapping the Ollama API to run open-source Generative Large Language Models locally, enabling annotation, embeddings, and other LLM tasks with reproducibility and privacy.

ABSTRACT

rollama is an R package that wraps the Ollama API, which allows you to run different Generative Large Language Models (GLLM) locally. The package and learning material focus on making it easy to use Ollama for annotating textual or imagine data with open-source models as well as use these models for document embedding. But users can use or extend rollama to do essentially anything else that is possible through OpenAI's API, yet more private, reproducible and for free.

Motivation & Objective

  • Promote open, private, reproducible use of Generative Large Language Models (GLLMs) in R.
  • Provide an easy wrapper to the Ollama API for local model access from R.
  • Enable common NLP tasks (annotation, embeddings) using open models without proprietary APIs.
  • Offer guidance and learning materials to facilitate use and extension of rollama.
  • Highlight reproducible workflows through seed-controlled prompts and zero/one/few-shot prompting.

Proposed method

  • Wraps the Ollama API to run locally hosted GLLMs from R.
  • Two core functions: query() for single prompts and chat() for conversational history.
  • Model management via pull_model() to download models from Ollama’s library.
  • Seeded prompts with temperature set to 0 for reproducible outputs.
  • Supports multimodal models (e.g., image-capable llava) and text embeddings.
  • Provides learning materials and tutorials to facilitate use and extension.

Experimental results

Research questions

  • RQ1How can rollama enable researchers to use open-source LLMs from within R via Ollama?
  • RQ2What provisions does rollama offer for reproducible outputs (e.g., seeds and temperature settings)?
  • RQ3How can researchers apply rollama to text annotation tasks and to generating/document embeddings?
  • RQ4What are the capabilities and limitations of multimodal and embedding workflows using Ollama models through rollama?

Key findings

  • rollama provides an accessible bridge to run open-source LLMs locally from R via Ollama.
  • It supports both single-turn queries and conversational chat with history retention.
  • Seeded prompts with temperature 0 enable reproducible outputs.
  • It enables text annotation with zero/few-shot and chain-of-thought prompting strategies.
  • It supports multimodal models (e.g., llava) and embedding generation with models like nomic-embed-text and all-minilm.
  • Learning materials and tutorials accompany the package to ease adoption.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.