Skip to main content

Crate lattice_embed

Crate lattice_embed 

Source
Expand description

§lattice-embed

Pure-Rust local embedding generation, caching, SIMD vector operations, and model migration. Most of the crate, including model loading and SIMD dispatch, is Unstable; consumers should normally use it through lattice-engine.

The exception is the stable 0.4.x ANN contract in simd: squared/ordinary L2 distance, dot product, and cosine similarity retain their (&[f32], &[f32]) -> f32 APIs and documented degenerate-input behavior. SIMD is not bit-identical to scalar, so near-tie ordering is not guaranteed.

See docs/design.md for the architecture, service lifecycle, cache identity, and migration boundaries; use docs/INDEX.md to find subsystem references.

Re-exports§

pub use service::MAX_TEXT_CHARS;Deprecated
pub use service::DEFAULT_MAX_BATCH_SIZE;
pub use service::EmbeddingRole;
pub use service::EmbeddingService;
pub use service::MAX_TEXT_BYTES;
pub use simd::SimdConfig;
pub use simd::simd_config;
pub use service::CachedEmbeddingService;
pub use service::NativeEmbeddingService;

Modules§

backfill
Public API for model-migration backfills.
migration
Public API for the embedding-model migration state machine.
service
Async embedding-service contract and native implementations.
simd
SIMD vector operations for embedding similarity and compressed-vector search.
types
Vector-space identity and storage-format descriptors for lattice-embed.
utils
Utility functions for vector operations.
vision
Image (and image+text) embedding through the Qwen3.5 vision-language pooled-embedding pipeline (ADR-069 S5, #1007).

Structs§

CacheStats
Unstable: metrics fields may be added/removed as monitoring needs evolve.
EmbeddingCache
Unstable: the sharding and eviction implementation may change.
ModelConfig
Runtime model configuration with an optional MRL truncation dimension.
ModelProvenance
Stable: external consumers may depend on this; breaking changes require a SemVer bump.
ShardStats
Unstable: shard count is an internal implementation detail; this struct may be removed.

Enums§

EmbedError
Stable: external consumers may depend on this; breaking changes require a SemVer bump.
EmbeddingModel
Stable: external consumers may depend on this; breaking changes require a SemVer bump.

Constants§

DEFAULT_CACHE_CAPACITY
Unstable: tuning constant; value may change as memory models evolve.
MIN_MRL_OUTPUT_DIM
Minimum allowed MRL output dimension.

Type Aliases§

Result
Stable: result type alias for embedding operations.