There is a newer version of the record available.

Published January 22, 2026 | Version v2
Preprint Open

DillanJC/geometric_safety_features: v1.0.0 - Geometric Safety Features for AI Boundary Detection

Authors/Creators

Description

geometric_safety_features v1.0.0: Production Release
This is the production release of geometric_safety_features, a Python library for computing geometric uncertainty signals from embedding spaces to detect high-uncertainty regions in AI models, with applications to AI safety diagnostics.
Key Features
- 7 Core Geometric Features: k-NN based metrics including knn_std_distance (neighborhood spread), knn_mean_distance, knn_min_distance, knn_max_distance, local_curvature, ridge_proximity, and dist_to_ref_nearest
- Advanced Baselines: S-score (density-scaled dispersion), class-conditional Mahalanobis distance, and conformal prediction for uncertainty quantification
- Scalable Backends: sklearn (default) and FAISS (optional) for high-performance nearest neighbor search on large datasets
- Comprehensive Validation: Boundary-stratified evaluation methodology with reproducible experiments
Validation Results
Rigorous evaluation demonstrates significant improvements in detecting high-uncertainty regions:
- +12.5% improvement in borderline cases (p < 0.001)
- +11.4% improvement in unsafe regions (p < 0.001)
- knn_std_distance identified as the most consistent uncertainty signal across datasets
Technical Details
- Language: Python 3.9+
- Dependencies: NumPy, SciPy, scikit-learn
- Optional: FAISS for performance scaling
- License: MIT
- Documentation: Complete API reference and usage examples
Installation
# Install from PyPI
pip install geometric-safety-features
# For high-performance backend
pip install geometric-safety-features[faiss]
Usage Example
from mirrorfield.geometry import GeometryBundle
import numpy as np
# Load embeddings
reference = np.random.randn(1000, 256)
query = np.random.randn(100, 256)
# Compute geometric features
bundle = GeometryBundle(reference, k=50)
features = bundle.compute(query)
# Access uncertainty signals
uncertainty_scores = features['knn_std_distance']
Files Included
- geometric_safety_features-1.0.0.tar.gz: Complete source distribution
- geometric_safety_features-1.0.0-py3-none-any.whl: Python wheel for easy installation
- Full test suite and documentation
Related Resources
- GitHub Repository: https://github.com/DillanJC/geometric_safety_features
- PyPI Package: https://pypi.org/project/geometric-safety-features/
- Technical Report: See docs/TECHNICAL_REPORT.md for complete methodology and results
Citation

DOI will be assigned by Zenodo after this release.

Files

Files (23.0 kB)

Name Size Download all
md5:694f5f2771adfa079356210f7c3792cb
23.0 kB Download

Additional details

Related works