Skip to content

LLaya 0.1.0: first release

Latest

Choose a tag to compare

@felipedaragon felipedaragon released this 02 Oct 19:32

First release of LLaya, the Lua binding for LibLayaX: the Laya
typed-decision AI model running inside your Lua program. No server, no Python: load the
model once, then ask it yes/no, multiple-choice and score questions about a piece of text.

local llaya = require "llaya"
local agent = assert(llaya.new("/models/laya", { backend = "cpu" }))

local answer = assert(agent:ask_yes_no_table("Please refund the duplicate charge.",
                                             "Does the customer ask for a refund?", "refund"))
print(answer.results[1].answers.refund.noul)        --> 0.8364

Downloads

File What it is
LLaya-0.1.0-testkit-cpu.tar.xz Test kit, CPU. Ready to run on Windows x64, Windows ARM64, Linux x64, Linux ARM64 and macOS on Apple Silicon.
LLaya-0.1.0-testkit-gpu.tar.xz Test kit, GPU. Ready to run on Windows x64, Linux x64 and macOS on Apple Silicon, with a library that uses the GPU.
LLaya-0.1.0-lua5.1-binaries.zip The llaya module alone, built for Lua 5.1 on the same five platforms, for use in your own program.

Try it in two steps

A test kit contains everything except the model: the Lua 5.1.4 interpreter, the llaya
module, the LibLayaX library and the scripts.

  1. Download the model (about 800 MB) from
    convaiinnovations/laya on Hugging Face.
  2. Unpack a kit (tar -xf LLaya-0.1.0-testkit-cpu.tar.xz), go into the folder for your
    system, and run:
run-tests.bat D:\models\laya          Windows
sh run-tests.sh /models/laya          Linux, macOS

The CPU kit runs the test suite (50 checks) and a speed test. The GPU kit runs the test suite
on the GPU, then the speed test with each precision (fp16, bf16, fp32) and on the CPU
for comparison.

Use it in your own program

Take the module from the binaries zip and put the LibLayaX library (laya.dll,
liblaya.so or liblaya.dylib, version 1.0.5 or later) for the same platform next to it.
For Lua 5.2, 5.3 or 5.4, build the module from the source; it is one C file.

What is in this release

  • Every answer in two forms: as JSON text, for the JSON library you already use, or as a
    Lua table (the methods ending in _table).
  • Helpers for a single question (ask_yes_no, ask_choice, ask_score), and predict
    for several questions and several texts in one call.
  • CPU or GPU, chosen with one option: llaya.new(dir, { backend = "vulkan", precision = "fp16" }).
  • Errors returned the Lua way, as nil plus a message.
  • The module finds the library next to itself, so no LD_LIBRARY_PATH is needed on Linux.
  • One source file for Lua 5.1 to 5.4, with no dependencies besides Lua's headers.
  • A manual in the docs folder: getting started, asking questions, the full reference,
    options, tables and JSON, installing, troubleshooting, testing, building.

Tested

With the real English model, Lua 5.1.4 and LibLayaX 1.0.14. The full suite, 50 checks,
passes with 0 failures on each:

System CPU GPU
Windows 11 x64 PC (Intel Core Ultra 9 275HX, NVIDIA RTX 5080 Laptop GPU) passed passed
macOS (Apple M3 Ultra) passed passed
Windows 11 on ARM, native ARM64 passed no GPU build
Windows 11 on ARM, x64 module under emulation passed not run
Ubuntu 24.04 ARM64 passed no GPU build

On Windows, both a program that uses lua51.dll and one that uses lua5.1.dll with a
forwarding lua51.dll were tried.

Not yet run: the Linux x64 module with the real model; the GPU on Linux; the half
precisions (fp16, bf16) from Lua, which the GPU kit's script measures; LuaJIT. Lua 5.2,
5.3 and 5.4 were tested on Linux x64 with a synthetic model only. Reports are welcome: the
output of run-tests from a kit is all that is needed.

Notes

  • Windows: the published modules ask for lua51.dll. If your program only has
    lua5.1.dll and no forwarding DLL, rebuild the module for that name (see the docs).
  • Windows: cannot load laya.dll (error 193) means the laya.dll next to the module is
    for the other processor type.
  • Linux x64: the LibLayaX library needs glibc 2.38 (Ubuntu 24.04, Fedora 39, Debian 13
    or newer).
  • macOS, GPU: set MVK_CONFIG_LOG_LEVEL=1 to keep MoltenVK from printing about 180
    lines of information. The kit's script does this for you.
  • First GPU question: it can take a second or more, a one-time cost after loading. A GPU
    pays off with batches.
  • Opening .tar.xz: tar -xf on Windows 10 and 11, macOS and Linux; older Windows
    needs 7-Zip.

Credits

Laya by NandhaKishorM (Apache-2.0) is the original model and Python implementation.
laya.cpp by Lars Karlslund (MIT) is the C++ port that LibLayaX is built on.
LLaya was written by Claude (Anthropic) under the direction of Felipe Daragon (DaragonTech).
MIT licensed. The test kits include the standard Lua 5.1.4 interpreter (MIT) and, for the
macOS GPU folder, MoltenVK (Apache-2.0); the license texts are inside each kit.