Skip to main content

Mathematically proven conflict-free merge for AI model weights, datasets, and agent memory. Zero dependencies. Patent pending.

Project description

crdt-merge

The first merge library where every operation is mathematically guaranteed to converge.
Tabular data. Neural network weights. Distributed agents. One unified CRDT layer.

PyPI version Downloads Python 3.9+ Tests CRDT Compliance License: BSL 1.1

pip install crdt-merge

Documentation · Quick Start · API Reference · Architecture · Changelog


Every merge algorithm you use is broken. This one isn't.

Every standard merge strategy — weight averaging, SLERP, TIES, DARE, Fisher — fails at least one of the three algebraic laws required for distributed convergence. This isn't an implementation bug. It's mathematically provable. crdt-merge is the fix: a patented two-layer architecture that makes any merge strategy — including inherently stochastic and non-commutative ones — fully CRDT-compliant.

The result: 26 strategies, all guaranteed to produce identical output regardless of merge order, grouping, or duplication. No coordination. No locking. No central arbiter.

Patent Pending — UK Application No. 2607132.4

How it works — full architecture, mathematical proofs, and the 7 architectures we evaluated →


What you can do with it

Federated Model Merging Without a Parameter Server

100 hospitals train locally, merge globally — no coordinator, no single point of failure. Any node can produce the final model. Late arrivals are absorbed automatically. Guide →

Convergent Multi-Agent AI

Agents share and merge beliefs via CRDT state — no orchestrator picks winners. Works offline, across partitions, at any scale. Guide →

Privacy-Preserving Merge

Merge encrypted data without decryption. Four AEAD backends. The merging party never sees plaintext. Guide →

The Right to Forget in Trained Models

GDPR erasure in milliseconds — surgically remove a contributor's influence without retraining. Guide →

MergeQL — Query Language for Distributed Knowledge

SQL-like syntax for CRDT-correct multi-source merges with full provenance. Guide →

Provenance-Complete AI

Per-field, per-decision audit trail — SHA-256 hash-chained, tamper-evident, EU AI Act ready. Guide →

LoRA Adapter Merging

Mixed-rank adapters merged with per-module strategy selection and SVD rank harmonization. Guide →

Continual Learning Without Catastrophic Forgetting

Absorb new tasks as post-training merges — no data replay, no model growth, full knowledge retention. Guide →

Gossip Protocol Sync

Serverless state convergence via digest-based anti-entropy. You provide the transport. Guide →

Probabilistic CRDTs at Planetary Scale

HyperLogLog, Bloom filters, Count-Min Sketch — all natively CRDT-mergeable across 500+ nodes. Guide →

Delta Sync & Merkle Verification

Ship only what changed. Prove convergence in O(log n). Guide →

Runtime CRDT Verification

Property-based proof that any merge function satisfies all three laws. Catches violations at import time. Guide →

Agentic Memory at Scale

O(1) dedup across 1M+ agent memories. Budget-aware context merge. Crash recovery from peers. Guide →


Quick Start

# Tabular
from crdt_merge import CRDTDataFrame
merged = CRDTDataFrame(df_a, node_id="a").merge(CRDTDataFrame(df_b, node_id="b"))

# Model weights
from crdt_merge.model import CRDTMergeState
state = CRDTMergeState()
state.add("model-a", weights_a)
state.add("model-b", weights_b)
merged = state.merge(strategy="slerp")  # order of add() never matters

# Verify any merge function
from crdt_merge import verified_merge

@verified_merge
def my_merge(a, b):
    return your_logic(a, b)  # raises CRDTViolationError if laws are broken

Full API reference →


Installation

pip install crdt-merge            # Core — zero dependencies
pip install crdt-merge[fast]      # DuckDB + Polars (38.8× on A100)
pip install crdt-merge[model]     # PyTorch model weights
pip install crdt-merge[crypto]    # AEAD encryption backends
pip install crdt-merge[all]       # Everything

Zero required dependencies. Python 3.9–3.12. Linux, macOS, Windows.

All install options →


By the Numbers

Test suite 3,041 tests, 0 failures
CRDT compliance tests 1,200 / 1,200
Merge strategies 26
CRDT overhead < 0.5ms per merge
Model speedup vs. naive 38.8×
Encryption backends 4
Architectures evaluated 7 → 1 winner

Cross-Language Ports

Language Package Status
Python (reference) crdt-merge v0.9.4 Full feature set
Rust crdt-merge v0.2.0 Core CRDTs + merge
TypeScript crdt-merge v0.2.0 Core CRDTs + merge
Java crdt-merge v0.2.0 Source complete

License

BSL 1.1 → automatically converts to Apache 2.0 on 29 March 2028.

Free for research, personal use, and most production use. Source-available. Not free for competing commercial merge-as-a-service.

The PATENTS file includes a defensive patent grant (UK Application 2607132.4). See LICENSE, CLA.

Copyright 2026 Ryan Gillespie. Commercial licensing: rgillespie83@icloud.com · data@optitransfer.ch


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crdt_merge-0.9.4.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crdt_merge-0.9.4-py3-none-any.whl (430.3 kB view details)

Uploaded Python 3

File details

Details for the file crdt_merge-0.9.4.tar.gz.

File metadata

  • Download URL: crdt_merge-0.9.4.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for crdt_merge-0.9.4.tar.gz
Algorithm Hash digest
SHA256 7fa9c872a0f849381c1eaeb8c5787743ec8a3e3a6f1d0316809de789821d7de5
MD5 8d9037bd28e430e2d516816e4a4f60e8
BLAKE2b-256 69f9cb7a6405524f4721b952026e9b07f14b8c8c3f898a1190a0aae38aa35190

See more details on using hashes here.

File details

Details for the file crdt_merge-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: crdt_merge-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 430.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for crdt_merge-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ba51714c6ffc6eb7a402234b50bb1056cac1d848d81aa635ce33dbda9b4bba84
MD5 33b37cf582c1840242ce7f27ec32c895
BLAKE2b-256 1c3f6c4d86879faafc14f283d13b9924fd1f53bc1ba6a518f87557d07e0654af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page