larql  by chrishayuk

The model is the database: query neural network weights directly

Created 3 months ago
1,084 stars

Top 34.3% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

LARQL enables direct querying and manipulation of transformer neural network weights by decompiling models into a queryable vindex format and using the Lazarus Query Language (LQL). This approach treats model knowledge as a graph database, allowing users to browse, edit, and recompile weights without traditional fine-tuning or GPU requirements for basic operations, targeting researchers and power users.

How It Works

LARQL's core concept is "the model IS the database." It decompiles transformer weights into a vindex, where gate vectors become KNN, embeddings token lookups, and down projections edge labels. LQL provides a SQL-like interface for querying, browsing, and mutating this vindex, offering direct interaction with learned knowledge.

Quick Start & Requirements

  • Install: Requires Rust toolchain; build with cargo build --release.
  • Model Extraction: larql extract-index <model> -o <vindex> [--f16] [--level <browse|inference|all>]. Browse-only vindexes are ~3 GB (f16), inference-enabled ~6 GB (f16).
  • Prerequisites: Openblas for Linux builds. Metal GPU backend available (--features metal). No GPU needed for browse/query.
  • Docs: docs/lql-guide.md.

Highlighted Details

  • Vindex: Query-optimized weight format with streaming extraction, zero-copy mmap loading, and patch overlays.
  • LQL: Comprehensive query language for lifecycle, browsing, inference, mutation, and patch operations.
  • Patches: Lightweight .vlp files for incremental, read-only knowledge edits.
  • Vindexfile: Declarative build system for vindexes.
  • Tiered Context: Enables effectively infinite context without large KV caches.
  • Residual Stream Trace: Captures and queries full inference trajectories.
  • Model Support: Broad support for Gemma, Llama, Mistral, Mixtral, Qwen, Phi, DeepSeek, GPT-OSS, GPT-2 families (safetensors, GGUF, MLX).

Maintenance & Community

No explicit details on maintainers, community channels, or roadmap were found in the provided README.

Licensing & Compatibility

  • License: Apache-2.0.
  • Compatibility: Permissive for commercial use and closed-source projects.

Limitations & Caveats

  • Build requires Rust toolchain and Openblas on Linux.
  • MXFP4-quantized MoE models may yield noisy DESCRIBE/WALK results; INFER is recommended.
  • Some vindex ecosystem specifications are noted as not fully implemented.
Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
15
Issues (30d)
10
Star History
44 stars in the last 30 days

Explore Similar Projects

Starred by Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), Michael Chiang Michael Chiang(Cofounder of Ollama), and
2 more.

enrichmcp by featureform

0%
645
ORM for AI agents
Created 1 year ago
Updated 4 months ago
Starred by Jeremy Howard Jeremy Howard(Cofounder of fast.ai) and Stas Bekman Stas Bekman(Author of "Machine Learning Engineering Open Book"; Research Engineer at Snowflake).

SwissArmyTransformer by THUDM

0%
1k
Transformer library for flexible model development
Created 4 years ago
Updated 1 year ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Nir Gazit Nir Gazit(Cofounder of Traceloop), and
4 more.

llmware by llmware-ai

0.0%
15k
Framework for enterprise RAG pipelines using small, specialized models
Created 2 years ago
Updated 1 month ago
Feedback? Help us improve.