Skip to main content

Synapto

PyPI Version License

Synaptic Weight Eviction (SWE) Engine for Dynamic LLM Memory Consolidation

synapto is a PyTorch framework implementing native online memory consolidation for Large Language Models. Instead of relying indefinitely on expanding KV-caches or external RAG retrieval, synapto catches evicted token blocks during generation, calculates their surprisal score, and consolidates high-value information directly into an unquantized dynamic memory layer (top 10-15% of weights) using real-time micro-backpropagation.


Why Synapto?

Feature Standard KV-Cache RAG Retrieval Synapto (SWE Engine)
Memory Location VRAM Context Window External Vector DB Model Weights (FP16 Top Layers)
Compute Overhead Quadratic Explosion Search & Retrieval Latency Zero Prompt Overhead ($O(1)$)
Information Retention Lost upon eviction Fragmented snippets Native Synaptic Weight Recall
Privacy / Encryption Plain VRAM text Unencrypted DB records E2E AES-256 + Salt & Pepper

Architecture Overview

  • Static Core (80-90%): Quantized to 4-bit NF4 to minimize VRAM footprint (~5 GB VRAM for 7B models).
  • Dynamic Memory (10-20%): Unquantized FP16/BF16 top layers updated in milliseconds via micro-backprop.
  • Elastic Weight Anchoring: $L_2$ regularization anchor prevents parameter drift and preserves reasoning capabilities.
  • Multi-Sample Replay Buffer: Protects previously consolidated memories against catastrophic forgetting.

Installation

pip install synapto-llm

Code Examples

1. Manual Fact Consolidation

from synapto import SynaptoEngine

# Initialize SWE engine for Qwen 2.5 7B
engine = SynaptoEngine(
    model_id="Qwen/Qwen2.5-7B-Instruct", 
    p_value=1.5, 
    dynamic_layers=4
)

prompt = "Secret passcode for NervOS core:"
completion = " 8821-NERV-PRO."

# Consolidate fact into dynamic weights
engine.consolidate(prompt, completion)

# Generate response purely from updated model weights (no KV-cache used)
response = engine.generate_response(prompt)
print(response)

# Export dynamic memory weights with E2E encryption
engine.save_memory_profile("user_memory.safetensors", encryption_key="master_password")

2. Live Chat Stream Processor

from synapto import SynaptoEngine, ChatStreamProcessor

engine = SynaptoEngine(model_id="Qwen/Qwen2.5-7B-Instruct", p_value=1.5)
processor = ChatStreamProcessor(engine, max_window_tokens=512)

# As context overflows 512 tokens, evicted turns automatically consolidate into model weights
processor.process_turn("My safe passcode is 9942-ALPHA.", "Got it, saved securely.")

Security & Privacy Guarantees

  • Zero-Trust Weight Storage: Memory profiles are saved exclusively in .safetensors format.
  • E2E Metadata Encryption: Journal metadata is encrypted using AES-256-CBC with PBKDF2 key derivation, cryptographic salt, and system pepper.
  • Target Loss Masking: Prompt tokens are masked (ignore_index=-100) during micro-backpropagation.

License

Developed independently by Bodya. Released under the MIT License.

Download files

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

Source Distribution

synapto_llm-0.2.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

synapto_llm-0.2.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file synapto_llm-0.2.1.tar.gz.

File metadata

  • Download URL: synapto_llm-0.2.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.2

File hashes

Hashes for synapto_llm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4a42866add9e1694d9b09ec77bca08a46bd8ff75b27f18ca550eca80575bf5ca
MD5 ecdbd33668add5c66c22e708250abdc9
BLAKE2b-256 a97318d3d909620eecb05deead743e6d588bba5a4c90529c7c54935b48827f07

See more details on using hashes here.

File details

Details for the file synapto_llm-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: synapto_llm-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.2

File hashes

Hashes for synapto_llm-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 760ac58b73a5c3d9304f24c3bdbbf77f4c0108f92cfa99372a287fdde5133ef8
MD5 36794a0548d019f95fbae24869dab5b0
BLAKE2b-256 a739fa1af4173214b2213fc70970b5b370288f5db8b075ea29836cfa5b048d3c

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