language:
- en license: apache-2.0 library_name: sdory-dora tags:
- transformers
- peft
- dora
- recurrent-loop
- latent-recurrence
- zero-forgetting
- low-vram
- cybersecqwen
- qwen base_model: athena129/CyberSecQwen-4B pipeline_tag: text-generation inference: true
SDory-DoRA: Ready-Made Sparse Latent-Recurrent Architecture
SDory-DoRA is an industrial, ready-made deep learning architecture for AI & ML engineers. It fuses NVIDIA Dory's Latent-Recurrent Looping Core with Weight-Decomposed Low-Rank Adaptation (DoRA), Top-5% Sparsity Filtering, and Orthogonal Anti-Forgetting Constraints.
As an engineer, you do not need to design complex layers, manage VRAM leaks, or write autograd loops. The architecture is ready-made: you simply provide your dataset (.jsonl or .txt), and the engine handles the rest—whether adapting existing foundation models or training from scratch!
🚀 Instant Quickstart via PyPI
Install the official Python package in seconds:
pip install sdory-dora
💡 How Any Engineer Uses It
Option A: Ready-Made Pretrained Adaptation (2 Lines of Code)
Equip any foundation model (CyberSecQwen, Qwen2.5, LLaMA-3, Mistral) with zero-forgetting recurrent reasoning and train on your custom data:
from sdory_dora import SDory
# 1. Initialize ready-made architecture on any base model
engine = SDory.from_pretrained("athena129/CyberSecQwen-4B", loops=2)
# 2. Train on your dataset (JSONL or raw text)
engine.fit(data="my_dataset.jsonl", epochs=2, output_dir="checkpoints/my_skill")
# 3. Test interactively with elastic thinking loops
response = engine.chat("Explain Kerberos Golden Ticket attack and prevention.")
print(response)
Option B: Ready-Made Pre-Training from Scratch
Train a native S-Dory causal transformer architecture from zero weights:
from sdory_dora import SDory
# 1. Initialize native S-Dory architecture from scratch
engine = SDory.from_scratch(
vocab_size=32000,
hidden_size=768,
num_layers=12,
loops=2 # Elastic recurrent thinking loops
)
# 2. Train directly on your corpus
engine.fit(data="corpus.jsonl", epochs=3, output_dir="checkpoints/scratch_model")
# 3. Generate text
print(engine.chat("Security analysis of"))
Option C: Drop-in Transformers API (AutoSDoryModel)
Use it just like Hugging Face transformers to load models and micro-adapters directly:
from transformers import AutoTokenizer
from sdory_dora import AutoSDoryModel
# Load the architecture and weights directly from Hugging Face
model = AutoSDoryModel.from_pretrained("Navadeep-123/sdory-dora-cybersecqwen-4b", loops=2)
tokenizer = AutoTokenizer.from_pretrained("athena129/CyberSecQwen-4B")
prompt = "<|im_start|>user\nWhat is SQL injection?<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt")
# Standard Transformers-style autoregressive generation
output_ids = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
Option D: 1-Line Command Line Interface (CLI)
No code required—run training or interactive chat directly from your terminal:
# 1. Train on your data with pretrained base model
sdory train --model athena129/CyberSecQwen-4B --data "dataset.jsonl" --epochs 2 --loops 2
# 2. Train a native architecture from scratch
sdory train --from-scratch --data "corpus.jsonl" --epochs 5 --loops 2
# 3. Interactive chat with thinking loops
sdory chat --adapter "checkpoints/my_skill/trained_sdory_dora_skill.pt" --loops 2
🛠️ Complete Command & Parameter Reference
1. Terminal CLI Commands (sdory)
sdory train [OPTIONS]
Train the ready-made architecture on any dataset:
| Option Flag | Type | Default | Description |
|---|---|---|---|
--data |
str |
Required | Path to training file (.jsonl or .txt) |
--model |
str |
athena129/CyberSecQwen-4B |
Pretrained base model ID or path (Qwen, LLaMA, Mistral, etc.) |
--from-scratch |
flag |
False |
Train a native S-Dory causal transformer from scratch |
--epochs |
int |
2 |
Number of complete training epochs |
--loops |
int |
2 |
Number of Dory recurrent thinking loops (1: Fast, 2-4: Deep) |
--rank |
int |
8 |
DoRA decomposition rank $r$ |
--lr |
float |
3e-4 |
AdamW learning rate |
--max_samples |
int |
None |
Max sample rows to train (ideal for quick tests) |
--output_dir |
str |
checkpoints/sdory_trained_skill |
Directory where the 3.37 MB micro-adapter is saved |
sdory chat [OPTIONS]
Launch interactive terminal chat with elastic thinking loops:
| Option Flag | Type | Default | Description |
|---|---|---|---|
--model |
str |
athena129/CyberSecQwen-4B |
Base model or Hugging Face repo ID |
--adapter |
str |
"" |
Optional path to local .pt micro-adapter file |
--loops |
int |
2 |
Thinking depth (1: Fast single pass, 2: Standard, 3-4: Deep audit) |
2. Python API Reference
| Class / Method | Signature | Description |
|---|---|---|
SDory.from_pretrained() |
(model_name_or_path, loops=2, dora_rank=8, sparsity_ratio=0.05, load_in_4bit=True) |
Attaches ready-made S-Dory-DoRA architecture to any foundation LLM |
SDory.from_scratch() |
(vocab_size=32000, hidden_size=768, num_layers=12, loops=2) |
Creates a standalone native S-Dory transformer from scratch |
engine.fit() |
(data, epochs=2, learning_rate=3e-4, batch_size=1, output_dir=...) |
Trains the architecture with zero RAM leakage |
engine.chat() |
(prompt, loops=None, max_new_tokens=128) |
Runs interactive generation with elastic thinking loops |
AutoSDoryModel.from_pretrained() |
(pretrained_model_name_or_path, loops=2, ...) |
Transformers-compatible model loader for Hugging Face repos |
model.generate() |
(input_ids, max_new_tokens=128, temperature=0.7, top_p=0.9, loops=None) |
Autoregressive generation returning token id tensors |
model.save_micro_adapter() |
(output_dir, adapter_name="sdory_dora_adapter") |
Saves sparse 3.37 MB micro-skill weights |
model.load_micro_adapter() |
(adapter_path) |
Hot-swaps micro-adapter in < 0.1s without reloading base model |
🏛️ Complete Architecture Blueprint
Engineer's Dataset (JSONL / Raw Text)
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ 1. ZERO-RAM DIRECT DISK STREAMER │
│ • Direct-to-VRAM streaming without caching dataset in system RAM │
└────────────────────────────────────┬───────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ 2. INPUT ANCHOR LAYERS (Layers 0 to 7) │
│ • Encodes prompt tokens & establishes lexical context │
└────────────────────────────────────┬───────────────────────────────────┘
│
▼
╔══════════════════════════════════════════════════════════════════════════════╗
║ 3. RECURRENT DORY REASONING CORE (Middle Shared Layers) ║
║ (Executes K=1 to K=4 Thinking Loops on the same layer weights) ║
║ ║
║ ┌────────────────────────────────────────────────────────────────────┐ ║
║ │ SPARSITY FILTER (Top 5% Salient Expert Neurons) │ ║
║ │ • Prunes 95% inactive weights; micro-checkpoint size < 4 MB │ ║
║ └─────────────────────────────────┬──────────────────────────────────┘ ║
║ │ ║
║ ┌─────────────────────────────────▼──────────────────────────────────┐ ║
║ │ DoRA ENGINE (Decoupled Magnitude + Direction) │ ║
║ │ • Magnitude vector m in FP32 ensures 100% sharp reasoning clarity │ ║
║ └─────────────────────────────────┬──────────────────────────────────┘ ║
║ │ ║
║ ┌─────────────────────────────────▼──────────────────────────────────┐ ║
║ │ NULL-SPACE ORTHOGONAL PROJECTION │ ║
║ │ • Enforces W_new ⊥ W_base = 0 (Mathematically Zero Forgetting) │ ║
║ └────────────────────────────────────────────────────────────────────┘ ║
║ ║
║ ↺ Thinking Loop 1: Syntax Analysis & Pattern Identification ║
║ ↺ Thinking Loop 2: Exploit Path Analysis & Deep Synthesis ║
║ ↺ Thinking Loop 3: Verification & Formal Proof ║
║ ║
║ [Last-Loop KV Cache]: Only caches final loop -> Flat VRAM Allocation ║
╚══════════════════════════════════════════════════════════════════════════════╝
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ 4. OUTPUT ANCHOR LAYERS (Layers 28 to 35) + FACTUAL GUARD │
│ • Self-verifying confidence head measuring grounding scores │
└────────────────────────────────────┬───────────────────────────────────┘
│
▼
SHARP, FACTUAL, VERIFIED OUTPUT
📊 Empirical Hardware Benchmarks (RTX 5050 8GB Laptop GPU)
All numbers are measured directly on an active consumer laptop (NVIDIA RTX 5050 Laptop GPU, 8 GB VRAM, Windows 11):
| Metric | Traditional Fine-Tuning | Standard QLoRA | SDory-DoRA (Ours) | Improvement |
|---|---|---|---|---|
| GPU VRAM Allocation | 16 GB – 32 GB | 6.5 GB – 8.0 GB | 2,599 MB (~2.7 GB) | Fits comfortably in 8 GB VRAM |
| System RAM Overhead | 8 GB – 16 GB | 6 GB – 8 GB | < 1.0 GB | Zero-RAM Disk Streaming |
| Skill Checkpoint Size | 8,000 MB (8 GB) | 150 MB – 300 MB | 3.37 MB | 99.9% Storage Reduction |
| Training Speed (50 steps) | ~120s | ~65s | 17.6s | 3.7x Faster Convergence |
| Reasoning Depth | Fixed (36 Layers) | Fixed (36 Layers) | Elastic (1x to 4x Loops) | Dynamic Thinking Compute |
| Catastrophic Forgetting | Severe (> 40% loss) | Noticeable (~15% loss) | 0.0000% | Guaranteed by Orthogonal Projection |
🔬 Mathematical Formulations
1. Weight-Decomposed Low-Rank Adaptation (DoRA)
Instead of standard LoRA additive updates $W = W_0 + \Delta W$, DoRA decomposes the weight matrix into magnitude $m$ and directional matrix $V$: $$W = m \frac{V + \Delta V}{|V + \Delta V|_F}$$ where $\Delta V = B \cdot A$ ($r=8$), and $m = |W_0|_c$ is maintained in full 16-bit precision, eliminating the blurring effects of standard 4-bit quantization.
2. Null-Space Orthogonal Anti-Forgetting
To guarantee that new skills never overwrite foundational base knowledge, the new adapter weight subspace is strictly constrained to be orthogonal to the base model's principal components: $$\mathcal{L}{total} = \mathcal{L}{CE} + \lambda_{ortho} |B^T B - I|_F$$ Following training, post-epoch Gram-Schmidt orthogonal QR projection is enforced with column magnitude conservation: $$B^* = \text{QR}(B) \cdot \text{diag}(|B|_c)$$
3. Top-5% Expert Sparsity Filtering
During export, only the top 5% most salient neuron channels based on activation energy are preserved: $$M_{mask} = \mathbb{I}\left(|A_{ij}| \ge \text{Top}_{5%}(|A|)\right)$$ This compresses the final deployed adapter from hundreds of megabytes down to 3.37 MB.
📁 Repository Contents
skills/kerberos_security/trained_sdory_dora_skill.pt: Pretrained 3.37 MB micro-adapter for Kerberos AD security.skills/python_coding/trained_sdory_dora_skill.pt: Pretrained 3.37 MB micro-adapter for Python systems coding.SDORY_DORA_WHITEPAPER.md: Complete mathematical whitepaper.MODEL_CARD.md: Architectural specification and card.
📖 Citation
@software{sdory_dora_2026,
author = {VANTiX Labs},
title = {SDory-DoRA: Sparse Latent-Recurrent Decomposed Architecture for Zero-Forgetting LLM Adaptation and Pre-Training},
year = {2026},
publisher = {Hugging Face / PyPI},
url = {https://huggingface.co/Navadeep-123/sdory-dora-cybersecqwen-4b}
}
Metadata
Release files for sdory-dora 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sdory_dora-1.2.1.tar.gz | 31.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sdory_dora-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.1 kB
Release files / sdory_dora-1.2.1.tar.gz
| Download URL | sdory_dora-1.2.1.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5888e48f397116e98814341ded871a6c18a7f28504cf5cd7394f2c91b7ec3c14
|
|
BLAKE2b-256 checksum How to use checksums |
6fa5a6ef40b962db9c00e92ed5e4f48314166de870d5e3ecd320e37c95a2b744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / sdory_dora-1.2.1-py3-none-any.whl
| Download URL | sdory_dora-1.2.1-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cf8bc9117f26744d58af60be61c0d59fbdd8830068bcd8a33372081d379c6a7
|
|
BLAKE2b-256 checksum How to use checksums |
61659a91d0d884c3c961dd3f7290b847edb5d7fed41402a782b9044dde330141
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for sdory-dora 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.