GeoGebra AI Logo

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

GeoGebra AI Research Interface

πŸ› οΈ 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:

  1. Download Files: Download server.py, app.html, and math_viz_Q4_K_M.gguf into one folder.
  2. Install Requirements:
    pip install fastapi uvicorn llama-cpp-python
    
Downloads last month
142
GGUF
Model size
8B params
Architecture
qwen2
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Khurram123/Qwen-GeoGebra-Coder-7B

Base model

Qwen/Qwen2.5-7B
Quantized
(171)
this model