weco 0.2.28__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {weco-0.2.28 → weco-0.3.1}/.gitignore +6 -1
  2. {weco-0.2.28 → weco-0.3.1}/PKG-INFO +52 -55
  3. {weco-0.2.28 → weco-0.3.1}/README.md +51 -54
  4. {weco-0.2.28 → weco-0.3.1}/examples/README.md +8 -12
  5. {weco-0.2.28 → weco-0.3.1}/examples/cuda/README.md +7 -18
  6. {weco-0.2.28 → weco-0.3.1}/examples/cuda/evaluate.py +10 -28
  7. {weco-0.2.28 → weco-0.3.1}/examples/hello-kernel-world/README.md +2 -12
  8. {weco-0.2.28 → weco-0.3.1}/examples/hello-kernel-world/colab_notebook_walkthrough.ipynb +95 -135
  9. {weco-0.2.28 → weco-0.3.1}/examples/hello-kernel-world/evaluate.py +10 -1
  10. {weco-0.2.28 → weco-0.3.1}/examples/prompt/README.md +3 -5
  11. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/README.md +2 -6
  12. {weco-0.2.28 → weco-0.3.1}/examples/triton/README.md +8 -21
  13. {weco-0.2.28 → weco-0.3.1}/examples/triton/evaluate.py +10 -27
  14. {weco-0.2.28 → weco-0.3.1}/pyproject.toml +1 -1
  15. {weco-0.2.28 → weco-0.3.1}/weco/api.py +164 -59
  16. {weco-0.2.28 → weco-0.3.1}/weco/auth.py +12 -14
  17. {weco-0.2.28 → weco-0.3.1}/weco/chatbot.py +18 -3
  18. {weco-0.2.28 → weco-0.3.1}/weco/cli.py +75 -1
  19. {weco-0.2.28 → weco-0.3.1}/weco/constants.py +6 -3
  20. weco-0.3.1/weco/credits.py +172 -0
  21. {weco-0.2.28 → weco-0.3.1}/weco/optimizer.py +415 -89
  22. {weco-0.2.28 → weco-0.3.1}/weco/panels.py +6 -18
  23. {weco-0.2.28 → weco-0.3.1}/weco/utils.py +9 -54
  24. {weco-0.2.28 → weco-0.3.1}/weco.egg-info/PKG-INFO +52 -55
  25. {weco-0.2.28 → weco-0.3.1}/weco.egg-info/SOURCES.txt +1 -1
  26. weco-0.2.28/examples/cuda/guide.md +0 -89
  27. {weco-0.2.28 → weco-0.3.1}/.github/workflows/lint.yml +0 -0
  28. {weco-0.2.28 → weco-0.3.1}/.github/workflows/release.yml +0 -0
  29. {weco-0.2.28 → weco-0.3.1}/LICENSE +0 -0
  30. {weco-0.2.28 → weco-0.3.1}/assets/example-optimization.gif +0 -0
  31. {weco-0.2.28 → weco-0.3.1}/assets/weco.svg +0 -0
  32. {weco-0.2.28 → weco-0.3.1}/contributing.md +0 -0
  33. {weco-0.2.28 → weco-0.3.1}/examples/cuda/optimize.py +0 -0
  34. {weco-0.2.28 → weco-0.3.1}/examples/hello-kernel-world/optimize.py +0 -0
  35. {weco-0.2.28 → weco-0.3.1}/examples/prompt/eval.py +0 -0
  36. {weco-0.2.28 → weco-0.3.1}/examples/prompt/optimize.py +0 -0
  37. {weco-0.2.28 → weco-0.3.1}/examples/prompt/prompt_guide.md +0 -0
  38. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/competition_description.md +0 -0
  39. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/data/sample_submission.csv +0 -0
  40. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/data/test.csv +0 -0
  41. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/data/train.csv +0 -0
  42. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/evaluate.py +0 -0
  43. {weco-0.2.28 → weco-0.3.1}/examples/spaceship-titanic/train.py +0 -0
  44. {weco-0.2.28 → weco-0.3.1}/examples/triton/optimize.py +0 -0
  45. {weco-0.2.28 → weco-0.3.1}/setup.cfg +0 -0
  46. {weco-0.2.28 → weco-0.3.1}/weco/__init__.py +0 -0
  47. {weco-0.2.28 → weco-0.3.1}/weco.egg-info/dependency_links.txt +0 -0
  48. {weco-0.2.28 → weco-0.3.1}/weco.egg-info/entry_points.txt +0 -0
  49. {weco-0.2.28 → weco-0.3.1}/weco.egg-info/requires.txt +0 -0
  50. {weco-0.2.28 → weco-0.3.1}/weco.egg-info/top_level.txt +0 -0
@@ -24,9 +24,11 @@ wheels/
24
24
  .coverage
25
25
  htmlcov/
26
26
  .env
27
+ .env.*
27
28
  .venv
28
29
  venv/
29
30
  ENV/
31
+ .envrc
30
32
 
31
33
  # VSCode Extension
32
34
  node_modules/
@@ -63,6 +65,9 @@ Thumbs.db
63
65
  # Linting
64
66
  .ruff_cache/
65
67
 
68
+ # UV
69
+ uv.lock
70
+
66
71
  # Miscellaneous
67
72
  etc/
68
73
 
@@ -78,4 +83,4 @@ CLAUDE.md
78
83
  repomix-output.*
79
84
 
80
85
  # Claude config
81
- .claude/
86
+ .claude/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weco
3
- Version: 0.2.28
3
+ Version: 0.3.1
4
4
  Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
5
5
  Author-email: Weco AI Team <contact@weco.ai>
6
6
  License:
@@ -270,16 +270,17 @@ The `weco` CLI leverages a tree search approach guided by LLMs to iteratively ex
270
270
  1. **Install the Package:**
271
271
 
272
272
  ```bash
273
- pip install weco>=0.2.18
273
+ pip install weco
274
274
  ```
275
275
 
276
- 2. **Set Up LLM API Keys (Required):**
276
+ 2. **Authenticate (Required):**
277
277
 
278
- `weco` requires API keys for the LLMs it uses internally. You **must** provide these keys via environment variables:
278
+ `weco` now uses a **credit-based billing system** with centralized LLM access. You need to authenticate to use the service:
279
279
 
280
- - **OpenAI:** `export OPENAI_API_KEY="your_key_here"` (Create your OpenAI API key [here](https://platform.openai.com/api-keys))
281
- - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"` (Create your Anthropic API key [here](https://console.anthropic.com/settings/keys))
282
- - **Google:** `export GEMINI_API_KEY="your_key_here"` (Google AI Studio has a free API usage quota. Create your Gemini API key [here](https://aistudio.google.com/apikey) to use `weco` for free.)
280
+ - **Run the CLI**: `weco` will prompt you to authenticate via your web browser
281
+ - **Free Credits**: New users receive **free credits** upon signup
282
+ - **Centralized Keys**: All LLM provider API keys are managed by Weco (no BYOK required)
283
+ - **Credit Top-ups**: Purchase additional credits through the dashboard at [dashboard.weco.ai](https://dashboard.weco.ai)
283
284
 
284
285
  ---
285
286
 
@@ -338,6 +339,8 @@ weco run --source optimize.py \
338
339
 
339
340
  For more advanced examples, including [Triton](/examples/triton/README.md), [CUDA kernel optimization](/examples/cuda/README.md), [ML model optimization](/examples/spaceship-titanic/README.md), and [prompt engineering for math problems](examples/prompt/README.md), please see the `README.md` files within the corresponding subdirectories under the [`examples/`](examples/) folder.
340
341
 
342
+ > Note: When recommend removing any backticks from your code if any are present. We currently don't support backticks but will support this in the future.
343
+
341
344
  ---
342
345
 
343
346
  ### Arguments for `weco run`
@@ -358,8 +361,8 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
358
361
  | Argument | Description | Default | Example |
359
362
  | :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------ |
360
363
  | `-n, --steps` | Number of optimization steps (LLM iterations) to run. | 100 | `-n 50` |
361
- | `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-0`). | `o4-mini` when `OPENAI_API_KEY` is set; `claude-sonnet-4-0` when `ANTHROPIC_API_KEY` is set; `gemini-2.5-pro` when `GEMINI_API_KEY` is set. | `-M o4-mini` |
362
- | `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
364
+ | `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-0`). | `o4-mini` | `-M o4-mini` |
365
+ | `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. Supported file formats include - `.txt`, `.md`, and `.rst`. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
363
366
  | `-l, --log-dir` | Path to the directory to log intermediate steps and final optimization result. | `.runs/` | `-l ./logs/` |
364
367
  | `--eval-timeout` | Timeout in seconds for each step in evaluation. | No timeout (unlimited) | `--eval-timeout 3600` |
365
368
  | `--save-logs` | Save execution output from each optimization step to disk. Creates timestamped directories with raw output files and a JSONL index for tracking execution history. | `False` | `--save-logs` |
@@ -368,24 +371,24 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
368
371
 
369
372
  ### Authentication & Dashboard
370
373
 
371
- Weco offers both **anonymous** and **authenticated** usage:
372
-
373
- #### Anonymous Usage
374
- You can use Weco without creating an account by providing LLM API keys via environment variables. This is perfect for trying out Weco or for users who prefer not to create accounts.
374
+ The CLI requires a Weco account for authentication and billing.
375
375
 
376
- #### Authenticated Usage (Recommended)
377
- To save your optimization runs and view them on the Weco dashboard, you can log in using Weco's secure device authentication flow:
376
+ #### Credit-Based Authentication (Required)
377
+ Weco now requires authentication for all operations. This enables our credit-based billing system and provides access to powerful optimizations:
378
378
 
379
- 1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in or skip
379
+ 1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in
380
380
  2. **Manual login**: Use `weco logout` to clear credentials, then run `weco` again to re-authenticate
381
381
  3. **Device flow**: Weco will open your browser automatically and guide you through a secure OAuth-style authentication
382
382
 
383
383
  ![image (16)](https://github.com/user-attachments/assets/8a0a285b-4894-46fa-b6a2-4990017ca0c6)
384
384
 
385
- **Benefits of authenticated usage:**
386
- - **Run history**: View all your optimization runs on the Weco dashboard
387
- - **Progress tracking**: Monitor long-running optimizations remotely
388
- - **Enhanced support**: Get better assistance with your optimization challenges
385
+ **Benefits:**
386
+ - **No API Key Management**: All LLM provider keys are managed centrally
387
+ - **Cost Transparency**: See exactly how many credits each optimization consumes
388
+ - **Free Trial**: Free credits to get started with optimization projects
389
+ - **Run History**: View all your optimization runs on the Weco dashboard
390
+ - **Progress Tracking**: Monitor long-running optimizations remotely
391
+ - **Budget Control**: Set spending limits and auto top-up preferences
389
392
 
390
393
  ---
391
394
 
@@ -398,6 +401,7 @@ To save your optimization runs and view them on the Weco dashboard, you can log
398
401
  | `weco` | Launch interactive onboarding | **Recommended for beginners** - Analyzes your codebase and guides you through setup |
399
402
  | `weco /path/to/project` | Launch onboarding for specific project | When working with a project in a different directory |
400
403
  | `weco run [options]` | Direct optimization execution | **For advanced users** - When you know exactly what to optimize and how |
404
+ | `weco resume <run-id>` | Resume an interrupted run | Continue from the last completed step |
401
405
  | `weco logout` | Clear authentication credentials | To switch accounts or troubleshoot authentication issues |
402
406
 
403
407
  ### Model Selection
@@ -413,14 +417,37 @@ weco run --model claude-3.5-sonnet --source optimize.py [other options...]
413
417
  ```
414
418
 
415
419
  **Available models:**
416
- - `gpt-4o`, `o4-mini` (requires `OPENAI_API_KEY`)
417
- - `claude-3.5-sonnet`, `claude-sonnet-4-20250514` (requires `ANTHROPIC_API_KEY`)
418
- - `gemini-2.5-pro` (requires `GEMINI_API_KEY`)
420
+ - `o4-mini`, `o3-mini`, `gpt-4o` (OpenAI models)
421
+ - `claude-sonnet-4-0`, `claude-opus-4-0` (Anthropic models)
422
+ - `gemini-2.5-pro`, `gemini-2.5-flash` (Google models)
419
423
 
420
- If no model is specified, Weco automatically selects the best available model based on your API keys.
424
+ All models are available through Weco's centralized system. If no model is specified, Weco automatically selects the best model for your optimization task.
421
425
 
422
426
  ---
423
427
 
428
+ ### Resuming Interrupted Runs
429
+
430
+ If your optimization run is interrupted (network issues, restart, etc.), resume from the most recent node:
431
+
432
+ ```bash
433
+ # Resume an interrupted run
434
+ weco resume 0002e071-1b67-411f-a514-36947f0c4b31
435
+
436
+ ```
437
+
438
+ Arguments for `weco resume`:
439
+
440
+ | Argument | Description | Example |
441
+ |----------|-------------|---------|
442
+ | `run-id` | The UUID of the run to resume (shown at the start of each run) | `0002e071-1b67-411f-a514-36947f0c4b31` |
443
+
444
+ Notes:
445
+ - Works only for interrupted runs (status: `error`, `terminated`, etc.).
446
+ - You’ll be prompted to confirm that your evaluation environment (source file + evaluation command) hasn’t changed.
447
+ - The source file is restored to the most recent solution before continuing.
448
+ - All progress and metrics from the original run are preserved.
449
+ - Log directory, save-logs behavior, and evaluation timeout are reused from the original run.
450
+
424
451
  ### Performance & Expectations
425
452
 
426
453
  Weco, powered by the AIDE algorithm, optimizes code iteratively based on your evaluation results. Achieving significant improvements, especially on complex research-level tasks, often requires substantial exploration time.
@@ -493,37 +520,7 @@ Weco will parse this output to extract the numerical value (1.5 in this case) as
493
520
 
494
521
  ## Supported Models
495
522
 
496
- Weco supports the following LLM models:
497
-
498
- ### OpenAI Models
499
- - `gpt-5` (recommended)
500
- - `gpt-5-mini`
501
- - `gpt-5-nano`
502
- - `o3-pro` (recommended)
503
- - `o3` (recommended)
504
- - `o4-mini` (recommended)
505
- - `o3-mini`
506
- - `o1-pro`
507
- - `o1`
508
- - `gpt-4.1`
509
- - `gpt-4.1-mini`
510
- - `gpt-4.1-nano`
511
- - `gpt-4o`
512
- - `gpt-4o-mini`
513
- - `codex-mini-latest`
514
-
515
- ### Anthropic Models
516
- - `claude-opus-4-1`
517
- - `claude-opus-4-0`
518
- - `claude-sonnet-4-0`
519
- - `claude-3-7-sonnet-latest`
520
-
521
- ### Gemini Models
522
- - `gemini-2.5-pro`
523
- - `gemini-2.5-flash`
524
- - `gemini-2.5-flash-lite`
525
-
526
- You can specify any of these models using the `-M` or `--model` flag. Ensure you have the corresponding API key set as an environment variable for the model provider you wish to use.
523
+ A list of models we support can be found in our documentation [here](https://docs.weco.ai/cli/supported-models).
527
524
 
528
525
  ---
529
526
 
@@ -43,16 +43,17 @@ The `weco` CLI leverages a tree search approach guided by LLMs to iteratively ex
43
43
  1. **Install the Package:**
44
44
 
45
45
  ```bash
46
- pip install weco>=0.2.18
46
+ pip install weco
47
47
  ```
48
48
 
49
- 2. **Set Up LLM API Keys (Required):**
49
+ 2. **Authenticate (Required):**
50
50
 
51
- `weco` requires API keys for the LLMs it uses internally. You **must** provide these keys via environment variables:
51
+ `weco` now uses a **credit-based billing system** with centralized LLM access. You need to authenticate to use the service:
52
52
 
53
- - **OpenAI:** `export OPENAI_API_KEY="your_key_here"` (Create your OpenAI API key [here](https://platform.openai.com/api-keys))
54
- - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"` (Create your Anthropic API key [here](https://console.anthropic.com/settings/keys))
55
- - **Google:** `export GEMINI_API_KEY="your_key_here"` (Google AI Studio has a free API usage quota. Create your Gemini API key [here](https://aistudio.google.com/apikey) to use `weco` for free.)
53
+ - **Run the CLI**: `weco` will prompt you to authenticate via your web browser
54
+ - **Free Credits**: New users receive **free credits** upon signup
55
+ - **Centralized Keys**: All LLM provider API keys are managed by Weco (no BYOK required)
56
+ - **Credit Top-ups**: Purchase additional credits through the dashboard at [dashboard.weco.ai](https://dashboard.weco.ai)
56
57
 
57
58
  ---
58
59
 
@@ -111,6 +112,8 @@ weco run --source optimize.py \
111
112
 
112
113
  For more advanced examples, including [Triton](/examples/triton/README.md), [CUDA kernel optimization](/examples/cuda/README.md), [ML model optimization](/examples/spaceship-titanic/README.md), and [prompt engineering for math problems](examples/prompt/README.md), please see the `README.md` files within the corresponding subdirectories under the [`examples/`](examples/) folder.
113
114
 
115
+ > Note: When recommend removing any backticks from your code if any are present. We currently don't support backticks but will support this in the future.
116
+
114
117
  ---
115
118
 
116
119
  ### Arguments for `weco run`
@@ -131,8 +134,8 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
131
134
  | Argument | Description | Default | Example |
132
135
  | :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------ |
133
136
  | `-n, --steps` | Number of optimization steps (LLM iterations) to run. | 100 | `-n 50` |
134
- | `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-0`). | `o4-mini` when `OPENAI_API_KEY` is set; `claude-sonnet-4-0` when `ANTHROPIC_API_KEY` is set; `gemini-2.5-pro` when `GEMINI_API_KEY` is set. | `-M o4-mini` |
135
- | `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
137
+ | `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-0`). | `o4-mini` | `-M o4-mini` |
138
+ | `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. Supported file formats include - `.txt`, `.md`, and `.rst`. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
136
139
  | `-l, --log-dir` | Path to the directory to log intermediate steps and final optimization result. | `.runs/` | `-l ./logs/` |
137
140
  | `--eval-timeout` | Timeout in seconds for each step in evaluation. | No timeout (unlimited) | `--eval-timeout 3600` |
138
141
  | `--save-logs` | Save execution output from each optimization step to disk. Creates timestamped directories with raw output files and a JSONL index for tracking execution history. | `False` | `--save-logs` |
@@ -141,24 +144,24 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
141
144
 
142
145
  ### Authentication & Dashboard
143
146
 
144
- Weco offers both **anonymous** and **authenticated** usage:
145
-
146
- #### Anonymous Usage
147
- You can use Weco without creating an account by providing LLM API keys via environment variables. This is perfect for trying out Weco or for users who prefer not to create accounts.
147
+ The CLI requires a Weco account for authentication and billing.
148
148
 
149
- #### Authenticated Usage (Recommended)
150
- To save your optimization runs and view them on the Weco dashboard, you can log in using Weco's secure device authentication flow:
149
+ #### Credit-Based Authentication (Required)
150
+ Weco now requires authentication for all operations. This enables our credit-based billing system and provides access to powerful optimizations:
151
151
 
152
- 1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in or skip
152
+ 1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in
153
153
  2. **Manual login**: Use `weco logout` to clear credentials, then run `weco` again to re-authenticate
154
154
  3. **Device flow**: Weco will open your browser automatically and guide you through a secure OAuth-style authentication
155
155
 
156
156
  ![image (16)](https://github.com/user-attachments/assets/8a0a285b-4894-46fa-b6a2-4990017ca0c6)
157
157
 
158
- **Benefits of authenticated usage:**
159
- - **Run history**: View all your optimization runs on the Weco dashboard
160
- - **Progress tracking**: Monitor long-running optimizations remotely
161
- - **Enhanced support**: Get better assistance with your optimization challenges
158
+ **Benefits:**
159
+ - **No API Key Management**: All LLM provider keys are managed centrally
160
+ - **Cost Transparency**: See exactly how many credits each optimization consumes
161
+ - **Free Trial**: Free credits to get started with optimization projects
162
+ - **Run History**: View all your optimization runs on the Weco dashboard
163
+ - **Progress Tracking**: Monitor long-running optimizations remotely
164
+ - **Budget Control**: Set spending limits and auto top-up preferences
162
165
 
163
166
  ---
164
167
 
@@ -171,6 +174,7 @@ To save your optimization runs and view them on the Weco dashboard, you can log
171
174
  | `weco` | Launch interactive onboarding | **Recommended for beginners** - Analyzes your codebase and guides you through setup |
172
175
  | `weco /path/to/project` | Launch onboarding for specific project | When working with a project in a different directory |
173
176
  | `weco run [options]` | Direct optimization execution | **For advanced users** - When you know exactly what to optimize and how |
177
+ | `weco resume <run-id>` | Resume an interrupted run | Continue from the last completed step |
174
178
  | `weco logout` | Clear authentication credentials | To switch accounts or troubleshoot authentication issues |
175
179
 
176
180
  ### Model Selection
@@ -186,14 +190,37 @@ weco run --model claude-3.5-sonnet --source optimize.py [other options...]
186
190
  ```
187
191
 
188
192
  **Available models:**
189
- - `gpt-4o`, `o4-mini` (requires `OPENAI_API_KEY`)
190
- - `claude-3.5-sonnet`, `claude-sonnet-4-20250514` (requires `ANTHROPIC_API_KEY`)
191
- - `gemini-2.5-pro` (requires `GEMINI_API_KEY`)
193
+ - `o4-mini`, `o3-mini`, `gpt-4o` (OpenAI models)
194
+ - `claude-sonnet-4-0`, `claude-opus-4-0` (Anthropic models)
195
+ - `gemini-2.5-pro`, `gemini-2.5-flash` (Google models)
192
196
 
193
- If no model is specified, Weco automatically selects the best available model based on your API keys.
197
+ All models are available through Weco's centralized system. If no model is specified, Weco automatically selects the best model for your optimization task.
194
198
 
195
199
  ---
196
200
 
201
+ ### Resuming Interrupted Runs
202
+
203
+ If your optimization run is interrupted (network issues, restart, etc.), resume from the most recent node:
204
+
205
+ ```bash
206
+ # Resume an interrupted run
207
+ weco resume 0002e071-1b67-411f-a514-36947f0c4b31
208
+
209
+ ```
210
+
211
+ Arguments for `weco resume`:
212
+
213
+ | Argument | Description | Example |
214
+ |----------|-------------|---------|
215
+ | `run-id` | The UUID of the run to resume (shown at the start of each run) | `0002e071-1b67-411f-a514-36947f0c4b31` |
216
+
217
+ Notes:
218
+ - Works only for interrupted runs (status: `error`, `terminated`, etc.).
219
+ - You’ll be prompted to confirm that your evaluation environment (source file + evaluation command) hasn’t changed.
220
+ - The source file is restored to the most recent solution before continuing.
221
+ - All progress and metrics from the original run are preserved.
222
+ - Log directory, save-logs behavior, and evaluation timeout are reused from the original run.
223
+
197
224
  ### Performance & Expectations
198
225
 
199
226
  Weco, powered by the AIDE algorithm, optimizes code iteratively based on your evaluation results. Achieving significant improvements, especially on complex research-level tasks, often requires substantial exploration time.
@@ -266,37 +293,7 @@ Weco will parse this output to extract the numerical value (1.5 in this case) as
266
293
 
267
294
  ## Supported Models
268
295
 
269
- Weco supports the following LLM models:
270
-
271
- ### OpenAI Models
272
- - `gpt-5` (recommended)
273
- - `gpt-5-mini`
274
- - `gpt-5-nano`
275
- - `o3-pro` (recommended)
276
- - `o3` (recommended)
277
- - `o4-mini` (recommended)
278
- - `o3-mini`
279
- - `o1-pro`
280
- - `o1`
281
- - `gpt-4.1`
282
- - `gpt-4.1-mini`
283
- - `gpt-4.1-nano`
284
- - `gpt-4o`
285
- - `gpt-4o-mini`
286
- - `codex-mini-latest`
287
-
288
- ### Anthropic Models
289
- - `claude-opus-4-1`
290
- - `claude-opus-4-0`
291
- - `claude-sonnet-4-0`
292
- - `claude-3-7-sonnet-latest`
293
-
294
- ### Gemini Models
295
- - `gemini-2.5-pro`
296
- - `gemini-2.5-flash`
297
- - `gemini-2.5-flash-lite`
298
-
299
- You can specify any of these models using the `-M` or `--model` flag. Ensure you have the corresponding API key set as an environment variable for the model provider you wish to use.
296
+ A list of models we support can be found in our documentation [here](https://docs.weco.ai/cli/supported-models).
300
297
 
301
298
  ---
302
299
 
@@ -19,12 +19,8 @@ Explore runnable examples that show how to use Weco to optimize kernels, prompts
19
19
 
20
20
  - **Install the CLI**
21
21
  ```bash
22
- pip install weco>=0.2.18
22
+ pip install weco
23
23
  ```
24
- - **Set an API key** for at least one provider:
25
- - OpenAI: `export OPENAI_API_KEY="your_key_here"`
26
- - Anthropic: `export ANTHROPIC_API_KEY="your_key_here"`
27
- - Google: `export GEMINI_API_KEY="your_key_here"`
28
24
 
29
25
  ### Examples at a glance
30
26
 
@@ -32,7 +28,7 @@ pip install weco>=0.2.18
32
28
  | :-- | :-- | :-- | :-- |
33
29
  | 🧭 Hello Kernel World | Learn the Weco workflow on a small PyTorch model | `torch` | [README](hello-kernel-world/README.md) • [Colab](hello-kernel-world/colab_notebook_walkthrough.ipynb) |
34
30
  | ⚡ Triton Optimization | Speed up attention with Triton kernels | `torch`, `triton` | [README](triton/README.md) |
35
- | 🚀 CUDA Optimization | Generate low-level CUDA kernels for max speed | `torch`, `ninja`, NVIDIA GPU + CUDA Toolkit | [README](cuda/README.md) |
31
+ | 🚀 CUDA Optimization | Generate low-level CUDA kernels for max speed | `torch`, `ninja`, `triton`, NVIDIA GPU + CUDA Toolkit | [README](cuda/README.md) |
36
32
  | 🧠 Prompt Engineering | Iteratively refine LLM prompts to improve accuracy | `openai`, `datasets` | [README](prompt/README.md) |
37
33
  | 🛰️ Spaceship Titanic | Improve a Kaggle model training pipeline | `pandas`, `numpy`, `scikit-learn`, `torch`, `xgboost`, `lightgbm`, `catboost` | [README](spaceship-titanic/README.md) |
38
34
 
@@ -63,23 +59,23 @@ weco run --source optimize.py \
63
59
  cd examples/triton
64
60
  weco run --source optimize.py \
65
61
  --eval-command "python evaluate.py --solution-path optimize.py" \
66
- --metric speedup --goal maximize --steps 30 \
62
+ --metric speedup --goal maximize --steps 50 \
67
63
  --model o4-mini \
68
- --additional-instructions "Use triton to optimize while keeping numerical diff small."
64
+ --additional-instructions "Use triton to optimize the code while ensuring a small max float diff. Maintain the same code format. Do not use any fallbacks. Assume any required dependencies are installed and data is already on the gpu."
69
65
  ```
70
66
 
71
67
  ### 🚀 CUDA Optimization
72
68
 
73
- - **Install extra deps**: `pip install torch ninja`
69
+ - **Install extra deps**: `pip install torch ninja triton`
74
70
  - **Requires**: NVIDIA GPU and CUDA Toolkit
75
71
  - **Run**:
76
72
  ```bash
77
73
  cd examples/cuda
78
74
  weco run --source optimize.py \
79
75
  --eval-command "python evaluate.py --solution-path optimize.py" \
80
- --metric speedup --goal maximize --steps 15 \
76
+ --metric speedup --goal maximize --steps 50 \
81
77
  --model o4-mini \
82
- --additional-instructions guide.md
78
+ --additional-instructions "Write in-line CUDA using pytorch's load_inline() to optimize the code while ensuring a small max float diff. Maintain the same code format. Do not use any fallbacks. Assume any required dependencies are installed and data is already on the gpu."
83
79
  ```
84
80
 
85
81
  ### 🧠 Prompt Engineering
@@ -90,7 +86,7 @@ weco run --source optimize.py \
90
86
  cd examples/prompt
91
87
  weco run --source optimize.py \
92
88
  --eval-command "python eval.py" \
93
- --metric score --goal maximize --steps 15 \
89
+ --metric score --goal maximize --steps 20 \
94
90
  --model o4-mini
95
91
  ```
96
92
 
@@ -2,23 +2,12 @@
2
2
 
3
3
  This example showcases using Weco to optimize a PyTorch causal multi-head self-attention implementation by generating custom [CUDA](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html) kernels.
4
4
  This approach aims for low-level optimization beyond standard PyTorch or even Triton for potentially higher performance on NVIDIA GPUs.
5
- This example uses a separate Markdown file (`guide.md`) to provide detailed instructions and context to the LLM.
6
5
 
7
6
  ## Setup
8
7
 
9
- Install the CLI using `pip`:
8
+ Install the CLI and dependencies for the example:
10
9
  ```bash
11
- pip install weco>=0.2.18
12
- ```
13
-
14
- Create your OpenAI API key [here](https://platform.openai.com/api-keys), then run:
15
- ```bash
16
- export OPENAI_API_KEY="your_key_here"
17
- ```
18
-
19
- Install the required dependencies:
20
- ```bash
21
- pip install torch ninja
10
+ pip install weco torch ninja triton
22
11
  ```
23
12
  > **Note:** This example requires a compatible NVIDIA GPU and the CUDA Toolkit installed on your system for compiling and running the generated CUDA code.
24
13
 
@@ -30,9 +19,9 @@ weco run --source optimize.py \
30
19
  --eval-command "python evaluate.py --solution-path optimize.py" \
31
20
  --metric speedup \
32
21
  --goal maximize \
33
- --steps 15 \
22
+ --steps 50 \
34
23
  --model o4-mini \
35
- --additional-instructions guide.md
24
+ --additional-instructions "Write in-line CUDA using pytorch's load_inline() to optimize the code while ensuring a small max float diff. Maintain the same code format. Do not use any fallbacks. Assume any required dependencies are installed and data is already on the gpu."
36
25
  ```
37
26
 
38
27
  ### Explanation
@@ -41,11 +30,11 @@ weco run --source optimize.py \
41
30
  * `--eval-command "python evaluate.py --solution-path optimize.py"`: Runs the evaluation script, which compiles (if necessary) and benchmarks the CUDA-enhanced code in `optimize.py` against a baseline, printing the `speedup`.
42
31
  * `--metric speedup`: The optimization target metric.
43
32
  * `--goal maximize`: Weco aims to increase the speedup.
44
- * `--steps 15`: The number of optimization iterations.
33
+ * `--steps 50`: The number of optimization iterations.
45
34
  * `--model o4-mini`: The LLM used for code generation.
46
- * `--additional-instructions guide.md`: Provides guidance to the LLM on the optimization approach.
35
+ * `--additional-instructions "..."`: Provides guidance to the LLM on the optimization approach.
47
36
 
48
- Weco will iteratively modify `optimize.py`, generating and integrating CUDA C++ code, guided by the evaluation results and the instructions in `guide.md`.
37
+ Weco will iteratively modify `optimize.py`, generating and integrating CUDA C++ code, guided by the evaluation results and the additional instructions provided.
49
38
 
50
39
  ## Next Steps
51
40
 
@@ -8,6 +8,7 @@ import torch
8
8
  import torch.nn as nn
9
9
  import torch.nn.functional as F
10
10
  import math
11
+ from triton.testing import do_bench
11
12
 
12
13
 
13
14
  ########################################################
@@ -78,29 +79,6 @@ def get_inputs(batch_size, seq_len, n_embd, device):
78
79
  return torch.randn(batch_size, seq_len, n_embd, device=device, dtype=torch.float32)
79
80
 
80
81
 
81
- @torch.no_grad()
82
- def bench(f, inputs, n_warmup, n_rep):
83
- start_event = torch.cuda.Event(enable_timing=True)
84
- end_event = torch.cuda.Event(enable_timing=True)
85
-
86
- # warmup
87
- for _ in range(n_warmup):
88
- f(inputs) # noqa
89
- torch.cuda.synchronize()
90
-
91
- # benchmark
92
- t_avg_ms = 0.0
93
- for _ in range(n_rep):
94
- # time the forward pass
95
- start_event.record()
96
- f(inputs)
97
- end_event.record()
98
- # wait for all computations to complete
99
- torch.cuda.synchronize()
100
- t_avg_ms += start_event.elapsed_time(end_event)
101
- return t_avg_ms / n_rep
102
-
103
-
104
82
  if __name__ == "__main__":
105
83
  import argparse
106
84
 
@@ -111,8 +89,8 @@ if __name__ == "__main__":
111
89
  # benchmarking parameters
112
90
  n_correctness_trials = 10
113
91
  correctness_tolerance = 1e-5
114
- n_warmup = 1000
115
- n_rep = 5000
92
+ warmup_ms = 1e3
93
+ rep_ms = 5 * 1e3
116
94
 
117
95
  # init parameters
118
96
  max_seqlen = 512
@@ -148,8 +126,12 @@ if __name__ == "__main__":
148
126
  for _ in range(n_correctness_trials):
149
127
  inputs = get_inputs(batch_size=batch_size, seq_len=seq_len, n_embd=n_embd, device="cuda")
150
128
  with torch.no_grad():
151
- baseline_output = baseline_model(inputs)
152
129
  optimized_output = solution_model(inputs)
130
+ if torch.isnan(optimized_output).any():
131
+ print("Incorrect solution: NaN detected in optimized model output")
132
+ if torch.isinf(optimized_output).any():
133
+ print("Incorrect solution: Inf detected in optimized model output")
134
+ baseline_output = baseline_model(inputs)
153
135
  max_diff_avg += torch.max(torch.abs(optimized_output - baseline_output))
154
136
  max_diff_avg /= n_correctness_trials
155
137
  print(f"max float diff between values of baseline and optimized model: {max_diff_avg}")
@@ -158,8 +140,8 @@ if __name__ == "__main__":
158
140
 
159
141
  # measure performance
160
142
  inputs = get_inputs(batch_size=batch_size, seq_len=seq_len, n_embd=n_embd, device="cuda")
161
- t_avg_baseline = bench(baseline_model, inputs, n_warmup, n_rep)
143
+ t_avg_baseline = do_bench(lambda: baseline_model(inputs), warmup=warmup_ms, rep=rep_ms)
162
144
  print(f"baseline time: {t_avg_baseline:.2f}ms")
163
- t_avg_optimized = bench(solution_model, inputs, n_warmup, n_rep)
145
+ t_avg_optimized = do_bench(lambda: solution_model(inputs), warmup=warmup_ms, rep=rep_ms)
164
146
  print(f"optimized time: {t_avg_optimized:.2f}ms")
165
147
  print(f"speedup: {t_avg_baseline / t_avg_optimized:.2f}x")
@@ -4,19 +4,9 @@ This example demonstrates the basics of using Weco to optimize a simple PyTorch
4
4
 
5
5
  ## Setup
6
6
 
7
- Install the CLI using `pip`:
7
+ Install the CLI and dependencies for the example:
8
8
  ```bash
9
- pip install weco>=0.2.18
10
- ```
11
-
12
- Create your API key from one of the supported providers:
13
- - **OpenAI:** Create your API key [here](https://platform.openai.com/api-keys), then run: `export OPENAI_API_KEY="your_key_here"`
14
- - **Anthropic:** Create your API key [here](https://console.anthropic.com/settings/keys), then run: `export ANTHROPIC_API_KEY="your_key_here"`
15
- - **Google:** Create your API key [here](https://aistudio.google.com/apikey), then run: `export GEMINI_API_KEY="your_key_here"`
16
-
17
- Install the required dependencies:
18
- ```bash
19
- pip install torch
9
+ pip install weco torch
20
10
  ```
21
11
 
22
12
  ## Run Weco