llama-node  by Atome-FE

Node.js library for local LLM inference

created 2 years ago
874 stars

Top 42.0% 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

1 day

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

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Nat Friedman Nat Friedman(Former CEO of GitHub), and
32 more.

llama.cpp by ggml-org

0.4%
84k
C/C++ library for local LLM inference
created 2 years ago
updated 14 hours ago
Feedback? Help us improve.