Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- README.md +106 -20
- requirements.txt +10 -3
README.md
CHANGED
|
@@ -1,20 +1,106 @@
|
|
| 1 |
-
--
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MandelMem vs Chain-of-Thought Interactive Demo
|
| 2 |
+
|
| 3 |
+
A Streamlit application for comparing MandelMem's integrated multi-resolution reasoning architecture against Chain-of-Thought reasoning on mathematical problems.
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
|
| 7 |
+
- **Interactive Interface**: Enter mathematical questions and get real-time comparisons
|
| 8 |
+
- **MandelMem Integration**: Full integrated architecture with quadtree decomposition, fractal dynamics, and boundedness verification
|
| 9 |
+
- **Side-by-Side Comparison**: Compare reasoning processes, answers, and performance metrics
|
| 10 |
+
- **Sample Problems**: Pre-loaded examples across algebra, calculus, geometry, and more
|
| 11 |
+
- **Export Results**: Download comparison data as JSON
|
| 12 |
+
|
| 13 |
+
## Setup
|
| 14 |
+
|
| 15 |
+
1. **Install Dependencies**:
|
| 16 |
+
```bash
|
| 17 |
+
pip install -r requirements.txt
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
2. **Set OpenAI API Key**:
|
| 21 |
+
Create a `.env` file in this directory:
|
| 22 |
+
```
|
| 23 |
+
OPENAI_API_KEY=your_api_key_here
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
3. **Run the Application**:
|
| 27 |
+
```bash
|
| 28 |
+
streamlit run streamlit_app.py
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
1. Enter a mathematical problem in the text area
|
| 34 |
+
2. Click "Compare Methods" to run both MandelMem and Chain-of-Thought
|
| 35 |
+
3. View side-by-side results including:
|
| 36 |
+
- Final answers
|
| 37 |
+
- Complete reasoning processes
|
| 38 |
+
- Processing time and confidence scores
|
| 39 |
+
- Token usage statistics
|
| 40 |
+
4. Export results for further analysis
|
| 41 |
+
|
| 42 |
+
## Sample Problems
|
| 43 |
+
|
| 44 |
+
The app includes pre-loaded examples:
|
| 45 |
+
- **Basic Algebra**: Linear equations
|
| 46 |
+
- **Quadratic Equations**: Polynomial solving
|
| 47 |
+
- **Systems of Equations**: Multi-variable problems
|
| 48 |
+
- **Calculus**: Derivatives and integrals
|
| 49 |
+
- **Word Problems**: Real-world applications
|
| 50 |
+
- **Geometry**: Area, volume, and spatial reasoning
|
| 51 |
+
- **Complex Numbers**: Advanced mathematical concepts
|
| 52 |
+
|
| 53 |
+
## Architecture
|
| 54 |
+
|
| 55 |
+
**MandelMem Integrated Architecture**:
|
| 56 |
+
- Quadtree decomposition for hierarchical problem analysis
|
| 57 |
+
- Fractal iteration dynamics with convergence classification
|
| 58 |
+
- Multi-resolution zoom operations
|
| 59 |
+
- Boundedness verification and quality preservation
|
| 60 |
+
|
| 61 |
+
**Chain-of-Thought Baseline**:
|
| 62 |
+
- Step-by-step logical reasoning
|
| 63 |
+
- Clear problem breakdown
|
| 64 |
+
- Systematic solution approach
|
| 65 |
+
|
| 66 |
+
## Performance Metrics
|
| 67 |
+
|
| 68 |
+
- **Processing Time**: Execution speed comparison
|
| 69 |
+
- **Confidence Score**: Solution quality assessment
|
| 70 |
+
- **Token Usage**: Computational efficiency
|
| 71 |
+
- **Answer Accuracy**: Solution correctness (when verifiable)
|
| 72 |
+
|
| 73 |
+
## Export Format
|
| 74 |
+
|
| 75 |
+
Results can be exported as JSON containing:
|
| 76 |
+
```json
|
| 77 |
+
{
|
| 78 |
+
"question": "Problem statement",
|
| 79 |
+
"mandelmem": {
|
| 80 |
+
"answer": "Final answer",
|
| 81 |
+
"confidence": 0.85,
|
| 82 |
+
"processing_time": 12.34,
|
| 83 |
+
"tokens_used": 1500
|
| 84 |
+
},
|
| 85 |
+
"chain_of_thought": {
|
| 86 |
+
"answer": "Final answer",
|
| 87 |
+
"confidence": 0.78,
|
| 88 |
+
"processing_time": 8.92,
|
| 89 |
+
"tokens_used": 1200
|
| 90 |
+
},
|
| 91 |
+
"timestamp": "2025-08-21 14:56:36"
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## Requirements
|
| 96 |
+
|
| 97 |
+
- Python 3.8+
|
| 98 |
+
- OpenAI API access
|
| 99 |
+
- Streamlit 1.28.0+
|
| 100 |
+
- Internet connection for API calls
|
| 101 |
+
|
| 102 |
+
## About MandelMem
|
| 103 |
+
|
| 104 |
+
MandelMem is a multi-resolution reasoning architecture inspired by fractal dynamics and the Mandelbrot set. It uses quadtree decomposition to break problems into hierarchical regions, applies iterative dynamics for convergence analysis, and maintains solution quality through boundedness verification.
|
| 105 |
+
|
| 106 |
+
For more details, see the main MandelMem research paper and evaluation framework in the parent directory.
|
requirements.txt
CHANGED
|
@@ -1,3 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit>=1.28.0
|
| 2 |
+
openai>=1.0.0
|
| 3 |
+
python-dotenv>=1.0.0
|
| 4 |
+
torch>=2.0.0
|
| 5 |
+
numpy>=1.21.0
|
| 6 |
+
scipy>=1.7.0
|
| 7 |
+
hnswlib>=0.6.0
|
| 8 |
+
matplotlib>=3.5.0
|
| 9 |
+
dataclasses-json>=0.5.0
|
| 10 |
+
typing-extensions>=4.0.0
|