-
Notifications
You must be signed in to change notification settings - Fork 1
feat(benchmark): Vertex AI multi-model benchmark generation (#6913 foundation) #9638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarkusNeusinger
wants to merge
11
commits into
main
Choose a base branch
from
claude/vertex-ai-model-testing-57y0cm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
11aef91
feat(benchmark): Vertex AI multi-model benchmark generation
claude 2fcc1f1
docs: add PR ref to changelog entry
claude 5707f8c
fix(benchmark): scrub render env, slug on normalized model id, runner…
claude 59e9f77
fix(benchmark): isolated-mode render interpreter, guard summary step
claude 08985e9
fix(benchmark): null token accounting for unreported usage, routing d…
claude 9af14bf
fix(benchmark): remap HOME to a scratch dir for the render subprocess
claude a7c5c3b
fix(benchmark): clear stale renders per attempt, honest extraction-fa…
claude 83ce6ce
fix(benchmark): prompt contract wording, google-auth import guard, docs
claude bbff962
fix(benchmark): canvas gate covers both themes, record fence compliance
claude 0271476
test(benchmark): cover provider transports and main loop (codecov pat…
claude 8808073
fix(benchmark): validate numeric CLI args, single-line summary errors
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| name: "Benchmark: Generate" | ||
| run-name: "Benchmark: ${{ inputs.library }} for ${{ inputs.specification_id }} (${{ inputs.models }})" | ||
|
|
||
| # LLM benchmark generation (issue #6913): generate the same (spec, library) | ||
| # implementation with several models served by Google Vertex AI — Gemini, | ||
| # Claude on Vertex, and Model Garden partner models — under the repo's | ||
| # existing Workload Identity Federation auth. Adding a model to the | ||
| # comparison is just another id in the `models` input; no new secrets or | ||
| # integrations. Results (code, renders, raw responses, result.yaml) are | ||
| # uploaded as a workflow artifact; nothing is committed to the repo and the | ||
| # plots/ catalog is untouched. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| specification_id: | ||
| description: "Specification ID (e.g., scatter-basic)" | ||
| required: true | ||
| type: string | ||
| library: | ||
| description: "Library to benchmark (Python libraries only in v1)" | ||
| required: true | ||
| type: choice | ||
| default: 'matplotlib' | ||
| options: | ||
| - matplotlib | ||
| - seaborn | ||
| - plotly | ||
| - bokeh | ||
| - altair | ||
| - plotnine | ||
| - pygal | ||
| - letsplot | ||
| models: | ||
| description: "Comma-separated Vertex AI model ids (gemini-*, claude-*@<version>, meta/*, mistralai/*, …)" | ||
| required: true | ||
| type: string | ||
| default: 'google/gemini-2.5-pro,anthropic/claude-sonnet-4-5@20250929' | ||
| max_attempts: | ||
| description: "Generation attempts per model (render errors are fed back)" | ||
| required: false | ||
| type: string | ||
| default: '3' | ||
| location: | ||
| description: "Vertex region for Gemini / Model Garden models" | ||
| required: false | ||
| type: string | ||
| default: 'us-central1' | ||
| anthropic_location: | ||
| description: "Vertex region for Claude models" | ||
| required: false | ||
| type: string | ||
| default: 'us-east5' | ||
|
|
||
| # One benchmark per (spec, library) at a time; a second dispatch queues. | ||
| concurrency: | ||
| group: benchmark-generate-${{ inputs.specification_id }}-${{ inputs.library }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| benchmark: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 120 | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - name: Validate specification exists | ||
| env: | ||
| SPEC_ID: ${{ inputs.specification_id }} | ||
| run: | | ||
| if [ ! -f "plots/${SPEC_ID}/specification.md" ]; then | ||
| echo "::error::Specification not found: plots/${SPEC_ID}/specification.md" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
|
|
||
| - name: Install dependencies | ||
| env: | ||
| LIBRARY: ${{ inputs.library }} | ||
| run: | | ||
| uv venv .venv | ||
| source .venv/bin/activate | ||
| # Same per-library extras impl-generate uses, plus the Vertex client's auth dep. | ||
| uv pip install -e ".[lib-${LIBRARY}]" pillow pyyaml google-auth | ||
|
|
||
| - name: Authenticate to GCP | ||
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | ||
| with: | ||
| project_id: anyplot | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
|
|
||
| - name: Run benchmark generation per model | ||
| env: | ||
| SPEC_ID: ${{ inputs.specification_id }} | ||
| LIBRARY: ${{ inputs.library }} | ||
| MODELS: ${{ inputs.models }} | ||
| MAX_ATTEMPTS: ${{ inputs.max_attempts }} | ||
| LOCATION: ${{ inputs.location }} | ||
| ANTHROPIC_LOCATION: ${{ inputs.anthropic_location }} | ||
| GOOGLE_CLOUD_PROJECT: anyplot | ||
| run: | | ||
| set -u | ||
| succeeded=0 | ||
| failed=0 | ||
|
|
||
| IFS=',' read -ra MODEL_LIST <<< "$MODELS" | ||
| for MODEL in "${MODEL_LIST[@]}"; do | ||
| MODEL=$(echo "$MODEL" | xargs) # trim whitespace | ||
| [ -z "$MODEL" ] && continue | ||
| echo "::group::Model: ${MODEL}" | ||
| if .venv/bin/python -m automation.benchmark.generate \ | ||
| --spec-id "$SPEC_ID" \ | ||
| --library "$LIBRARY" \ | ||
| --model "$MODEL" \ | ||
| --location "$LOCATION" \ | ||
| --anthropic-location "$ANTHROPIC_LOCATION" \ | ||
| --max-attempts "$MAX_ATTEMPTS" \ | ||
| --output-dir benchmark-results; then | ||
| succeeded=$((succeeded + 1)) | ||
| else | ||
| echo "::warning::Benchmark generation failed for model ${MODEL}" | ||
| failed=$((failed + 1)) | ||
| fi | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| echo "::notice::Benchmark done: ${succeeded} succeeded, ${failed} failed" | ||
| # Fail the job only when NO model produced a working implementation — | ||
| # individual model failures are a benchmark signal, not a CI error. | ||
| if [ "$succeeded" -eq 0 ]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Write job summary | ||
| if: always() | ||
| run: | | ||
| # Guard: on early failure (e.g. invalid spec id, install failure) the | ||
| # venv or results tree may not exist — don't obscure the real error. | ||
| if [ ! -x .venv/bin/python ] || [ ! -d benchmark-results ]; then | ||
| echo "## Benchmark results" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "Workflow failed before any benchmark results were produced." >> "$GITHUB_STEP_SUMMARY" | ||
| exit 0 | ||
| fi | ||
| .venv/bin/python - <<'PY' | ||
| import os | ||
| import pathlib | ||
|
|
||
| import yaml | ||
|
|
||
| rows = [] | ||
| for result_file in sorted(pathlib.Path("benchmark-results").rglob("result.yaml")): | ||
| data = yaml.safe_load(result_file.read_text(encoding="utf-8")) or {} | ||
| rows.append(data) | ||
|
|
||
| lines = ["## Benchmark results", ""] | ||
| if rows: | ||
| lines += [ | ||
| "| Model | Provider | Success | Attempts | Canvas OK | Gen time (s) | In tokens | Out tokens |", | ||
| "|---|---|---|---|---|---|---|---|", | ||
| ] | ||
| for r in rows: | ||
| lines.append( | ||
| "| {model} | {provider} | {success} | {attempts}/{max_attempts} | {canvas_ok} " | ||
| "| {generation_seconds} | {input_tokens} | {output_tokens} |".format(**{ | ||
| k: r.get(k, "?") | ||
| for k in ( | ||
| "model", "provider", "success", "attempts", "max_attempts", | ||
| "canvas_ok", "generation_seconds", "input_tokens", "output_tokens", | ||
| ) | ||
| }) | ||
| ) | ||
| errors = [(r.get("model"), r.get("error")) for r in rows if r.get("error")] | ||
| if errors: | ||
| lines += ["", "### Errors", ""] | ||
| for model, error in errors: | ||
| # Errors can be multi-line tracebacks; keep each bullet on | ||
| # one line so the Markdown list survives, and cap length. | ||
| flat = " ".join(str(error).split()) | ||
| if len(flat) > 500: | ||
| flat = flat[:500] + "…" | ||
| lines.append(f"- **{model}**: {flat}") | ||
| else: | ||
| lines.append("No result.yaml files were produced.") | ||
|
|
||
| with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as handle: | ||
| handle.write("\n".join(lines) + "\n") | ||
| PY | ||
|
|
||
| - name: Upload benchmark artifact | ||
| if: always() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: benchmark-${{ inputs.specification_id }}-${{ inputs.library }} | ||
| path: benchmark-results/ | ||
| if-no-files-found: warn | ||
| retention-days: 30 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| """Vertex AI multi-model benchmark generation (issue #6913). | ||
|
|
||
| Generates plot implementations for a (spec, library) pair with arbitrary | ||
| models served by Google Vertex AI — Gemini, Claude on Vertex, and Model | ||
| Garden partner models — under a single GCP authentication, so many models | ||
| can be benchmarked against the same specification and rubric. | ||
| """ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.