Local llm
Troubleshooting Guide: Local LLM Integration Issues with R2R
When integrating local Language Models (LLMs) with R2R, you may encounter various issues. This guide will help you diagnose and resolve common problems.
1. Ollama Connection Issues
Symptom: R2R can’t connect to Ollama
-
Check Ollama is running:
Ensure the Ollama container is up and running.
-
Verify Ollama API accessibility:
This should return a list of available models.
-
Check R2R configuration: Ensure the
OLLAMA_API_BASE
environment variable is set correctly in your R2R configuration: -
Network connectivity: Ensure Ollama and R2R containers are on the same Docker network.
Solution:
- If Ollama isn’t running, start it with
docker-compose up -d ollama
- If API is inaccessible, check Ollama logs:
docker logs ollama
- Correct the
OLLAMA_API_BASE
if necessary - Ensure both services are on the
r2r-network
in your Docker Compose file
2. Model Loading Issues
Symptom: Specified model isn’t available or fails to load
-
List available models:
-
Attempt to pull the model:
-
Check Ollama logs for pull errors:
Solution:
- If the model isn’t listed, pull it using the Ollama CLI
- If pull fails, check internet connectivity and Ollama’s GitHub for known issues
- Ensure sufficient disk space for model storage
3. Performance Issues
Symptom: Local LLM responses are slow or timeouts occur
-
Check system resources:
Look for high CPU or memory usage.
-
Verify GPU utilization (if applicable):
-
Review Ollama configuration: Check if Ollama is configured to use GPU acceleration.
Solution:
- Increase resources allocated to the Ollama container
- Enable GPU acceleration if available
- Consider using a smaller or more efficient model
4. Inconsistent Responses
Symptom: LLM responses are inconsistent or unexpected
-
Verify model version:
Ensure you’re using the intended model version.
-
Check prompt template: Review the prompt template in your R2R configuration for any issues.
-
Test model directly:
Compare direct results with those from R2R.
Solution:
- Update to the latest model version if necessary
- Adjust prompt templates in R2R configuration
- Ensure consistent tokenization and preprocessing in R2R
5. Integration Configuration Issues
Symptom: R2R doesn’t use the local LLM as expected
-
Review R2R configuration: Check your
r2r.toml
or environment variables to ensure local LLM is properly configured. -
Verify LLM provider settings: Ensure the correct provider (e.g., ‘ollama’) is set in your configuration.
-
Check R2R logs: Look for any errors or warnings related to LLM initialization.
Solution:
- Correct configuration settings in
r2r.toml
or environment variables - Ensure the LLM provider is correctly specified
- Restart R2R after configuration changes
6. Memory Management Issues
Symptom: Out of memory errors or crashes during LLM operations
-
Monitor memory usage:
-
Check Ollama logs for OOM errors:
-
Review model specifications: Ensure your hardware meets the minimum requirements for the chosen model.
Solution:
- Increase memory allocation for the Ollama container
- Use a smaller model if hardware is limited
- Implement request queuing in R2R to manage concurrent LLM calls
7. API Compatibility Issues
Symptom: R2R fails to communicate properly with Ollama
-
Check Ollama version:
-
Review R2R documentation: Ensure you’re using a compatible version of Ollama for your R2R version.
-
Test basic API calls:
Solution:
- Update Ollama to a compatible version
- Adjust R2R code if using custom integrations
- Check for any middleware or proxy issues affecting API calls
Getting Further Help
If you’re still experiencing issues after trying these troubleshooting steps:
- Gather relevant logs from both R2R and Ollama
- Note your system specifications and R2R configuration
- Check the R2R GitHub issues for similar problems
- Consider posting a detailed question on the R2R Discord community or GitHub discussions
Remember to provide:
- R2R version (
r2r --version
) - Ollama version
- Docker and Docker Compose versions
- Host system specifications
- Detailed error messages and logs
By following this guide, you should be able to resolve most common issues with local LLM integration in R2R. If problems persist, don’t hesitate to reach out to the R2R community for further assistance.