Getting Started
Set Your LLM API Key
Google AI Studio has a free API usage quota. Create a key here to use weco
for free.
Start Optimization
Now run Weco to discover the best version of your code:
Here's what you can expect to see (keep an eye on that Best Solution
panel):

Apply Weco to your own Project
Grab Your API Key
Based on the LLM you want to use, set the following environment variables:
-
OpenAI:
-
Anthropic:
-
Google DeepMind:
Google AI Studio has a free API usage quota. Create a key here to use
weco
for free.
Figure Out Your Evaluation Script
TLDR: The evaluation script should print the target metric and its value to the terminal.
Our technology is designed to optimize code that you can evaluate using a script.
We call this paradigm metric-driven coding, which deviates from the more well-known vibe-driven coding paradigm.
For tasks with a clear objective, we've found that metric-driven coding leads to far better results without the need for a human in the loop.
This enables weco
to iteratively explore and refine your code over large search spaces and long periods of time.
If you've already figured out your evaluation script, skip to the Run Weco section. If not, you can start with a simple evaluation script that prints the target metric and its value to the terminal.
For specific examples of evaluation scripts for kernel engineering (PyTorch, CUDA, Triton etc.,), ML research and prompt engineering, check out the Examples section. If you'd like to know how to write a good evaluation script, we've got you covered with this guide.
Basic Example
Here's a simple example that optimizes a PyTorch function for speedup. You can also follow along here on Google Colab.
First install the dependencies:
Then create a file called optimize.py
with the following code:
Then create a file called evaluate.py
with the following code:
Now run Weco to optimize your code:
Note: If you have an NVIDIA GPU, change the device in the
--eval-command
tocuda
. If you are running this on Apple Silicon, set it tomps
.
Beyond the Basics
Weco can be used for a variety of optimization tasks. For more detailed examples, visit the Examples section.
To understand how to write a good evaluation script, see the Writing Good Evaluation Scripts guide.
For detailed information about command arguments and technical details, see the CLI Reference.