LXDB is an open-source binary format, compiler and zero-copy query engine for multilingual semantic datasets.
It provides the infrastructure required to build, validate, store and efficiently query large lexical or semantic graphs.
LXDB was originally created as the semantic subsystem behind Lexicon, but it is designed as an independent and reusable project.
LXDB stores and queries semantic knowledge.
Applications decide what to do with that knowledge.
Language datasets can contain hundreds of thousands of words and millions of relationships.
Loading those datasets into conventional in-memory structures can introduce:
- long startup times;
- high memory usage;
- unnecessary allocations;
- duplicated strings;
- complex application-specific preprocessing.
LXDB compiles semantic data into a validated binary representation that applications can query without rebuilding the complete graph in memory.
Its main goals are:
- compact binary storage;
- deterministic compilation;
- validated datasets;
- zero-copy access where possible;
- lazy relation traversal;
- language-independent architecture;
- reproducible dictionary generation;
- clean separation between data infrastructure and applications.
LXDB is currently under active development. The workspace has a reproducible compiler → storage → query workflow covered by integration tests and CI. The roadmap and current limitations are tracked in ROADMAP.md.
The project is stabilizing its first usable end-to-end workflow:
linguistic sources
↓
dictionary pipeline
↓
semantic graph
↓
LXDB compiler
↓
.lxdb dataset
↓
storage validation
↓
zero-copy query engine
↓
CLI or application
lxdb/
├── crates/
│ ├── lxdb-core/
│ ├── lxdb-format/
│ ├── lxdb-storage/
│ ├── lxdb-engine/
│ ├── lxdb-compiler/
│ ├── lxdb-dictionary/
│ └── lxdb-cli/
├── config/
├── dictionary/
├── examples/
├── docs/
├── Cargo.toml
└── README.md
| Crate | Responsibility |
|---|---|
lxdb-core |
Domain primitives, strongly typed IDs and semantic graph models |
lxdb-format |
Binary format definitions, records, sections and format validation |
lxdb-storage |
Safe loading and structural validation of .lxdb datasets |
lxdb-engine |
Lazy and zero-copy dataset queries |
lxdb-compiler |
Source parsing, validation, graph construction and binary writing |
lxdb-dictionary |
Multilingual lexical source ingestion and dataset generation |
lxdb-cli |
Command-line interface for compiling, inspecting and querying datasets |
LXDB is divided into independent layers:
┌─────────────────────┐
│ lxdb-dictionary │
│ external sources │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ lxdb-compiler │
│ source → graph │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ lxdb-format │
│ binary contract │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ lxdb-storage │
│ loading/validation │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ lxdb-engine │
│ query/traversal │
└─────────────────────┘
Applications depend on the public LXDB APIs.
LXDB never depends on application-specific rules.
An LXDB file is divided into validated sections.
The current format includes sections conceptually equivalent to:
- metadata;
- tokens;
- token string table;
- relations;
- adjacency records.
The exact binary contract is documented in
docs/FORMAT.md.
- Rust stable
- Cargo
Check your toolchain:
rustc --version
cargo --version
cargo build --workspace
cargo test --workspace
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
Run the CLI through Cargo:
cargo run -p lxdb-cli -- --help
Install it locally:
cargo install --path crates/lxdb-cli
After installation, the binary is available as:
lxdb
lxdb compile examples/knowledge.lx --output examples/knowledge.lxdb
Or through Cargo:
cargo run -p lxdb-cli -- compile examples/knowledge.lx --output examples/knowledge.lxdb
The accepted source syntax is documented in
docs/COMPILER.md.
Do not assume the textual source format is identical to the binary format. The source format is an authoring and testing interface; .lxdb is the runtime representation.
lxdb inspect examples/knowledge.lxdbExample output:
Dataset: knowledge.lxdb
Version: 0.1
Tokens: 7
Relations: 6
Adjacency records: 7
Token string table: 51 bytes
File size: 483 bytes
lxdb query examples/knowledge.lxdb rustExample:
rust
├─ 0.950 → language
├─ 0.700 → compiler
└─ 0.880 → memory
The exact output may evolve with the CLI.
The dictionary subsystem transforms external linguistic sources into an LXDB dataset.
Example:
lxdb dictionary build es \
--output datasets/generated/es.lxdbA development-sized build:
lxdb dictionary build es \
--output datasets/generated/es-dev.lxdb \
--limit 50000Force source updates:
lxdb dictionary build es \
--output datasets/generated/es.lxdb \
--refreshUse only locally cached sources:
lxdb dictionary build es \
--output datasets/generated/es.lxdb \
--offlineList supported languages:
lxdb dictionary languagesInspect the provenance of a generated dataset:
lxdb dictionary sources datasets/generated/es.lxdbSee the complete process in:
docs/dictionaries/README.md
The dictionary generator follows a reproducible pipeline:
language profile
↓
source resolution
↓
download/cache
↓
streaming extraction
↓
Unicode normalization
↓
lexical filtering
↓
deduplication
↓
lemma and form resolution
↓
semantic relation extraction
↓
optional offline similarity generation
↓
graph construction
↓
LXDB compilation
↓
dataset validation
↓
manifest and attribution output
A generated dataset must include enough metadata to identify:
- language;
- creation timestamp;
- LXDB format version;
- source snapshots;
- source licenses;
- generator version;
- normalization profile;
- filtering profile;
- relation strategy;
- optional embedding model and version.
Generated datasets are reproducible artifacts, not opaque binaries.
Every production dataset should be accompanied by a manifest:
datasets/generated/es/
├── dictionary.lxdb
├── manifest.json
├── ATTRIBUTION.md
└── build-report.json
Example manifest:
{
"language": "es",
"format_version": "0.1",
"generator_version": "0.1.0-alpha.1",
"created_at": "2026-07-30T10:00:00Z",
"sources": [
{
"name": "Kaikki Spanish",
"snapshot": "2026-07",
"license": "CC BY-SA / GFDL"
}
],
"normalization": {
"unicode": "NFC",
"case_policy": "preserve-and-fold",
"include_multiword_terms": true
}
}Generated files under datasets/generated/ are normally excluded from Git because they can be large and reproducible.
Small deterministic fixtures may be committed under:
datasets/fixtures/
[dependencies]
lxdb-storage = "0.1"
lxdb-engine = "0.1"Until crates are published, use the Git repository:
[dependencies]
lxdb-storage = {
git = "https://github.com/an0mal1a/lxdb",
tag = "v0.1.0-alpha.1"
}
lxdb-engine = {
git = "https://github.com/an0mal1a/lxdb",
tag = "v0.1.0-alpha.1"
}Example:
use lxdb_engine::BinaryDatasetExt;
use lxdb_storage::DatasetReader;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let dataset = DatasetReader::new().open("datasets/es.lxdb")?;
let query = dataset.query();
if let Some(token) = query.token_by_text("casa")? {
println!("Token: {}", token.text()?);
for relation in query.resolved_outgoing(token.id())? {
println!(
"{} -> {} ({:.3})",
relation.source().text()?,
relation.target().text()?,
relation.weight()
);
}
}
Ok(())
}Consult the crate-level documentation for the exact API supported by the current release.
LXDB follows several architectural rules:
- datasets are validated when opened;
- string data is resolved from shared tables;
- records are iterated lazily;
- runtime queries avoid rebuilding the complete graph;
- allocations are avoided where borrowing is possible;
- large source files are processed in streaming mode;
- generated output is written atomically;
- binary compatibility is versioned explicitly.
Benchmark notes will be added under docs/ as the benchmark suite grows.
Relations may represent:
- synonymy;
- antonymy;
- hypernymy;
- hyponymy;
- derivation;
- inflection;
- translation;
- general semantic proximity;
- embedding-generated neighbors.
A relation's numeric weight represents confidence or semantic strength according to the dataset's declared relation strategy.
Frequency is not treated as semantic similarity.
Dataset-specific semantics must be recorded in the manifest.
Small fixtures are intended for:
- compiler tests;
- storage validation;
- engine tests;
- API development;
- examples;
- CI.
The checked-in fixtures live under:
crates/lxdb-dictionary/tests/fixtures/
Large generated dictionaries should not be committed directly.
docs/
├── ARCHITECTURE.md
├── FORMAT.md
├── COMPILER.md
├── ENGINE.md
├── GRAPH.md
├── SPEC.md
├── CHANGELOG.md
├── dictionaries/
│ ├── README.md
│ ├── sources.md
│ ├── spanish.md
│ ├── normalization.md
│ ├── semantic-relations.md
│ └── reproducibility.md
└── ...
The top-level ROADMAP.md tracks planned work. See CONTRIBUTING.md for the development workflow and quality checks expected in every change.
Lexicon is the first game built on LXDB.
Lexicon uses LXDB to:
- validate player words;
- obtain semantic proximity;
- explore relationships;
- generate playable challenges;
- calculate deterministic game results.
Game rules, player sessions, daily challenges and statistics belong to Lexicon, not LXDB.
- stable source-to-binary compilation;
- validated dataset loading;
- token and relation queries;
- CLI compile, inspect and query commands;
- deterministic fixtures;
- documented binary format.
- multilingual dictionary pipeline;
- source provenance;
- lexical metadata;
- relation types;
- Spanish reference dataset.
- optimized indexes;
- configurable semantic paths;
- dataset packaging;
- benchmark suite;
- broader language support.
Contributions are welcome while the project is evolving.
Before opening a pull request:
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspaceChanges to the binary format must include:
- compatibility analysis;
- tests;
- format documentation;
- an architecture decision record when appropriate.
Do not open untrusted datasets without using the validated storage APIs.
Please report security issues privately instead of publishing exploitable details in a public issue.
LXDB is licensed under either of:
- Apache License, Version 2.0
- MIT License
at your option.
Generated dictionaries may contain data from sources with separate attribution or redistribution requirements. See each dataset's ATTRIBUTION.md and manifest before redistributing it.