A simple benchmark of LLM speed
This tool benchmarks the performance of various Large Language Models (LLMs) across different providers.
Clone the repository:
git clone https://github.com/your-username/llm-benchmark-tool.git
cd llm-benchmark-tool
Install the required dependencies:
pip install -r requirements.txt
Set up environment variables for API keys:
export OCTO_API_KEY=your_octo_api_key
export GROQ_API_KEY=your_groq_api_key
export FIREWORKS_API_KEY=your_fireworks_api_key
export CEREBRAS_API_KEY=your_cerebras_api_key
export TOGETHER_API_KEY=your_together_api_key
Run the benchmark with default settings:
python benchmark.py
Customize the benchmark:
python benchmark.py --provider fireworks --prompt "Explain quantum computing" --n 5
benchmark.py
: Main script for running the benchmarkproviders.py
: Definitions of LLM providersrequirements.txt
: List of Python dependenciesREADME.md
: This fileTo add a new LLM provider to the benchmark tool, follow these steps:
Open the providers.py
file.
Add a new entry to the PROVIDERS
dictionary with the following format:
"provider_name": Provider(
client=openai.OpenAI(
base_url="https://api.provider.com/v1",
api_key=os.environ.get("PROVIDER_API_KEY")
),
model="provider-model-name"
)
Replace provider_name
, https://api.provider.com/v1
, PROVIDER_API_KEY
, and provider-model-name
with the appropriate values for the new provider.
Add the new provider's API key to your environment variables:
export PROVIDER_API_KEY=your_provider_api_key
Update the README to include the new provider in the list of supported providers and add the new environment variable to the setup instructions.
Test the new provider by running the benchmark with the new provider name:
python benchmark.py --provider provider_name
Remember to ensure that the new provider's API is compatible with the OpenAI client format used in this tool. If it's not, you may need to modify the call_llama
function in benchmark.py
to handle any differences in the API structure.
You can visualize the results with Weights & Biases Weave:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.