eyas 0.1.0rc1__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 (69) hide show
  1. eyas-0.1.0rc1/LICENSE +201 -0
  2. eyas-0.1.0rc1/PKG-INFO +259 -0
  3. eyas-0.1.0rc1/README.md +226 -0
  4. eyas-0.1.0rc1/pyproject.toml +153 -0
  5. eyas-0.1.0rc1/src/eyas/__init__.py +13 -0
  6. eyas-0.1.0rc1/src/eyas/backends/__init__.py +27 -0
  7. eyas-0.1.0rc1/src/eyas/backends/base.py +265 -0
  8. eyas-0.1.0rc1/src/eyas/backends/mock.py +137 -0
  9. eyas-0.1.0rc1/src/eyas/backends/normalize.py +109 -0
  10. eyas-0.1.0rc1/src/eyas/backends/openai_api.py +588 -0
  11. eyas-0.1.0rc1/src/eyas/backends/prefetch.py +414 -0
  12. eyas-0.1.0rc1/src/eyas/backends/prepare.py +113 -0
  13. eyas-0.1.0rc1/src/eyas/backends/profiles.py +132 -0
  14. eyas-0.1.0rc1/src/eyas/backends/scheduling.py +258 -0
  15. eyas-0.1.0rc1/src/eyas/backends/vllm.py +580 -0
  16. eyas-0.1.0rc1/src/eyas/builtin.py +18 -0
  17. eyas-0.1.0rc1/src/eyas/cli.py +694 -0
  18. eyas-0.1.0rc1/src/eyas/configspec.py +518 -0
  19. eyas-0.1.0rc1/src/eyas/core/__init__.py +3 -0
  20. eyas-0.1.0rc1/src/eyas/core/objective.py +21 -0
  21. eyas-0.1.0rc1/src/eyas/engine/__init__.py +8 -0
  22. eyas-0.1.0rc1/src/eyas/engine/artifacts.py +66 -0
  23. eyas-0.1.0rc1/src/eyas/engine/budget.py +368 -0
  24. eyas-0.1.0rc1/src/eyas/engine/builtin.py +23 -0
  25. eyas-0.1.0rc1/src/eyas/engine/capability.py +205 -0
  26. eyas-0.1.0rc1/src/eyas/engine/domain.py +341 -0
  27. eyas-0.1.0rc1/src/eyas/engine/evaluation.py +872 -0
  28. eyas-0.1.0rc1/src/eyas/engine/genio.py +201 -0
  29. eyas-0.1.0rc1/src/eyas/engine/judges.py +89 -0
  30. eyas-0.1.0rc1/src/eyas/engine/planner.py +187 -0
  31. eyas-0.1.0rc1/src/eyas/engine/registry.py +70 -0
  32. eyas-0.1.0rc1/src/eyas/engine/report.py +204 -0
  33. eyas-0.1.0rc1/src/eyas/engine/runtime.py +715 -0
  34. eyas-0.1.0rc1/src/eyas/engine/sampling.py +46 -0
  35. eyas-0.1.0rc1/src/eyas/engine/status.py +234 -0
  36. eyas-0.1.0rc1/src/eyas/engine/strategies/__init__.py +7 -0
  37. eyas-0.1.0rc1/src/eyas/engine/strategies/ape.py +226 -0
  38. eyas-0.1.0rc1/src/eyas/engine/strategies/cot.py +71 -0
  39. eyas-0.1.0rc1/src/eyas/engine/strategies/evoprompt.py +474 -0
  40. eyas-0.1.0rc1/src/eyas/engine/strategies/hill_climb.py +72 -0
  41. eyas-0.1.0rc1/src/eyas/engine/strategies/opro.py +221 -0
  42. eyas-0.1.0rc1/src/eyas/engine/strategies/protegi.py +424 -0
  43. eyas-0.1.0rc1/src/eyas/engine/strategies/raw.py +42 -0
  44. eyas-0.1.0rc1/src/eyas/engine/strategies/spo.py +568 -0
  45. eyas-0.1.0rc1/src/eyas/engine/strategy.py +985 -0
  46. eyas-0.1.0rc1/src/eyas/judges/__init__.py +4 -0
  47. eyas-0.1.0rc1/src/eyas/judges/base.py +133 -0
  48. eyas-0.1.0rc1/src/eyas/judges/exact_match.py +44 -0
  49. eyas-0.1.0rc1/src/eyas/judges/mcq_judge.py +196 -0
  50. eyas-0.1.0rc1/src/eyas/logging.py +319 -0
  51. eyas-0.1.0rc1/src/eyas/prepare.py +1516 -0
  52. eyas-0.1.0rc1/src/eyas/py.typed +0 -0
  53. eyas-0.1.0rc1/src/eyas/registry.py +97 -0
  54. eyas-0.1.0rc1/src/eyas/runtime/__init__.py +2 -0
  55. eyas-0.1.0rc1/src/eyas/runtime/config.py +111 -0
  56. eyas-0.1.0rc1/src/eyas/runtime/matrix.py +380 -0
  57. eyas-0.1.0rc1/src/eyas/runtime/trace.py +359 -0
  58. eyas-0.1.0rc1/src/eyas/tasks/__init__.py +4 -0
  59. eyas-0.1.0rc1/src/eyas/tasks/base.py +67 -0
  60. eyas-0.1.0rc1/src/eyas/tasks/datasets.py +588 -0
  61. eyas-0.1.0rc1/src/eyas/tasks/demo_shapes.py +280 -0
  62. eyas-0.1.0rc1/src/eyas/tasks/kie.py +573 -0
  63. eyas-0.1.0rc1/src/eyas/tasks/math_qa.py +162 -0
  64. eyas-0.1.0rc1/src/eyas/tasks/mcq.py +473 -0
  65. eyas-0.1.0rc1/src/eyas/tasks/mixed_mcq.py +284 -0
  66. eyas-0.1.0rc1/src/eyas/tasks/protocol.py +49 -0
  67. eyas-0.1.0rc1/src/eyas/tasks/video_mcq.py +148 -0
  68. eyas-0.1.0rc1/src/eyas/tasks/vqa.py +119 -0
  69. eyas-0.1.0rc1/src/eyas/watchdog.py +217 -0
eyas-0.1.0rc1/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Chao Song
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
eyas-0.1.0rc1/PKG-INFO ADDED
@@ -0,0 +1,259 @@
1
+ Metadata-Version: 2.4
2
+ Name: eyas
3
+ Version: 0.1.0rc1
4
+ Summary: Train sharp-eyed prompts for multimodal models. A performance-first APO (automatic prompt optimization) framework for text, image and video tasks.
5
+ Keywords: prompt-optimization,automatic-prompt-optimization,multimodal,vision-language-models,video-understanding,llm,evaluation
6
+ Author: ChaoSong
7
+ Author-email: ChaoSong <davidchaosong@outlook.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Dist: pyyaml>=6.0
19
+ Requires-Dist: httpx>=0.27 ; extra == 'api'
20
+ Requires-Dist: pillow>=10 ; extra == 'api'
21
+ Requires-Dist: datasets>=4 ; extra == 'prepare'
22
+ Requires-Dist: pyarrow>=17 ; extra == 'prepare'
23
+ Requires-Dist: pillow>=10 ; extra == 'prepare'
24
+ Requires-Dist: vllm>=0.29.0,<0.30 ; extra == 'vllm'
25
+ Requires-Python: >=3.12, <3.15
26
+ Project-URL: Homepage, https://github.com/Davidham3/eyas
27
+ Project-URL: Repository, https://github.com/Davidham3/eyas
28
+ Project-URL: Documentation, https://Davidham3.github.io/eyas/
29
+ Provides-Extra: api
30
+ Provides-Extra: prepare
31
+ Provides-Extra: vllm
32
+ Description-Content-Type: text/markdown
33
+
34
+ <p align="center">
35
+ <img src="https://davidham3.github.io/eyas/_static/eyas.svg" alt="Eyas logo" width="120">
36
+ </p>
37
+
38
+ # Eyas
39
+
40
+ **Train sharp-eyed prompts for multimodal models.**
41
+
42
+ Eyas is a performance-first framework for **automatic prompt optimization (APO) on multimodal
43
+ models**: bring a task, a seed prompt and a round budget (`run.max_steps`), and Eyas runs a real
44
+ optimization loop (hill climbing, evolutionary search, gradient-style rewriting) and hands you
45
+ back a better prompt, with the cost accounting to prove what it spent.
46
+
47
+ ## The story, in one table
48
+
49
+ TextVQA (scene-text QA, rule-scored, no LLM judge), Qwen3.5-9B, held-out test split (n = 100),
50
+ mean ± σ over the fixed seeds 42/43/44:
51
+
52
+ | raw (seed prompt) | opro (optimized prompt) | Δ (pp) |
53
+ | --- | --- | --- |
54
+ | 0.736 ± 0.004 | **0.788 ± 0.029** | +5.2 |
55
+
56
+ No weights touched: the search replaced one sentence of the prompt, and the held-out gain above
57
+ is what it bought, measured with the story config you are about to run, against a self-hosted
58
+ OpenAI-compatible endpoint. At n = 100 a single reading carries a ±4 to 5 pp noise band, so the
59
+ table quotes three-seed means; every seed lifted, and the σ shows the loop's real run-to-run
60
+ spread. The published in-process-vLLM wave of the same configs tells the same story with an
61
+ unusually tight three-seed cluster (+8.7 pp,
62
+ [docs/07 §E2, the three-seed effect table](docs/07-quickstart-benchmark.md)); the commands and every artifact are walked end
63
+ to end in [Getting started](docs/tutorials/getting-started.md).
64
+
65
+ The full published scoreboard, 7 models × 6 datasets × 8 methods × 3 seeds (1008 completed runs,
66
+ judge-channel and token accounting on every cell), is the
67
+ [bench benchmark](docs/08-bench-benchmark.md).
68
+
69
+ ## Run the story
70
+
71
+ Requires Python: core 3.12–3.14; vLLM extra verified on 3.12. Install with
72
+ [uv](https://docs.astral.sh/uv/):
73
+
74
+ ```bash
75
+ uv venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
76
+ uv pip install "eyas[api,prepare]" # the story path: HTTP client + dataset prep
77
+ ```
78
+
79
+ Extras compose; pick one inference shape and add `prepare` once to build datasets — the
80
+ primary block above is exactly that (`eyas[api,prepare]`):
81
+
82
+ | Install | What you get | Notes |
83
+ | --- | --- | --- |
84
+ | `uv pip install "eyas[vllm]"` | In-process vLLM engine | Recommended default; brings its own torch/transformers |
85
+ | `uv pip install "eyas[api]"` | OpenAI-compatible HTTP client | Lightest option; rendering happens server-side |
86
+ | `uv pip install "eyas[prepare]"` | `eyas prepare` dataset download/convert | Needed once per dataset; heavy reader stack (datasets, pyarrow) |
87
+
88
+ Smoke-test the install before touching data: this built-in `demo_shapes` task generates its own
89
+ PNGs (no dataset, no GPU), so the whole loop runs wherever you have an endpoint. The config
90
+ points at a local server; `export EYAS_API_KEY` with your key and point `base_url` at any
91
+ OpenAI-compatible endpoint to run it for real:
92
+
93
+ ```bash
94
+ export EYAS_API_KEY="${EYAS_API_KEY:-local-placeholder}" # any non-empty value for a local server
95
+ tmp="$(mktemp)"
96
+ trap 'rm -f "$tmp"' EXIT
97
+ cat > "$tmp" <<'YAML'
98
+ run:
99
+ name: demo_shapes
100
+ seed: 42
101
+
102
+ task:
103
+ name: demo_shapes # built-in zero-data task: generates solid-color square PNGs
104
+ params: {}
105
+
106
+ protocol:
107
+ name: identity
108
+
109
+ backend:
110
+ name: openai
111
+ params:
112
+ base_url: http://localhost:8000/v1 # point this at any OpenAI-compatible endpoint
113
+ model: qwen3.5-9b
114
+ api_key_env: EYAS_API_KEY
115
+ max_inflight: 16
116
+ sampling:
117
+ thinking: false
118
+
119
+ eval_model:
120
+ name: absolute
121
+
122
+ budget:
123
+ name: flat
124
+ params: {} # FlatBudget is parameterless: every candidate, full split
125
+
126
+ strategy:
127
+ name: raw # evaluate the seed prompt once: the fastest end-to-end check
128
+ YAML
129
+ uv run eyas run --config "$tmp" --output-dir outputs/eyas_smoke
130
+ ```
131
+
132
+ Build the exact splits the story config points at:
133
+
134
+ ```bash
135
+ uv run eyas prepare --dataset textvqa
136
+ ```
137
+
138
+ Write `quickstart_textvqa_opro.yaml` — the experiment is the YAML, and the whole connection to
139
+ your model is two lines:
140
+
141
+ ```yaml
142
+ run:
143
+ name: quickstart_textvqa_opro
144
+ seed: 42
145
+ final_eval:
146
+ split: test
147
+
148
+ task:
149
+ name: vqa
150
+ params:
151
+ data_dir: datasets/quickstart/textvqa/data
152
+ images_dir: datasets/quickstart/textvqa/images
153
+
154
+ backend:
155
+ name: openai
156
+ params:
157
+ base_url: http://localhost:8000/v1 # any OpenAI-compatible endpoint
158
+ model: qwen3.5-9b # the story model: your served model name
159
+ api_key_env: EYAS_API_KEY # the environment variable holding your key
160
+ max_inflight: 16
161
+ sampling:
162
+ thinking: false
163
+
164
+ protocol:
165
+ name: identity
166
+
167
+ eval_model:
168
+ name: absolute
169
+
170
+ budget:
171
+ name: flat
172
+ params: {} # FlatBudget is parameterless: every candidate, full split
173
+
174
+ strategy:
175
+ name: opro
176
+ params:
177
+ rounds: 4
178
+ ```
179
+
180
+ Then run it:
181
+
182
+ ```bash
183
+ uv run eyas run --config quickstart_textvqa_opro.yaml
184
+ ```
185
+
186
+ Each run writes a self-contained run directory under `outputs/<run.name>/<timestamp>` by default,
187
+ holding
188
+ `result.json` (best prompt, history, cost), `checkpoint.json`, and `status.json` (live phase /
189
+ round / cost). One config, two backend shapes: keep `backend.name: openai` for any
190
+ OpenAI-compatible endpoint (`uv pip install "eyas[api]"`), or switch it to `vllm` for the
191
+ in-process engine (`uv pip install "eyas[vllm]"`, the recommended default); the config's two
192
+ lines `base_url` and `api_key_env` are the whole connection to your model. No endpoint yet?
193
+ The [guided tour](docs/tutorials/guided-tour.md) executes the complete loop on a built-in
194
+ synthetic task: zero downloads, zero keys, zero GPU.
195
+
196
+ Working on Eyas itself — a repo checkout with `uv sync`, `--cell` runs, and the `configs/`,
197
+ `examples/` and `scripts/` trees — starts with
198
+ `git clone https://github.com/Davidham3/eyas.git` and is covered in
199
+ [CONTRIBUTING](CONTRIBUTING.md).
200
+
201
+ ## What every method shares
202
+
203
+ - Eight methods on one strategy contract. `raw`, `cot`, `hill_climb`, `evoprompt`, `opro`,
204
+ `ape`, `protegi`, `spo`: a method's algorithm identity lives only in its strategy's `step`
205
+ decisions; the managed loop owns every invariant (budgets, evaluation, accounting, resume).
206
+ That is what makes eight methods comparable on equal budgets, and writing your ninth a
207
+ ~100-line exercise.
208
+ - Every run bills the judge channel separately (`judge_requests`) and totals tokens; the
209
+ published scoreboard reads accuracy against price.
210
+ - A run directory is a self-contained checkpoint: per-sample evaluation records (SQLite in
211
+ WAL (write-ahead logging) mode), content-addressed prompt identity, resumable and movable.
212
+
213
+ Modality is a sample-level choice, not a framework fork: the same loop covers text, image, video
214
+ or any mix of the three, with shipped benchmark recipes for `gsm8k`, `cub`, `pets`, `textvqa`,
215
+ `sroie`, `nextqa` and a mixed `mixed_mcq`.
216
+
217
+ ## Documentation
218
+
219
+ The docs site lives in [`docs/`](docs/index.md) (build:
220
+ `uv sync --group docs && uv run sphinx-build -b html docs docs/_build/html`). Tutorials:
221
+ [getting started](docs/tutorials/getting-started.md), [guided tour](docs/tutorials/guided-tour.md),
222
+ [your first optimization](docs/tutorials/first-optimization.md),
223
+ [understanding results](docs/tutorials/understanding-results.md),
224
+ [custom tasks](docs/tutorials/custom-task.md),
225
+ [custom optimization methods](docs/tutorials/custom-method.md),
226
+ [inference backends](docs/tutorials/backends.md),
227
+ [reproducing the benchmark](docs/tutorials/benchmark.md). Runnable starter packages live in
228
+ [`examples/`](examples/). The [contract-driven design](docs/10-architecture.md) is the
229
+ authoritative architecture reference; the benchmark protocols are
230
+ [docs/07](docs/07-quickstart-benchmark.md) and [docs/08](docs/08-bench-benchmark.md), and the
231
+ per-method conformance contract is [baseline fidelity](docs/baselines-fidelity.md).
232
+
233
+ ## Data, models and provenance
234
+
235
+ Eyas ships code, not data or weights: benchmark datasets are downloaded at prepare time from
236
+ their upstream hosts, `datasets/` is gitignored and nothing is redistributed. The Apache-2.0
237
+ license covers the code only, while each dataset and model checkpoint keeps its own license and
238
+ terms, and several benchmark sets are research-use (sources and the model-checkpoint rule:
239
+ [Data and models](docs/datasets.md)).
240
+
241
+ > **Provenance note**: every published number is script-generated from the runs' `result.json`
242
+ > files by `scripts/aggregate_bench_results.py`, so the published tables are measurements of runs
243
+ > you can reproduce. The GPU run directories themselves are not distributed; regenerate them with
244
+ > the [benchmark tutorial](docs/tutorials/benchmark.md) and docs/08 §2-3.
245
+
246
+ ## Contributing
247
+
248
+ Two decorator-based registries cover the extension surface: **Task / Backend / Judge / Protocol**
249
+ (what gets asked, where requests go, how responses become scores) and **Strategy / EvalModel /
250
+ Budget / PairwiseJudge** (the method itself, its scoring semantics, its budget policy, pluggable
251
+ pairwise judging); duplicate names fail fast. Start with
252
+ [Custom optimization methods](docs/tutorials/custom-method.md); `hill_climb` in
253
+ `src/eyas/engine/strategies/` is the reference implementation, and every shipped strategy runs
254
+ end-to-end on the framework's scripted in-repo test backend in CI (the fast suite is `uv run pytest`, zero GPU).
255
+
256
+ ## License
257
+
258
+ Apache-2.0, see [LICENSE](LICENSE); it covers the code only (see
259
+ [Data, models and provenance](#data-models-and-provenance)).
@@ -0,0 +1,226 @@
1
+ <p align="center">
2
+ <img src="https://davidham3.github.io/eyas/_static/eyas.svg" alt="Eyas logo" width="120">
3
+ </p>
4
+
5
+ # Eyas
6
+
7
+ **Train sharp-eyed prompts for multimodal models.**
8
+
9
+ Eyas is a performance-first framework for **automatic prompt optimization (APO) on multimodal
10
+ models**: bring a task, a seed prompt and a round budget (`run.max_steps`), and Eyas runs a real
11
+ optimization loop (hill climbing, evolutionary search, gradient-style rewriting) and hands you
12
+ back a better prompt, with the cost accounting to prove what it spent.
13
+
14
+ ## The story, in one table
15
+
16
+ TextVQA (scene-text QA, rule-scored, no LLM judge), Qwen3.5-9B, held-out test split (n = 100),
17
+ mean ± σ over the fixed seeds 42/43/44:
18
+
19
+ | raw (seed prompt) | opro (optimized prompt) | Δ (pp) |
20
+ | --- | --- | --- |
21
+ | 0.736 ± 0.004 | **0.788 ± 0.029** | +5.2 |
22
+
23
+ No weights touched: the search replaced one sentence of the prompt, and the held-out gain above
24
+ is what it bought, measured with the story config you are about to run, against a self-hosted
25
+ OpenAI-compatible endpoint. At n = 100 a single reading carries a ±4 to 5 pp noise band, so the
26
+ table quotes three-seed means; every seed lifted, and the σ shows the loop's real run-to-run
27
+ spread. The published in-process-vLLM wave of the same configs tells the same story with an
28
+ unusually tight three-seed cluster (+8.7 pp,
29
+ [docs/07 §E2, the three-seed effect table](docs/07-quickstart-benchmark.md)); the commands and every artifact are walked end
30
+ to end in [Getting started](docs/tutorials/getting-started.md).
31
+
32
+ The full published scoreboard, 7 models × 6 datasets × 8 methods × 3 seeds (1008 completed runs,
33
+ judge-channel and token accounting on every cell), is the
34
+ [bench benchmark](docs/08-bench-benchmark.md).
35
+
36
+ ## Run the story
37
+
38
+ Requires Python: core 3.12–3.14; vLLM extra verified on 3.12. Install with
39
+ [uv](https://docs.astral.sh/uv/):
40
+
41
+ ```bash
42
+ uv venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
43
+ uv pip install "eyas[api,prepare]" # the story path: HTTP client + dataset prep
44
+ ```
45
+
46
+ Extras compose; pick one inference shape and add `prepare` once to build datasets — the
47
+ primary block above is exactly that (`eyas[api,prepare]`):
48
+
49
+ | Install | What you get | Notes |
50
+ | --- | --- | --- |
51
+ | `uv pip install "eyas[vllm]"` | In-process vLLM engine | Recommended default; brings its own torch/transformers |
52
+ | `uv pip install "eyas[api]"` | OpenAI-compatible HTTP client | Lightest option; rendering happens server-side |
53
+ | `uv pip install "eyas[prepare]"` | `eyas prepare` dataset download/convert | Needed once per dataset; heavy reader stack (datasets, pyarrow) |
54
+
55
+ Smoke-test the install before touching data: this built-in `demo_shapes` task generates its own
56
+ PNGs (no dataset, no GPU), so the whole loop runs wherever you have an endpoint. The config
57
+ points at a local server; `export EYAS_API_KEY` with your key and point `base_url` at any
58
+ OpenAI-compatible endpoint to run it for real:
59
+
60
+ ```bash
61
+ export EYAS_API_KEY="${EYAS_API_KEY:-local-placeholder}" # any non-empty value for a local server
62
+ tmp="$(mktemp)"
63
+ trap 'rm -f "$tmp"' EXIT
64
+ cat > "$tmp" <<'YAML'
65
+ run:
66
+ name: demo_shapes
67
+ seed: 42
68
+
69
+ task:
70
+ name: demo_shapes # built-in zero-data task: generates solid-color square PNGs
71
+ params: {}
72
+
73
+ protocol:
74
+ name: identity
75
+
76
+ backend:
77
+ name: openai
78
+ params:
79
+ base_url: http://localhost:8000/v1 # point this at any OpenAI-compatible endpoint
80
+ model: qwen3.5-9b
81
+ api_key_env: EYAS_API_KEY
82
+ max_inflight: 16
83
+ sampling:
84
+ thinking: false
85
+
86
+ eval_model:
87
+ name: absolute
88
+
89
+ budget:
90
+ name: flat
91
+ params: {} # FlatBudget is parameterless: every candidate, full split
92
+
93
+ strategy:
94
+ name: raw # evaluate the seed prompt once: the fastest end-to-end check
95
+ YAML
96
+ uv run eyas run --config "$tmp" --output-dir outputs/eyas_smoke
97
+ ```
98
+
99
+ Build the exact splits the story config points at:
100
+
101
+ ```bash
102
+ uv run eyas prepare --dataset textvqa
103
+ ```
104
+
105
+ Write `quickstart_textvqa_opro.yaml` — the experiment is the YAML, and the whole connection to
106
+ your model is two lines:
107
+
108
+ ```yaml
109
+ run:
110
+ name: quickstart_textvqa_opro
111
+ seed: 42
112
+ final_eval:
113
+ split: test
114
+
115
+ task:
116
+ name: vqa
117
+ params:
118
+ data_dir: datasets/quickstart/textvqa/data
119
+ images_dir: datasets/quickstart/textvqa/images
120
+
121
+ backend:
122
+ name: openai
123
+ params:
124
+ base_url: http://localhost:8000/v1 # any OpenAI-compatible endpoint
125
+ model: qwen3.5-9b # the story model: your served model name
126
+ api_key_env: EYAS_API_KEY # the environment variable holding your key
127
+ max_inflight: 16
128
+ sampling:
129
+ thinking: false
130
+
131
+ protocol:
132
+ name: identity
133
+
134
+ eval_model:
135
+ name: absolute
136
+
137
+ budget:
138
+ name: flat
139
+ params: {} # FlatBudget is parameterless: every candidate, full split
140
+
141
+ strategy:
142
+ name: opro
143
+ params:
144
+ rounds: 4
145
+ ```
146
+
147
+ Then run it:
148
+
149
+ ```bash
150
+ uv run eyas run --config quickstart_textvqa_opro.yaml
151
+ ```
152
+
153
+ Each run writes a self-contained run directory under `outputs/<run.name>/<timestamp>` by default,
154
+ holding
155
+ `result.json` (best prompt, history, cost), `checkpoint.json`, and `status.json` (live phase /
156
+ round / cost). One config, two backend shapes: keep `backend.name: openai` for any
157
+ OpenAI-compatible endpoint (`uv pip install "eyas[api]"`), or switch it to `vllm` for the
158
+ in-process engine (`uv pip install "eyas[vllm]"`, the recommended default); the config's two
159
+ lines `base_url` and `api_key_env` are the whole connection to your model. No endpoint yet?
160
+ The [guided tour](docs/tutorials/guided-tour.md) executes the complete loop on a built-in
161
+ synthetic task: zero downloads, zero keys, zero GPU.
162
+
163
+ Working on Eyas itself — a repo checkout with `uv sync`, `--cell` runs, and the `configs/`,
164
+ `examples/` and `scripts/` trees — starts with
165
+ `git clone https://github.com/Davidham3/eyas.git` and is covered in
166
+ [CONTRIBUTING](CONTRIBUTING.md).
167
+
168
+ ## What every method shares
169
+
170
+ - Eight methods on one strategy contract. `raw`, `cot`, `hill_climb`, `evoprompt`, `opro`,
171
+ `ape`, `protegi`, `spo`: a method's algorithm identity lives only in its strategy's `step`
172
+ decisions; the managed loop owns every invariant (budgets, evaluation, accounting, resume).
173
+ That is what makes eight methods comparable on equal budgets, and writing your ninth a
174
+ ~100-line exercise.
175
+ - Every run bills the judge channel separately (`judge_requests`) and totals tokens; the
176
+ published scoreboard reads accuracy against price.
177
+ - A run directory is a self-contained checkpoint: per-sample evaluation records (SQLite in
178
+ WAL (write-ahead logging) mode), content-addressed prompt identity, resumable and movable.
179
+
180
+ Modality is a sample-level choice, not a framework fork: the same loop covers text, image, video
181
+ or any mix of the three, with shipped benchmark recipes for `gsm8k`, `cub`, `pets`, `textvqa`,
182
+ `sroie`, `nextqa` and a mixed `mixed_mcq`.
183
+
184
+ ## Documentation
185
+
186
+ The docs site lives in [`docs/`](docs/index.md) (build:
187
+ `uv sync --group docs && uv run sphinx-build -b html docs docs/_build/html`). Tutorials:
188
+ [getting started](docs/tutorials/getting-started.md), [guided tour](docs/tutorials/guided-tour.md),
189
+ [your first optimization](docs/tutorials/first-optimization.md),
190
+ [understanding results](docs/tutorials/understanding-results.md),
191
+ [custom tasks](docs/tutorials/custom-task.md),
192
+ [custom optimization methods](docs/tutorials/custom-method.md),
193
+ [inference backends](docs/tutorials/backends.md),
194
+ [reproducing the benchmark](docs/tutorials/benchmark.md). Runnable starter packages live in
195
+ [`examples/`](examples/). The [contract-driven design](docs/10-architecture.md) is the
196
+ authoritative architecture reference; the benchmark protocols are
197
+ [docs/07](docs/07-quickstart-benchmark.md) and [docs/08](docs/08-bench-benchmark.md), and the
198
+ per-method conformance contract is [baseline fidelity](docs/baselines-fidelity.md).
199
+
200
+ ## Data, models and provenance
201
+
202
+ Eyas ships code, not data or weights: benchmark datasets are downloaded at prepare time from
203
+ their upstream hosts, `datasets/` is gitignored and nothing is redistributed. The Apache-2.0
204
+ license covers the code only, while each dataset and model checkpoint keeps its own license and
205
+ terms, and several benchmark sets are research-use (sources and the model-checkpoint rule:
206
+ [Data and models](docs/datasets.md)).
207
+
208
+ > **Provenance note**: every published number is script-generated from the runs' `result.json`
209
+ > files by `scripts/aggregate_bench_results.py`, so the published tables are measurements of runs
210
+ > you can reproduce. The GPU run directories themselves are not distributed; regenerate them with
211
+ > the [benchmark tutorial](docs/tutorials/benchmark.md) and docs/08 §2-3.
212
+
213
+ ## Contributing
214
+
215
+ Two decorator-based registries cover the extension surface: **Task / Backend / Judge / Protocol**
216
+ (what gets asked, where requests go, how responses become scores) and **Strategy / EvalModel /
217
+ Budget / PairwiseJudge** (the method itself, its scoring semantics, its budget policy, pluggable
218
+ pairwise judging); duplicate names fail fast. Start with
219
+ [Custom optimization methods](docs/tutorials/custom-method.md); `hill_climb` in
220
+ `src/eyas/engine/strategies/` is the reference implementation, and every shipped strategy runs
221
+ end-to-end on the framework's scripted in-repo test backend in CI (the fast suite is `uv run pytest`, zero GPU).
222
+
223
+ ## License
224
+
225
+ Apache-2.0, see [LICENSE](LICENSE); it covers the code only (see
226
+ [Data, models and provenance](#data-models-and-provenance)).