llama-node  by Atome-FE

Node.js library for local LLM inference

Created 2 years ago
873 stars

Top 41.1% on SourcePulse

GitHubView on GitHub
Project Summary

LLaMA Node provides a Node.js interface for running various large language models (LLMs) locally on consumer hardware, including CPUs. It targets Node.js developers seeking to integrate LLM capabilities into their applications without relying on cloud APIs, enabling offline inference for models like LLaMA, Alpaca, Vicuna, and RWKV.

How It Works

The library leverages native Node.js addons (N-API) to bridge JavaScript with C++ inference engines: llama.cpp, llm (a Rust port of llama.rs), and rwkv.cpp. This architecture allows for efficient execution of LLM inference directly within a Node.js process, offloading heavy computation to the C++ backends. The use of N-API facilitates communication between the Node.js event loop and the computationally intensive LLM threads.

Quick Start & Requirements

  • Install the core package: npm install llama-node
  • Install at least one backend:
    • llama.cpp: npm install @llama-node/llama-cpp
    • llm: npm install @llama-node/core
    • rwkv.cpp: npm install @llama-node/rwkv-cpp
  • Supported platforms: macOS (x64, arm64), Linux (glibc >= 2.31), Windows (x64).
  • Node.js version: >= 16.
  • CUDA support requires manual compilation.
  • Official Documentations: [Link not provided in README]

Highlighted Details

  • Supports a wide range of GGML-formatted models including LLaMA, Alpaca, Vicuna, GPT4All, and RWKV.
  • Utilizes N-API for efficient inter-process communication between Node.js and C++ inference threads.
  • Offers multiple backend options (llama.cpp, llm, rwkv.cpp) for flexibility.
  • Enables local, CPU-based inference, democratizing access to LLMs.

Maintenance & Community

Licensing & Compatibility

  • Licensed under MIT/Apache-2.0.
  • Recommends citing dependencies if code is reused.

Limitations & Caveats

The project is explicitly stated as being in an early stage and not production-ready, with potential for breaking API changes. Manual compilation is required for CUDA support.

Health Check
Last Commit

2 years ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Gabriel Almeida Gabriel Almeida(Cofounder of Langflow), and
2 more.

torchchat by pytorch

0.1%
4k
PyTorch-native SDK for local LLM inference across diverse platforms
Created 1 year ago
Updated 1 week ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Vincent Weisser Vincent Weisser(Cofounder of Prime Intellect), and
7 more.

dalai by cocktailpeanut

0%
13k
Local LLM inference via CLI tool and Node.js API
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.