A comprehensive web interface for experimenting with Ollama parameters and understanding how they affect model responses.
- Interactive Parameter Controls: Sliders and toggles for all major Ollama parameters
- Real-time Parameter Adjustment: See parameter values change in real-time
- Streaming Responses: Choose between streaming and non-streaming responses
- Parameter Presets: Quick presets for Creative, Balanced, and Precise configurations
- Model Management: Automatic detection of available Ollama models
- Quick Test Prompts: Pre-made prompts to test different parameter effects
- Modern UI: Clean, responsive interface with visual feedback
- Temperature (0.0-2.0): Controls randomness. Lower = more deterministic, higher = more creative
- Top P (0.0-1.0): Nucleus sampling - limits token choices by cumulative probability
- Top K (1-100): Limits to top K most likely tokens
- Repeat Penalty (0.5-2.0): Penalizes repetitive text (1.0 = no penalty)
- Context Length: Number of tokens to keep in context window
- Max Response Length: Maximum tokens to generate in response
- Seed: For reproducible results (optional)
- Mirostat: Alternative to temperature/top_p sampling
- Mirostat Tau: Target entropy level
- Mirostat Eta: Learning rate for entropy adjustment
-
Install Ollama:
# On macOS brew install ollama # On Linux curl -fsSL https://ollama.ai/install.sh | sh # On Windows - download from https://ollama.ai
-
Start Ollama service:
ollama serve
-
Pull at least one model:
# Example models ollama pull llama2 ollama pull codellama ollama pull mistral
-
Clone or create project directory:
mkdir ollama-parameter-explorer cd ollama-parameter-explorer -
Create the directory structure:
mkdir templates
-
Save the files:
- Save the Flask backend code as
app.py - Save the HTML template as
templates/index.html - Save requirements as
requirements.txt
- Save the Flask backend code as
-
Install Python dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and go to:
http://localhost:5000
ollama-parameter-explorer/
├── app.py # Flask backend
├── requirements.txt # Python dependencies
├── templates/
│ └── index.html # Frontend template
└── README.md # This file
- Ensure Ollama is running (
ollama serve) - Start the Flask app (
python app.py) - Open
http://localhost:5000in your browser - Select a model from the dropdown
- Adjust parameters using the sliders and toggles
- Enter a message and click send
- Temperature 0.1: "The capital of France is Paris." (same answer every time)
- Temperature 1.5: "The capital of France is Paris, that magnificent city of lights and romance!" (varied, creative responses)
- Try asking "What is 2+2?" at different temperatures to see how it affects even simple questions
- High Top P (0.9) + Low Top K (10): Contradictory - gives inconsistent results
- Low Top P (0.5) + High Top K (50): Also contradictory - Top P will override Top K
- Best practice: Use either Top P OR Top K, not both at extreme values
- Try disabling one (set Top K to 100 or Top P to 1.0) to see the other's pure effect
- Ask for a story without repeat penalty (1.0) - notice natural repetition
- Set repeat penalty to 1.5+ - see how the AI awkwardly avoids repeating words
- Sweet spot is usually 1.1-1.3 for most use cases
- Creative: Perfect for "Write a story about..." prompts
- Balanced: Great for general questions and conversations
- Precise: Use for "Explain how..." or "What is..." questions
- Check if Ollama is running:
ps aux | grep ollama - Start Ollama:
ollama serve - Verify port 11434 is accessible
- Pull at least one model:
ollama pull llama2 - Check available models:
ollama list
- Reduce context length
- Reduce max response length
- Try a smaller model
- Check if port 11434 is blocked by firewall
- Verify Ollama is running on localhost:11434
- Try restarting Ollama service
GET /api/models- Get available Ollama modelsPOST /api/chat- Send chat request with parametersGET /api/health- Check Ollama connection status
- Modern browsers with ES6+ support
- Chrome, Firefox, Safari, Edge
- Mobile responsive design
Feel free to submit issues and enhancement requests!