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
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

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.1.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.1-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: egora_diagnostics-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e74d08cb59577138526c8c3a0040eab7bdd344b5524b003de4192f5b5ac368b6
MD5 49be1dfb0a70375497a1d44610c1f227
BLAKE2b-256 01ee7ffc08c075357515a431a149dc87caea073b9d342b6fc0ea2940f4eb374b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for egora_diagnostics-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42213e0b90167c88515d4f7a306a8d7ee9be50c07e33d62160fa7bbccb4f1a57
MD5 7a99a09bcefdf52242ac03a6e0bfe47c
BLAKE2b-256 4c263e59cc3b78a04fb45c0cc9df533cb59ed0330a9688ffbaacf9132ddfff6a

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