Skip to content

Add OptoPrimeV3 and OPROv3 multimodal optimizers#77

Merged
chinganc merged 2 commits into
feature/llm-backbonefrom
feature/optoprime-v3
Jun 9, 2026
Merged

Add OptoPrimeV3 and OPROv3 multimodal optimizers#77
chinganc merged 2 commits into
feature/llm-backbonefrom
feature/optoprime-v3

Conversation

@allenanie

@allenanie allenanie commented Jun 2, 2026

Copy link
Copy Markdown
Member

What & why

Adds the v3 optimizers that build prompts as multimodal Content (interleaved text + images) using the backbone Chat/UserTurn/AssistantTurn primitives.

PR 2 of 2 (stacked). Targets feature/llm-backbone (#76), which provides the backbone/LLM layer this depends on. Merge #76 first, then this re-targets experimental.

Changes

  • opto/optimizers/optoprime_v3.pyOptoPrimeV3 (subclasses OptoPrime), OptimizerPromptSymbolSet variants, ProblemInstance, and value_to_image_content. Requires an mm_beta LLM (asserted at construction).
  • opto/optimizers/opro_v3.pyOPROv3 (subclasses OptoPrimeV3) with a smaller prompt symbol set.
  • opto/optimizers/__init__.py — export OptoPrimeV3 and OPROv3.
  • tests/llm_optimizers_tests/test_optoprime_v3.py — offline tests pass; live optimizer-step tests are opt-in via RUN_LIVE_LLM_TESTS=1.

Bug fix

ProblemInstance is a @dataclass with no normalization, so passing feedback/context as plain strings (as the tests and callers do) crashed __repr__/to_content_blocks with 'str' object has no attribute 'to_text'. Added a __post_init__ that normalizes content fields via ContentBlockList.ensure, and made __repr__ include the Context section so it matches to_content_blocks.

Verification

  • pytest tests/llm_optimizers_tests/test_optoprime_v3.py — 13 pass / 4 skip.
  • OptoPrimeV3/OPROv3 instantiate and import against the existing optoprime.py/optoprime_v2.py on experimental (no changes to those files required).

@allenanie allenanie force-pushed the feature/optoprime-v3 branch from 94b15bb to bb5e444 Compare June 2, 2026 06:41
@allenanie allenanie force-pushed the feature/llm-backbone branch from 9f8153d to 73b0347 Compare June 2, 2026 15:37
allenanie added 2 commits June 2, 2026 11:37
Stacked on the multimodal backbone branch. These optimizers build prompts as
multimodal Content (text + images) via the backbone Chat/UserTurn/AssistantTurn
primitives and require an mm_beta LLM.

- opto/optimizers/optoprime_v3.py: OptoPrimeV3 (subclasses OptoPrime),
  OptimizerPromptSymbolSet variants, ProblemInstance, and value_to_image_content.
- opto/optimizers/opro_v3.py: OPROv3 (subclasses OptoPrimeV3) with a smaller
  prompt symbol set.
- opto/optimizers/__init__.py: export OptoPrimeV3 and OPROv3.
- tests/llm_optimizers_tests/test_optoprime_v3.py.

Fixes a pre-existing bug in ProblemInstance: content fields passed as plain
strings (feedback/context) crashed __repr__/to_content_blocks. Added a
__post_init__ that normalizes fields via ContentBlockList.ensure, and made
__repr__ include the Context section so it matches to_content_blocks.
Mirror the backbone-branch test gating: real LLM optimizer-step tests now run
only when RUN_LIVE_LLM_TESTS=1, so they don't fail against CI's text-only stub.
@allenanie allenanie force-pushed the feature/optoprime-v3 branch from bb5e444 to ee504a2 Compare June 2, 2026 15:37
@chinganc

chinganc commented Jun 9, 2026

Copy link
Copy Markdown
Member

LGTM

@chinganc chinganc merged commit 459e0b8 into feature/llm-backbone Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants