Spaces:
Running
on
Zero
Running
on
Zero
metadata
title: GASM-LLM Geometric Language Processing
emoji: π§
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.0.0
app_file: app.py
pinned: false
license: cc-by-nd-4.0
π§ GASM Enhanced - Geometric Language Processing
A HuggingFace Space for geometric language processing using GASM (Geometric Attention with Spatial & Mathematical understanding).
β¨ Features
- SE(3) Invariant Processing: Mathematically correct geometric attention mechanisms
- Real-time Entity Extraction: Advanced text analysis with spatial relationship detection
- Interactive Visualizations: 3D entity positioning and curvature evolution plots
- Gradio Interface: User-friendly web interface for text analysis
- CPU/GPU Support: Automatic fallback system with ZeroGPU compatibility
π― What is GASM?
GASM (Geometric Attention with Spatial & Mathematical understanding) enhances language models by:
- Geometric Entity Processing: Extracts spatial entities and relationships from text
- SE(3) Invariant Attention: Applies proper geometric transformations preserving spatial structure
- Curvature Evolution: Tracks convergence through geometric manifold optimization
- 3D Visualization: Renders entity positions in interactive 3D space
π Quick Start
Using the Space
- Enter Text: Input any text with spatial, temporal, or physical relationships
- Enable Geometry: Toggle geometric processing for enhanced analysis
- View Results: See entity extraction, 3D positioning, and curvature evolution
- Explore Visualizations: Interactive plots show geometric convergence
Example Inputs
Try these examples to see GASM in action:
"The robotic arm moves the satellite component above the assembly platform while the crystal detector rotates around its central axis."
"The electron orbits the nucleus while the magnetic field flows through the crystal lattice structure."
"The ball lies left of the table next to the computer, while the book sits between the keyboard and the monitor."
π Project Structure
GASM-Huggingface/
βββ app.py # Main Gradio application with complete interface
βββ gasm_core.py # Core GASM implementation with SE(3) math
βββ fastapi_endpoint.py # Optional API endpoints (standalone)
βββ requirements.txt # Python dependencies
βββ README.md # This file
π§ Technical Implementation
Core Components
- SE3InvariantAttention: Mathematically correct SE(3) geodesic distance computation
- EfficientCurvatureComputation: Graph Laplacian-based discrete curvature analysis
- ConstraintHandler: Energy-based constraint satisfaction with Lagrange multipliers
- RealGASMInterface: Main processing interface with entity extraction
Key Features
- Robust Error Handling: Graceful fallbacks at every processing step
- Dependency Management: Works with or without PyTorch Geometric, Geomstats
- Memory Efficient: Optimized for Space deployment constraints
- Real-time Processing: Step-by-step debug output with progress tracking
π¨ Visualizations
The Space provides two main visualizations:
1. Curvature Evolution Plot
- Shows geometric convergence over iterations
- Displays SE(3) manifold optimization progress
- Uses matplotlib with dark theme for clarity
2. 3D Entity Space Plot
- Interactive 3D positioning of extracted entities
- Color-coded by entity type (robotic, physical, spatial, etc.)
- Shows relationship connections between entities
π¬ How It Works
- Text Input: User provides text for analysis
- Entity Extraction: Regex-based extraction of meaningful entities
- Relation Detection: Identification of spatial, temporal, physical relations
- GASM Processing: If available, real SE(3) forward pass through geometric manifold
- Visualization: Generate curvature evolution and 3D entity plots
- Results: Comprehensive analysis with JSON output
β‘ Performance
- CPU Mode: Optimized for HuggingFace Spaces CPU allocation
- GPU Fallback: Automatic ZeroGPU usage when available
- Memory Efficient: ~430MB total memory footprint
- Fast Processing: 0.1-0.8s processing time depending on text length
π οΈ Local Development
To run locally:
git clone <this-repo>
cd GASM-Huggingface
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py
π Space Configuration
This Space is configured with:
- SDK: Gradio 4.44.1+
- Python: 3.8+
- GPU: ZeroGPU compatible (A10G/T4 fallback)
- Memory: 16GB RAM allocation
- Storage: Persistent storage for model caching
π API Endpoints
The Space also exposes FastAPI endpoints (when fastapi_endpoint.py is run separately):
POST /process
: Process text with geometric enhancementGET /health
: Health check and memory usageGET /info
: Model configuration information
π Use Cases
Perfect for analyzing:
- Technical Documentation: Spatial relationships in engineering texts
- Scientific Literature: Physical phenomena and experimental setups
- Educational Content: Geometry and physics explanations
- Robotic Systems: Assembly instructions and spatial configurations
π― Model Details
- Base Architecture: Built on transformer foundations
- Geometric Processing: SE(3) Lie group operations
- Attention Mechanism: Geodesic distance-based attention weighting
- Curvature Computation: Discrete Gaussian curvature via graph Laplacian
- Constraint Handling: Energy minimization with Lagrange multipliers
π License
Licensed under CC-BY-NC 4.0. All rights reserved, Versino PsiOmega GmbH.
π Acknowledgments
- HuggingFace for Spaces platform
- PyTorch and PyTorch Geometric teams
- Geomstats geometric computing library
- Gradio for the intuitive interface framework
Made with β€οΈ by the Versino PsiOmega development team
Try the Space above to see geometric language processing in action!