Skip to main content

EgoRA RRL — Rotation-Retention Law Analysis

PyPI version License: AGPL v3 Python 3.9+

Rotation-Retention Law: threshold analysis, knowledge mapping, and gradient alignment diagnostics for fine-tuned neural networks. Companion package to egora.

Installation

pip install egora-rrl

With plotting and dataset support:

pip install egora-rrl[all]

Modules

1. Threshold Analysis (Rotation-Retention Law)

Tests the empirical law $\Delta M \propto \bar{\theta}$:

  • Dimensionality-aware critical threshold: $\theta_{\text{crit}} = \arcsin(1/\sqrt{d_{\text{head}}})$
  • Golden ratio $k$-check
  • Phase transition detection
  • Cross-architecture validation
from egora import compute_head_geometry
from egora_rrl import run_threshold_analysis

geo = compute_head_geometry(base_model, tuned_model)
results = run_threshold_analysis(
    geo, model_name="llama_8b",
    mmlu_base=63.42, mmlu_after=62.86,
    output_dir="analysis/",
)

2. Knowledge Map

Logit lens, attention probing, and Knowledge Concentration Index (KCI) to locate where knowledge lives in the model.

from egora_rrl import run_knowledge_map

summary = run_knowledge_map(model, tokenizer, output_dir="analysis/")

3. Alignment Landscape

Per-head gradient alignment between fine-tuning and capability-preservation directions. Identifies critical heads.

from egora_rrl import run_alignment_landscape

landscape = run_alignment_landscape(
    model, tokenizer,
    finetune_data=ft_loader,
    capability_data=cap_loader,
)

Resources

Link
📦 PyPI pip install egora-rrl
💻 GitHub ArsSocratica/EgoRA
� DOI 10.5281/zenodo.19410504

License

This software is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0), with an Additional Permission for Academic Use pursuant to AGPL Section 7.

  • Academic use: Free, no copyleft obligations, citation required. See LICENSE-ACADEMIC.
  • Commercial use: Requires both a software license and a patent license.

Patent Notice

The methods implemented in this software are covered by U.S. Provisional Patent Application No. 64/024,742, filed April 1, 2026, by Mark Dillerop.

Contact: mark@dillerop.com

Metadata

Release files for egora-rrl 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for egora-rrl 0.3.1
File Size Uploaded
egora_rrl-0.3.1.tar.gz 21.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for egora-rrl 0.3.1
File Interpreter ABI Platform
egora_rrl-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.8 kB

Release files / egora_rrl-0.3.1.tar.gz

Download URL egora_rrl-0.3.1.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96ffa5834475a6e4a01289c0948031115f85aa64ef7679d013fcb275851eec7a
BLAKE2b-256 checksum
How to use checksums
07a28c228844da9bd43f5b85646ae39b3e14f0a676472ba2b51dc7b596292dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / egora_rrl-0.3.1-py3-none-any.whl

Download URL egora_rrl-0.3.1-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53f216d076a3b28e9fb6757cec67fe503c75084281e28e1e936896e541982b56
BLAKE2b-256 checksum
How to use checksums
17c3143a9c215020b893c672c4dddfd2026c87cd490ef9ead95f544577430cac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.1.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page