A simple web interface for interacting with the LLaMA-3.2-1B-Instruct fine-tuned model.
This project now uses a direct communication approach:
- The web interface directly communicates with the model server
- No intermediary API proxy is needed
- The URL to the model server is configurable in the UI
This approach solves deployment issues with serverless platforms and provides more flexibility.
- Clean, responsive user interface
- Easy input of prompts and questions
- Display of model-generated responses
- Wide selection of math-specialized models
- Configuration via dropdown menu
- Configurable model server URL
You can deploy the frontend (index.html) to any static hosting service:
- Vercel, Netlify, GitHub Pages, etc.
- Simply deploy the repository and the static file will be served
The model server needs to be hosted separately on a machine with enough resources to run the LLaMA model:
- Set up a server (e.g., AWS EC2, Google Cloud, DigitalOcean)
- Clone this repository
- Install dependencies:
pip install -r model_server_requirements.txt - Run the model server:
python model_server.py
Alternatively, you can use a service like Hugging Face Inference API to host the model.
- Access the web interface
- Enter your Hugging Face API token in the token field and click "Save Token"
- Enter your question in the prompt field
- Click "Get Answer" to get a response from the model
The project uses a configuration file (config.js) to store model options:
// config.js
const CONFIG = {
// Default model to use
DEFAULT_MODEL: "ai-nexuz/llama-3.2-1b-instruct-fine-tuned",
// Available models - you can add/remove models as needed
MODELS: [
// ...model definitions...
]
};The Hugging Face API token is stored securely in your browser's local storage after you enter it in the user interface.
The application provides access to several AI models specialized in mathematics:
| Model | Description | Strengths |
|---|---|---|
| LLaMA-3.2-1B | Default fine-tuned model | Balanced performance with small size |
| Meta-Llama-3-8B | Larger base model | More comprehensive reasoning |
| Microsoft Phi-2 | Smaller, faster model | Quick responses for simpler problems |
| DeepSeek Math 7B | Specialized for mathematics | Advanced mathematical reasoning |
| Gemma 7B | Google's instruction model | Strong general math capabilities |
| Mistral 7B | High-performance model | Good balance of speed and accuracy |
| Smaug 34B | Very large model | Complex multi-step problem solving |
| WizardMath 7B | Math-focused fine-tuning | Specialized mathematical explanations |
| MAmmoTH 7B | Math assistant model | Step-by-step solution walkthrough |
Different models may perform better on different types of math problems. If one model struggles with a particular question, try another from the dropdown menu.
To run the complete system locally:
- Ensure you have Python 3.9 installed
- Create a virtual environment:
python3.9 -m venv venv source venv/bin/activate - Install all dependencies:
pip install -r model_server_requirements.txt - Start the model server:
python model_server.py - Open the index.html file directly in your browser or serve it with a simple HTTP server:
python -m http.server - In the web interface, set the Model Server URL to
http://localhost:5000/generate
- The model may take a few seconds to load initially
- The model server uses lazy loading to initialize the model only when needed
- The model requires approximately 5GB of RAM to run efficiently
- CORS is enabled on the model server to allow direct browser access
- Frontend: HTML, CSS, JavaScript
- Model Server: Flask, PyTorch, Transformers
- Model: LLaMA-3.2-1B-Instruct fine-tuned