Skip to main content

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

Project description

EgoRA Diagnostics — Rotation-Retention Law & Knowledge Mapping

PyPI version License: AGPL v3 Python 3.9+

Advanced diagnostic tools for analyzing fine-tuned neural networks. Companion package to egora.

Installation

pip install egora-diagnostics

With plotting and dataset support:

pip install egora-diagnostics[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_diagnostics 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_diagnostics 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_diagnostics import run_alignment_landscape

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

Resources

Link
📦 PyPI pip install egora-diagnostics
💻 GitHub ArsSocratica/EgoRA
📄 Paper arXiv:2602.05192

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

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

egora_diagnostics-0.3.0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

egora_diagnostics-0.3.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file egora_diagnostics-0.3.0.tar.gz.

File metadata

  • Download URL: egora_diagnostics-0.3.0.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for egora_diagnostics-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7a9b07b82da62115e80f374908b8d23c1ed29408b73b06e4c1126e1371837cc9
MD5 2dd355d1e3078481ceb8ed425e470a93
BLAKE2b-256 4702d14ac16552d62799daa3b929380c537f0ae6931f546d0d441785b60c9098

See more details on using hashes here.

File details

Details for the file egora_diagnostics-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for egora_diagnostics-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faf4d6549cf109bd056b6165c7ed84078a716190a5651f20244b27827350d6b8
MD5 a01eb79cecd3d267ac9e3fed4300192c
BLAKE2b-256 5cec87841eba6eac3eee254aec7d9770215bce6a6eb063b4d984d2df560c8b2e

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