An advanced end-to-end framework for translating Natural Language questions into precise Relational Algebra (RA) and executing them on live databases. This project features a cinematic Web Interface, a robust Go-based backend, and a Python-powered AI engine aligned via Reinforcement Learning from Human Feedback (RLHF).
- Relational Algebra First: Translates natural language into RA logic before SQL generation, ensuring mathematical precision.
- Cinematic Web Interface: Built with Three.js and GSAP for a premium, data-visualized experience.
- Truly Custom Model Configuration: Specialized training script supporting "Frozen Layer" optimization (Layers 1-12) to retain core SQL logic while specializing in RA.
- Schema Discovery: Automatic database introspection to build precise LLM prompts without manual configuration.
- ORPO Alignment: Integrated preference optimization (Odds Ratio Preference Optimization) for fine-tuning performance based on real users' feedback.
- Frontend: HTML5, Vanilla CSS, Three.js (3D visualization), GSAP (animations).
- Backend: Go (Go-SQLite for local DBs, HTTP server for API management).
- AI Engine: Python, Unsloth (for 4-bit quantization and efficient LoRA), TRL (for ORPO training).
- Go (v1.21+)
- Python (v3.10+)
- PostgreSQL (Optional, for production mode)
Create a config.json in the root directory:
{
"driver": "postgres",
"dsn": "host=localhost port=5432 user=postgres password=mysecretpassword dbname=myproject sslmode=disable",
"dialect": "postgres"
}We recommend using the included setup.bat for automatic Windows configuration:
# Or manual setup
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtStep 1: Start the AI Inference Server
python python/server.pyStep 2: Launch the Web UI
go run main.go web
# Or use the shortcut
launch_forge.batTo train your own "Truly Custom" model using the feedback gathered in the Forge:
- Collect feedback via the UI (Correct/Partial/Wrong buttons).
- Run the specialized training script:
python python/train_rl.pyNote: This script implements local layer freezing (Layers 1-12) to maximize training stability.
To measure the actual accuracy of the model, execute the evaluation script against the Spider dataset:
# Evaluate model outputs (e.g. against the first 100 questions)
python python/eval.py --n 100This generates real-time metrics including Exact Match, Execution Accuracy, and Relational Algebra Validity.
This project was developed for advanced study in Natural Language to Logic translation.