This document serves as the formal specification for Valori's determinism. If two Valori nodes report identical proofs, their memory state is mathematically identical.
The following operations are guaranteed to be bit-identical across all supported platforms (x86_64, ARM64, WASM) and OSs (Linux, macOS, Windows):
- Vector Storage: Vectors are stored as Q16.16 fixed-point integers.
- Input
0.1is converted to6553(0x1999) on all platforms. - Rounding and clamping logic is strictly defined.
- Input
- L2 Distance Calculation: Square distances are computed using
i32/i64integer arithmetic.- No FMA (Fused Multiply-Add) variance.
- No non-associativity of float addition.
- Graph Construction:
- Node IDs are allocated sequentially based on "First Free Slot" logic.
- Edge links are deterministic given the same order of operations.
- Indexing (Brute Force):
- Search results are sorted by (Score, ID).
- Ties are broken deterministically by ID (ASC).
Valori does NOT guarantee determinism for:
- Neural Inference: The upstream embedding models (e.g. PyTorch/ONNX) are often non-deterministic across GPUs/CPUs. Valori guarantees storage after the vector is produced.
- Wall-Clock Timing: Response latency and query throughput.
- Unordered Ingestion: If client A sends Record 1 then 2, and client B sends Record 2 then 1, the resulting internal state (Slot IDs) WILL differ, although semantic search results may be equivalent.
- Note: This will result in Mismatching Proofs, which is correct behavior (History Divergence).
A node
Where:
-
$Command_0 \dots Command_T$ is the immutable WAL. -
$Apply$ is the pure kernel transition function.
Any deviation from this function (bit rot, hardware error, software bug) is considered a critical failure and will be detected by valori-verify.