Qwen-GeoGebra-Coder-7B
Developed by: Khurram Pervez, Assistant Professor of Mathematics
This repository contains a specialized AI pipeline designed to transform natural language mathematical descriptions into real-time GeoGebra 3D visualizations. By combining a fine-tuned Qwen-Coder backbone with a custom FastAPI processing layer, the system bridges the gap between abstract reasoning and geometric plotting.
π How It Works
The system operates via a three-stage pipeline designed for mathematical accuracy:
1. Chain-of-Thought (CoT) Reasoning
When a user submits a prompt (e.g., "Create a cylinder with radius 3 and height 10"), the model first enters a <thought> state. It calculates the spatial coordinates, base-point, and top-point vectors required by GeoGebra's engine before generating any code.
2. Smart Command Extraction (The FastAPI Layer)
LLMs often output coordinates in various styles (e.g., [<0,0,0>] or [3,0,0]). GeoGebra is strict about its syntax: Cylinder(Point, Point, Radius).
Our custom clean_and_format_ggb function acts as a mathematical transpiler:
- Standardization: Converts angle brackets
< >and square brackets[ ]into standard parentheses( ). - Coordinate Mapping: Identifies base/top points and extracts the scalar radius from the spatial reasoning.
- Validation: Ensures the final string is a valid GeoGebra command like
Cylinder((0,0,0), (0,10,0), 3.0).
3. Real-Time Rendering
The app.html interface uses the GeoGebra Discovery/Classic API to inject the generated commands into a live 3D canvas, allowing for immediate visual verification of mathematical concepts.
πΈ Interface Example
π οΈ Installation & Setup
Prerequisites
- Hardware: NVIDIA RTX 4060 Ti (16GB VRAM recommended).
- Environment: Ubuntu 22.04+, Python 3.10+,
llama-cpp-python.
Local Deployment
To run this research interface on your local machine:
- Download Files: Download
server.py,app.html, andmath_viz_Q4_K_M.ggufinto one folder. - Install Requirements:
pip install fastapi uvicorn llama-cpp-python
- Downloads last month
- 142
4-bit