Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
e5e11a1
upload beam search and beam search history algorithms
xuanfeiren Jun 3, 2025
ce54246
update parameters
xuanfeiren Jun 3, 2025
139c2db
upload three versions of UCB search algorithms with a buffer
xuanfeiren Jun 4, 2025
d75bea4
Update OVERVIEW.md
adith387 Jun 5, 2025
c8b158c
RenameOptoprimeBatchOpt to OptoPrimeV2
chinganc Jun 6, 2025
4058bb1
Add projection api.
chinganc Jun 9, 2025
f9ce8f0
Add docstring projection.
chinganc Jun 9, 2025
867c89c
Rename basic_algorithm.py to basic_algorithms.py
chinganc Jun 9, 2025
00006a6
Fix bug in MinibatchAlgorithm due to an accidental commit
chinganc Jun 9, 2025
eedb299
Rafactor loggers into loggers.py
chinganc Jun 9, 2025
4a2b799
Add an example of using trainer. Add a flag to disable using json_obj…
chinganc Jun 10, 2025
d32ce24
Finish implementation of Tensorboard logger. Add a flag to VerbalJudg…
chinganc Jun 10, 2025
c5e6322
Fix typos
chinganc Jun 10, 2025
728d8d2
Fix a bug that projections is private in ParameterNode.
chinganc Jun 10, 2025
5ba9e41
Fix the bug of missing self.projections in ParameterNode
chinganc Jun 10, 2025
c71aa5c
add a __call__ method
allenanie Jun 10, 2025
909d232
fix a nodes.py import issue (misspelling of package)
allenanie Jun 10, 2025
df3cf50
fix an error that projections were not passed into the ParameterNode …
allenanie Jun 10, 2025
af5b339
initial commit
allenanie Jun 10, 2025
0be1ffe
Merge pull request #4 from AgentOpt/add_projection
chinganc Jun 10, 2025
3827785
Merge branch 'add_projection' into experimental
chinganc Jun 10, 2025
2d7df6a
Merge branch 'experimental' of github.com:AgentOpt/Trace into experim…
chinganc Jun 10, 2025
b5b165f
Merge branch 'experimental' into add_model_dump
chinganc Jun 10, 2025
e5fc52b
Merge branch 'experimental' into pr/xuanfeiren/3
chinganc Jun 10, 2025
0f47c6c
Fix some import issues due to updates in experimental.
chinganc Jun 10, 2025
d2d69c3
Rename file.
chinganc Jun 10, 2025
6b302c8
Fix a bug in CustomLLM's attributes not defined with model not being …
chinganc Jun 10, 2025
cdf090f
Merge branch 'experimental' of https://github.com/AgentOpt/Trace into…
allenanie Jun 11, 2025
cfe5ee1
push the workable version (without unit test code yet)
allenanie Jun 11, 2025
a1aa425
Merge remote-tracking branch 'origin/add_model_dump' into add_model_dump
allenanie Jun 11, 2025
0b0824c
update signature for projection
allenanie Jun 11, 2025
f38f34a
Make prompt templates as atributes of the trainer classes
xuanfeiren Jun 11, 2025
15057bd
improve `model_dump` to handle `node` attributes and unpack those as …
allenanie Jun 14, 2025
cfaddea
fix a bug, added new test cases
allenanie Jun 15, 2025
e186ace
ADDED: multi-LLM support via LLMFactory (fully backward compatible) a…
doxav Jun 16, 2025
7a12c2f
Fix a bug of missing default test_dataset.
chinganc Jun 16, 2025
239194d
Set to use default LLM instead of LiteLLM.
chinganc Jun 16, 2025
874248d
Remove necessary dependency on LiteLLM and remove using vertex as def…
chinganc Jun 16, 2025
83aa0e5
Merge remote-tracking branch 'origin/experimental' into cleaning_up
chinganc Jun 16, 2025
36296d0
Remove LiteLLM dependency in gsm8k example
chinganc Jun 16, 2025
515db8a
Merge remote-tracking branch 'upstream/experimental' into experimental
xuanfeiren Jun 17, 2025
e592fa4
Add a wandb logger
xuanfeiren Jun 17, 2025
726e1ca
Merge branch 'experimental' into multi_llm
doxav Jun 17, 2025
6a6a165
Deleted two UCB search algorithms in PR
xuanfeiren Jun 18, 2025
37d5883
add refactoring XML
allenanie Jun 18, 2025
d9b3bf0
Modified the code based on the comments in PR page
xuanfeiren Jun 19, 2025
70e55f7
Merge pull request #3 from xuanfeiren/experimental
chinganc Jun 19, 2025
a2a69c7
update signature, add test to check updating bundle functions
allenanie Jun 19, 2025
cd01e9c
add the import test
allenanie Jun 19, 2025
2665ffd
Merge pull request #6 from AgentOpt/add_model_dump
chinganc Jun 19, 2025
d996ac7
Update README.md with link to roadmap
adith387 Jun 20, 2025
b8f6137
Fix the bug by using optimizer.parameters
xuanfeiren Jun 20, 2025
1a89024
Add logging for initial, validation, and test scores in Beamsearch al…
xuanfeiren Jun 20, 2025
8035c24
Add detailed logging for UCB search algorithm
xuanfeiren Jun 20, 2025
249eba4
refined optoprimmulti for more stability
doxav Jun 21, 2025
97ab712
Merge pull request #8 from xuanfeiren/experimental
chinganc Jun 22, 2025
62f5fda
Update CONTRIBUTING.md and add opto/features.
chinganc Jun 24, 2025
8431f6d
Add files via upload
allenanie Jun 24, 2025
9184307
Update CONTRIBUTING.md
allenanie Jun 24, 2025
06daabd
Update CONTRIBUTING.md
allenanie Jun 24, 2025
9405815
Add example usages of LLMFactory in docstring.
chinganc Jun 24, 2025
2ff3c5a
Merge pull request #7 from doxav/multi_llm
chinganc Jun 24, 2025
668d8b9
Update CONTRIBUTING.md
allenanie Jun 24, 2025
05f9bdf
Fix API inconsistency of update in Minibatch, which results in num_th…
chinganc Jun 25, 2025
3a7043e
Update CONTRIBUTING.md
chinganc Jun 25, 2025
ea36515
Update CONTRIBUTING.md
chinganc Jun 25, 2025
003c33d
Update CONTRIBUTING.md
chinganc Jun 25, 2025
2285916
Remove constraint in Node classes
chinganc Jun 25, 2025
b41151f
Update CONTRIBUTING.md
chinganc Jun 25, 2025
52558cf
Update default description.
chinganc Jun 26, 2025
8f4327a
Fix some bugs due to description change.
chinganc Jun 26, 2025
0621372
Make default description construction programmatic
chinganc Jun 26, 2025
3274fd4
Set default description to be None.
chinganc Jun 26, 2025
3b872f1
Fix bug of textgrad seeing None description.
chinganc Jun 26, 2025
f7d65af
Fix a bug in textgrad due to earlier commit that removes constraint_text
chinganc Jun 26, 2025
75b3d65
Merge remote-tracking branch 'origin/experimental' into fix/removing_…
chinganc Jun 26, 2025
fac22ad
Update docstring of Node.
chinganc Jun 26, 2025
e309dbe
Update ci.yml
chinganc Jun 26, 2025
4796e88
Merge remote-tracking branch 'origin/experimental' into fix/removing_…
chinganc Jun 26, 2025
a0b9c96
Merge remote-tracking branch 'origin/experimental' into fix/num_threads
chinganc Jun 26, 2025
a21c91f
Update CONTRIBUTING.md
chinganc Jun 26, 2025
3360598
Fix the bug in test_modules.py
chinganc Jun 26, 2025
0a078de
Merge branch 'fix/num_threads' into feature/improved_evaluate
chinganc Jun 26, 2025
c4bb3d2
Merge branch 'fix/removing_constraint_attr' into feature/improved_eva…
chinganc Jun 26, 2025
a7c44b9
Move and uipdate evaluate to incorporate deepcopy and num_samples
chinganc Jun 26, 2025
7b63ba7
fix typing to be `Optional[int]` instead of `int`
allenanie Jun 27, 2025
4c649e7
Merge pull request #11 from AgentOpt/fix/num_threads
chinganc Jun 27, 2025
3877961
Fix a bug that BasicSearchAlgorithm always prints to stdout.
chinganc Jun 27, 2025
5116123
Merge branch 'experimental' into feature/improved_evaluate
chinganc Jun 27, 2025
a1cfad4
Merge pull request #13 from AgentOpt/fix/verbose_of_BasicSearch
chinganc Jun 27, 2025
6a4db55
Merge remote-tracking branch 'origin/experimental' into feature/impro…
chinganc Jun 27, 2025
cfd3e55
Add batch_run
chinganc Jun 30, 2025
b18ad2a
add allow_sequential_run to async_run.
chinganc Jun 30, 2025
a9f26d4
Update batch_run.
chinganc Jun 30, 2025
2deb8c2
Fix the typo bug in gsm8k example
chinganc Jun 30, 2025
02924d2
Update evaluate to use batch_run.
chinganc Jul 1, 2025
fa1044d
Update algo to use batch_run. Update evaluate to return 2d array when…
chinganc Jul 1, 2025
03c7a9e
Update README.md
chinganc Jul 1, 2025
ad8cc68
Merge branch 'feature/improved_evaluate' of https://github.com/AgentO…
allenanie Jul 1, 2025
66be4a4
Add flags to set json keys in OptoPrime. Add DummyLLM for testing. Me…
chinganc Jul 1, 2025
6fcb72b
contribute an interesting test case for the module copy behavior
allenanie Jul 2, 2025
c287836
add the latest version of UCB search algorithms
xuanfeiren Jul 2, 2025
9f349c3
merge from experimental
allenanie Jul 2, 2025
9754dbe
Merge pull request #12 from AgentOpt/fix/removing_constraint_attr
chinganc Jul 2, 2025
5d7320b
Fix the bug in test_optoprime_udpate.py
chinganc Jul 2, 2025
6cbb366
Merge branch 'experimental' into feature/improved_evaluate
chinganc Jul 2, 2025
c6c9397
Merge remote-tracking branch 'origin/experimental' into feature/impro…
chinganc Jul 2, 2025
a7414d1
add XML format
allenanie Jul 2, 2025
d89707f
add XML parsing
allenanie Jul 2, 2025
625f5ae
Merge pull request #16 from AgentOpt/feature/add_flags_to_control_opt…
chinganc Jul 2, 2025
7508375
Merge branch 'experimental' of https://github.com/AgentOpt/Trace into…
allenanie Jul 2, 2025
3e6cec2
Move copy def to ParameterContainer and update it to support nesting.
chinganc Jul 3, 2025
f3e741a
Merge pull request #15 from AgentOpt/feature/improved_evaluate
chinganc Jul 7, 2025
83a5220
Make DataLoader an iterator and add a sample method for continuously …
chinganc Jul 8, 2025
8bdc0a1
Add test_dataloader.py
chinganc Jul 8, 2025
5f36936
fix a bug in AutoGuide
xuanfeiren Jul 9, 2025
94ad0e5
fix a bug in batch_run
xuanfeiren Jul 9, 2025
b2bafad
adding working XML parsing and new format
allenanie Jul 9, 2025
6d26d87
separate node into two types
allenanie Jul 9, 2025
e8a1aee
constraint is integrated into the variable now
allenanie Jul 9, 2025
f33f575
add expression truncation
allenanie Jul 9, 2025
aa86385
Merge pull request #18 from xuanfeiren/experimental
chinganc Jul 10, 2025
bf55724
update XML tag
allenanie Jul 10, 2025
88d7328
add robust XML parsing
allenanie Jul 10, 2025
101f8a8
update
allenanie Jul 10, 2025
58ef4b3
commit an intermediate version (not cleaned up)
allenanie Jul 10, 2025
35f1578
finished with flexible tag change
allenanie Jul 10, 2025
c12ab3e
add test for optoprime_v2 (it can print prompt out)
allenanie Jul 10, 2025
3823d0e
fix pyproject file
allenanie Jul 10, 2025
3167a08
quick fix on xml parsing testing
allenanie Jul 10, 2025
27e8c64
add more cleanup
allenanie Jul 10, 2025
b337b1d
Merge branch 'experimental' of https://github.com/AgentOpt/Trace into…
allenanie Jul 10, 2025
397e983
Update naming convention of deepcopied node.
chinganc Jul 10, 2025
7177f10
added new test and it passes
allenanie Jul 10, 2025
569c71f
incorporate some of Xavier's suggestion on OptoPrime instruction change
allenanie Jul 10, 2025
e3d0844
Add randomize flag and n_epochs attribute to Dataloader.
chinganc Jul 10, 2025
151fef5
remove UCBsearch
allenanie Jul 10, 2025
e97ebb4
add updated XML parsing, add fix to ProblemInstance
allenanie Jul 11, 2025
47cb1fe
fix error
allenanie Jul 11, 2025
7a9f829
add fix to examples
allenanie Jul 11, 2025
04eded6
fix the `_step()` where the suggestion is now nested
allenanie Jul 11, 2025
02ad4ed
Update copy test
chinganc Jul 14, 2025
3654581
Add a runnable search algorithm implementation.
chinganc Jul 14, 2025
a2f1fa1
Add the example script.
chinganc Jul 14, 2025
7dae49a
Fix a bug caused by the recent update to evaluate of Minibatch.
chinganc Jul 14, 2025
629b1f0
Merge branch 'fix/evaluate_bug' into feature/search_algo
chinganc Jul 14, 2025
5f93cce
Refactor into Sampler
chinganc Jul 14, 2025
2be34af
Made is_node_copy function transitive
xuanfeiren Jul 14, 2025
dc329e0
Finish a runnable refactor code.
chinganc Jul 14, 2025
2a96929
Merge branches 'feature/search_algo' and 'feature/search_algo' of git…
chinganc Jul 14, 2025
1a098c7
Update PrioritySearch
chinganc Jul 15, 2025
abcf7dd
Add unit test for sampler.
chinganc Jul 15, 2025
e0620c9
Merge pull request #21 from AgentOpt/fix/evaluate_bug
chinganc Jul 15, 2025
07bb4c7
fixed a bug about remapped_update_dict
xuanfeiren Jul 16, 2025
166c978
add ucb reward
xuanfeiren Jul 16, 2025
bca0b39
Merge remote-tracking branch 'origin/experimental' into feature/searc…
chinganc Jul 16, 2025
c360e9a
Fix some bugs in PrioritySearch. Update search_algo example script.
chinganc Jul 16, 2025
58b0c66
add JSON option through OptimizerPromptSymbolSetJSON
allenanie Jul 16, 2025
0bb8d44
add enforce_json flag
allenanie Jul 16, 2025
a5d5ee9
moved truncate_expressions outside
allenanie Jul 16, 2025
b2766ac
moved helper function to utils
allenanie Jul 16, 2025
b69f68f
fix typing import error
allenanie Jul 16, 2025
510dfbd
Merge branch 'AgentOpt:feature/search_algo' into feature/search_algo
xuanfeiren Jul 16, 2025
f9c78f3
Bring back ucb from experimental.
chinganc Jul 16, 2025
5625a9a
Fix the bug of validate.
chinganc Jul 16, 2025
40628be
Merge branch 'AgentOpt:feature/search_algo' into feature/search_algo
xuanfeiren Jul 17, 2025
f1cf63c
Fix an issue about missing parameters in the proposed update_dict
xuanfeiren Jul 17, 2025
c47d4e5
Revert "add ucb reward"
xuanfeiren Jul 17, 2025
c8c48fb
Merge pull request #20 from AgentOpt/opto_refactoring
chinganc Jul 17, 2025
6743319
Add memory size and ignore empty update.
chinganc Jul 22, 2025
ee06082
Merge remote-tracking branch 'origin/experimental' into feature/searc…
chinganc Jul 22, 2025
65a0309
Merge branch 'experimental' of https://github.com/AgentOpt/Trace into…
allenanie Jul 23, 2025
202c10d
Fix a bug in propose in PrioritySearch. Add __lt__ method to ModuleC…
chinganc Jul 24, 2025
85b1131
Add num_rollouts property to ModuleCandidate
chinganc Jul 24, 2025
4e906cc
Refactor priority search.
chinganc Jul 24, 2025
ba38608
Add missing search template
chinganc Jul 24, 2025
c67a202
Add print statements
chinganc Jul 24, 2025
70cba72
Update printing
chinganc Jul 24, 2025
57a740b
Update to use pytest
chinganc Jul 24, 2025
21ca662
Rename example
chinganc Jul 24, 2025
87b3156
Add docstring
chinganc Jul 24, 2025
d8305b3
Add examples of priority search.
chinganc Jul 25, 2025
98419b6
Merge remote-tracking branch 'origin/experimental' into feature/searc…
chinganc Jul 25, 2025
368c131
Fix a bug in of deleting keys in default_json_keys
chinganc Jul 25, 2025
7364b50
Add use_best_candidate_to_explore flag (True as default).
chinganc Jul 25, 2025
e6ab7ed
Add UCB score, update logging, and score_range attribute.
chinganc Jul 25, 2025
8c34f02
apply fix
allenanie Aug 4, 2025
14d4b72
Merge pull request #25 from AgentOpt/bug/fix_agent_save
chinganc Aug 6, 2025
1a86085
Add save load methods to trainer algorithm, dataloader, optimizers, g…
chinganc Aug 7, 2025
6935652
Minor bugfixes to get examples and tests to work
Aug 12, 2025
464ae5a
Merge branch 'experimental' into feature/trainer_save_load
chinganc Aug 12, 2025
62c9d3a
Fixing notebooks in docs, adding tutorial for trainers
Aug 13, 2025
0ffbec3
initial commit for opro_v2
allenanie Aug 13, 2025
3fdc688
Move priority_search under opto/features
chinganc Aug 14, 2025
1200ba4
move sampler under opto/features/priority_search
chinganc Aug 14, 2025
f36b131
Merge pull request #22 from AgentOpt/feature/search_algo
chinganc Aug 14, 2025
7d1c3dd
fix a few issues and now it works
allenanie Aug 15, 2025
fa32419
add extraction test to both oprov2 and optoprimev2
allenanie Aug 15, 2025
c62fe85
Merge branch 'experimental' into feature/trainer_save_load
chinganc Aug 15, 2025
26527f5
changed problem_instance symbol replace and updated init args
allenanie Aug 15, 2025
b834d95
Merge pull request #26 from AgentOpt/feature/trainer_save_load
chinganc Aug 15, 2025
f0acd6a
update the default parameter in OPROv2
allenanie Aug 15, 2025
0936a5a
Rename AutoGuide -> Guide, VerbalJudgeGuide -> LLMJudge, model_dump -…
chinganc Aug 15, 2025
ed2b00b
Merge pull request #28 from AgentOpt/feature/oprov2
chinganc Aug 15, 2025
dd51f6a
Rename AlgorithmBase to Trainer
chinganc Aug 15, 2025
3dcc895
Merge pull request #29 from AgentOpt/feature_renaming
chinganc Aug 15, 2025
dcd8101
Update version number to v0.2.0
chinganc Aug 15, 2025
48b8fbd
Merge branch 'main' into v0.2.0
chinganc Aug 15, 2025
b242295
Fix mkdocstrings cross-reference warnings in LLM docstring
allenanie Aug 19, 2025
a22b792
Merge branch 'experimental' of https://github.com/AgentOpt/OpenTrace …
chinganc Aug 19, 2025
065e8c4
Merge remote-tracking branch 'origin/v0.2.0' into experimental
chinganc Aug 19, 2025
e9bfb07
Fix missing oprov2 problem
chinganc Aug 19, 2025
e258e87
Add an assertion to make optimizer receives non-empty parameters.
chinganc Aug 20, 2025
9b40d17
Merge branch 'main' into v0.2.0
chinganc Aug 20, 2025
d2d744c
quick comment cleanup of opro_v2
allenanie Aug 20, 2025
9b7ee98
Merge branch 'experimental' of https://github.com/AgentOpt/OpenTrace …
allenanie Aug 20, 2025
3d444cb
Add a prototype
chinganc Aug 21, 2025
50c7adc
Update train.py
chinganc Aug 22, 2025
3c79cca
Make train runnable and add an example code
chinganc Aug 22, 2025
6def8fa
Fix a bug in the example code. Set minibatch's ensure improvement to …
chinganc Aug 22, 2025
4ab8cca
Clean up obsolete files
Aug 25, 2025
53986cc
Merge pull request #32 from AgentOpt/fix/oprov2_missing
adith387 Aug 26, 2025
432459a
Make train support single-node optimization
chinganc Aug 27, 2025
c347274
Merge pull request #33 from AgentOpt/feature/train
chinganc Aug 28, 2025
1b7f990
Merge branch 'experimental' into v0.2.0
chinganc Aug 28, 2025
851f621
priority search simple bug fix. async_run accommondates jupyter notebook
allenanie Sep 3, 2025
a3114fb
fix the node value representation (variable now uses original `repr_n…
allenanie Sep 9, 2025
3c27ec3
Merge branch 'experimental' into v0.2.0
chinganc Sep 10, 2025
979f49d
fixing memory representation in optimizers (now XML tag based)
allenanie Sep 11, 2025
276414a
upgrade
allenanie Sep 11, 2025
5953a5d
upgrade workflow
allenanie Sep 11, 2025
9f9fe0a
Merge pull request #36 from AgentOpt/python310
chinganc Sep 12, 2025
71d0c4a
Merge branch 'experimental' into v0.2.0
chinganc Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ main, dev, ci-multi ]
branches: [ main, dev, experimental, ci-multi ]
pull_request:
branches: [ main, dev, ci-multi ]
branches: [ main, dev, experimental, ci-multi ]

jobs:
test:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:

# 6) Set up Python & install dependencies
- uses: actions/setup-python@v5
with: { python-version: "3.9" }
with: { python-version: "3.10" }
- name: Install Python deps
run: |
pip install -e .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.9"
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
66 changes: 54 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,69 @@
# Contribution Guide
# Contribution Guideline

Trace is an actively growing project and under active maintenance and development! We welcome your contributions and involvement. Below are instructions for how to contribute to Trace.
Trace is an actively growing project and under active maintenance and development! We maintain two major branches `main` and `experimental`. The `main` branch is the most stable, version-controlled branch and it is what the PyPI package is linked to. On the other hand, the `experimental` branch is the dev branch, which will change more dynamically in preparation for the next version update.

### Development and Review Process

Contribution to these two branches requires going through a review process via PR and passing all unit tests in CI.
Merging a PR requires at least one reviewer different from the contributor, except for those marked as [**LIGHT**] below.

Here is an outline:

1. `main` will be regularly updated by PRs based on the development of the `experimental` branch following the [roadmap doc](https://docs.google.com/spreadsheets/d/1dMoECd2Soj6bATpkNDeaMxl0ymOYCtGq7ZiHr0JRdJU/edit?usp=sharing). Each update will result in a version update.

2. Except for the planned roadmap, `main` will only be updated to fix bugs. Bug fix to what is in `main` should be submitted as PR to `main`. This will trigger a quicker review (< 3 days) and result in a version update in the third digit, and the `experimental` branch will then rebase on the updated `main`.

3. For feature development, PR should be submitted to the `experimental` branch without version update. Generally, the `experimental` branch aims to realize the milestones listed in the next version update in the [roadmap doc](https://docs.google.com/spreadsheets/d/1dMoECd2Soj6bATpkNDeaMxl0ymOYCtGq7ZiHr0JRdJU/edit?usp=sharing). If applicable, new determinstic unit tests should be added under `tests/unit_tests`, or an example run script should be added in `examples`.

4. [**LIGHT**] Bugs fix to the new changes introduced in the `experimental` branch should be submitted as a PR to the `experimental` branch. This PR will be incoporated quickly with a light review.

5. [**LIGHT**] For contributions under the directory `opto/features`, they should be submitted as PR to the `experimental` branch. These usually are not under roadmap and are content not made as dependable by codes in other directories. That is, contents under `opto/features/A` should not be imported by files other than those under `opto/features/A`. So long as this rule is met, the PR will be incorprated under a light review.

6. Updates to non-coding elements (like documents) do not require a PR.

The above is applicable to all contributors, including the core contributors and maintainers.

In a regular development cycle, all features and bug fixes are merged into the experimental branch. After the items listed in the [roadmap doc](https://docs.google.com/spreadsheets/d/1dMoECd2Soj6bATpkNDeaMxl0ymOYCtGq7ZiHr0JRdJU/edit?usp=sharing) are all added to the `experimental` branch, a version branch (e.g., `v0.2.1`) will be created from `experimental`, and it will be staged for a release (to be merged into the `main` branch with a PR). At this point, the version number of the `experimental` branch will be updated to start the development of the next version.

![workflow](https://github.com/AgentOpt/Trace/blob/experimental/docs/images/contributing_workflow.png?raw=true)

### Communication

1. Quick questions should be posted on Discord channel.

2. For bugs, feature requests, contributions, or questions that might be related to a broader audience, post them as issues on the github page.

### Other Branches

In addition to `main` and `experimental`, other branches have a naming convention or `vx.x.x` for version branchs, or of `feature/xxx` or `fix/xxx`, which implements the items on the roadmap. They will be merged into the `main` or `experimental` accordingly following the rules above. Once merged, they will be removed.


# Steps for Contributions

We welcome your contributions and involvement. Below are instructions for how to contribute to Trace.

## Quick Bug Fix

If there is a minor, isolated bug that can be directly fixed, the bug fix should be submitted as a pull request and will be merged into the `main` branch.
If there is a minor, isolated bug that can be directly fixed, please report it as an issue or submit a PR to be merged into the `main` branch or `experimental` branch, depending on where the issue arises.


## Contributing Feature

We welcome new ideas.

### Step 1: Feature Spec Doc
A feature should first be written as a Google Doc (an example is [here](https://docs.google.com/document/d/1FX1ygc8lgFpFn3ni3E2A_DCGtn505PpAM8QaAjEovsA/edit?usp=sharing)).
### Step 1: Create an Issue

### Step 2: Create an Issue
An issue should be created, and under the issue, the doc is linked. People should be allowed to comment on the doc.
If your changes are expected to involve in less 50 lines of codes, create an issue titled "[LIGHT] XXX". You should describe the motivation, give an overview of the change (e.g., by a pseudo-code) and its desired effects. Otherwise, create an issue titled "[MAJOR] XXX". You should write a more detailed description of your motivation, design, and demo. If more space is needed, you can attach a link to a Google doc. People should be allowed to comment on the doc.

### Step 3: Implement Feature
Create a separate branch, extending from the `experimental` branch. This branch contains all the new features that have not been merged into the `main` branch yet.
### Step 2: Implement Feature

Create a separate branch, extending from the `experimental` branch, which contains all the new features that have not been merged into the `main` branch yet.
Make sure your features are implemented, along with `unit tests` or `examples` to show how it's used.

### Step 4: Create a Pull Request
Create a pull request formally to merge into the experiment branch and request a review. This is a lightweight review that only checks for malicious code, or if the feature does not pass its own unit tests.
### Step 3: Create a Pull Request

Create a PR formally to merge into the experiment branch and request a review. For standalone features, put the changes under `opto/features/`. This will trigger the lightest review that only checks for malicious code, or if the feature does not pass its own unit tests. For changes to the rest, expect a slightly longer review process as we work out how the changes should be integrated with the core library. Also, [LIGHT] issues can expect faster review than [MAJOR].

### Step 5: Merge into Experimental
### Step 4: Merge into Experimental
Once the request is approved, it will be merged into the `experimental` branch.

25 changes: 0 additions & 25 deletions OAI_CONFIG_LIST_sample

This file was deleted.

81 changes: 53 additions & 28 deletions OVERVIEW.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,57 @@
# Overview of Trace and Development Guide

The library of Trace is designed to be a lightweight, modularized package to allow developers to easily try new ideas on generative optimization and integrate learning wtih their pipelines.

Currently, the Trace library has three main modules collected under the `opto` top module.

1. `opto.trace` provides the infrastructure for tracing computational workflows. It defines two primitives `trace.node` and `@trace.bundle`. They can be applied to Python objects and methods, respectively, which define the root nodes and operators of the directed acyclic graph (DAG) of computation. They both have a `trainable` flag. When set `True`, the wrapped objects are viewed as *parameters* of the computational worflow. Users can use `trace.node` and `@trace.bundle` to declare the data and computation that they wish to trace and/or adapt, and we call the resulting workflow defined by these two primitives a *traced* workflow. When running a traced workflow, a DAG will be automatiically created by Trace as a data structure, which will later be sent to optimizers in `opto.optimizers`for updates (upon calling `node.backward` with soem feedback).

2. `opto.optimizers` has a collection of generative optimization algorithms, whose API is defined by an abstract class `Optimizer`. Think them like gradient algorithms. Their job is to propose a new version of the parameters (i.e. those set with `trainable=True`) when receiving a computational graph (DAG) and the feedback given to the computed output. Typically, these algorithms can be viewed as an LLM agent, which makes calls to LLM to analyze the computational graph and the feedback, and to propose updates. In Trace library, we provide implementation of several popular optimizers, such `OptoPrime`, `TextGrad`, and `OPRO`.

3. `opto.trainers` are a collection of training algorithms (under the `AlgorithmBase` class) that use optimizers in `opto.optimizers` as subroutines to improve a given workflow following a feedback oracle constructed by datasets, interactive environments, etc. While `Optimizer` defines a low-level *optimization* API, `AlgorithmBase` defines a high-level *learning* API which standarizes the format of agent (by the `Module` class created by `@trace.model`), the data loader (by the `DataLoader` class), and the feedback oracle (by the `AutoGuide` class). With this common abstraction, we offer training algorithms, from the basic `MinibatchAlgorithm` which trains minibatches of samples to search algorithms like `BeamSearch`. The `AlgorithmBase` also handles logging of the training process. While there are overlapping between the functions of `Optimizer` and `AlgorithmBase`, the main distinction is that algorithms under `AlgorithmBase` are meta algorithms, as they should work for different optimizers in `opto.optimizers`.


4. `opto.utils` has a collection of helper functions and backends, which are reusable for various applications. This includes, e.g., abstraction of LLMs, database, etc. Making use of all these utils would requie installing optional depedencies.


In summary, `opto.trace` is the infrastructure, `opto.optimizers` are algorithms that process feedback and propose new parameter candidates, and `opto.trainers` are algorithms built on top of `opto.trace` and `opto.optimizers` to train learning agents.

## Common Workflow of Using Trace

1. Use `trace.node` and `@trace.bundle` to define the traceable workflow and its trainable parameter.
2. Wrap the workflow as a `trace.Module` using `@trace.model`
3. Create a dataloader using `DataLoader` and define the feedback oracle (an analogy of loss function) using `AutoGuide`.
4. Create a trainer from `opto.trainers` using optimizers from `opto.optimizers` and the above module, dataloader, and feedback oracle.
The Trace library is a lightweight, modular package designed to allow developers to experiment easily with generative optimization and integrate feedback-driven learning into their computational workflows.
The library has four modules within the `opto` top-level namespace:

1. `opto.trace` provides the infrastructure for converting executing Python code into symbolic directed acyclic graphs (DAGs).
It defines two tracing primitives:
- `trace.node`: Wraps Python objects, designating them as nodes within the computational graph.
- `@trace.bundle`: Decorates Python methods/functions, marking them as operators within the graph.

Each primitive has a `trainable` flag.
When set to `True`, these marked nodes and bundles become the trainable *parameters* of the workflow.
By using these primitives, developers can create a *traced workflow* represented as a DAG.
This DAG structure is automatically constructed at runtime, capturing both computational dependencies and trainable parameters, ready for optimization.

2. `opto.optimizers` has an abstract class `Optimizer` that defines algorithms that take computation DAGs and associated feedback objects as input, and output values for the trainable parameters.
These algorithms are analogous to gradient-based optimizers in PyTorch, but are typically implemented as generative optimization agents, leveraging LLMs to analyze feedback and propose parameter updates.
We provide implementations of several generative optimizers:
- `OptoPrime`
- `TextGrad`
- `OPRO`

3. `opto.trainers` has the `AlgorithmBase` abstraction that orchestrates the overall training process.
Trainers manage data handling, tracing control, feedback collection, optimizer invocation, and iterating/stopping. Specifically, a trainer:
- Controls data sampling (via `DataLoader`).
- Determines when DAGs are constructed and when feedback (e.g. via `AutoGuide`) is collected .
- Invokes `optimizers` for parameter updates, possibly repeatedly and manages the training loop.
- Logs training progress.

Although `optimizers` handle lower-level optimization decisions, trainers under `AlgorithmBase` manage broader training logic and are designed to be compatible across various `optimizers`.
We provide implementations of common trainers: `MinibatchAlgorithm`(basic minibatch training) and `BeamSearch` (example of search-based training).

4. `opto.utils` has a collection of reusable helper functions and backend utilities, including abstraction for:
- Large Language Models (LLMs)
- Databases
- Miscellaneous support tools.

Note: Some utilities might require installing optional depedencies.

## Concise Summary of Abstractions
- `trace`: Infrastructure to construct symbolic computational DAGs
- `optimizers`: Receive DAG and feedback, output parameter values.
- `trainer`: Manages DAG construction, data sampling, feedback collection, optimizer invocation, and training workflow control.

## Common Workflow for Using Trace

1. Define a traceable workflow with `trace.node` and `@trace.bundle`, marking trainable parameters.
2. Wrap this workflow into a `trace.Module` with `@trace.model`.
3. Define a dataloader (`DataLoader`) and feedback oracle (analogous to a loss function, using e.g. `AutoGuide`).
4. Instantiate a trainer from `opto.trainers`, specifying the optimizer from `opto.optimizers` alongside the defined module above, dataloader, and feedback oracle.
5. Run the trainer.


## Common Workflow of Improving Trace
- **Developing new optimization agent** Contribute to `trace.optimizers` and design new algorithms under `Optimizer`
- **Developing new learning algorithms** Contribute to `trace.trainers` (and `trace.optimizers` when necessary). Design new algorithms under `AlgorithmBase`, new dataloader under `DataLoader`, or new feedback oracle under `AutoGuide`.
- **Improving infrastructure** Propose updates to change `opto.trace` (e.g., to improve UI, add new tracing, etc.)
- **Onboarding other utility tools** Add to `opto.utils` and update `setup.py` with optional requirements.
## Guidelines for Improving and Extending Trace
- **New optimization agents**: Contribute to `opto.optimizers`, sub-class from the `Optimizer` abstraction.
- **New learning algorithms**: Contribute to `opto.trainers` (and optionally `opto.optimizers` if necessary). Design new algorithms sub-classing `AlgorithmBase`, new dataloader under `DataLoader`, or new feedback oracle under `AutoGuide`.
- **Improving infrastructure**: Propose modifications to `opto.trace` to improve tracing capability, user experience, or additional functionality.
- **Onboarding other utility tools**: Add helpful tools to `opto.utils` and update `setup.py` accordingly for optional dependencies.
Loading