Skip to content

Add documentation for LLM recommender - #933

Open
AVHopp wants to merge 2 commits into
feature/llm-recommenderfrom
docs/llm-recommender
Open

AVHopp wants to merge 2 commits into
feature/llm-recommenderfrom
docs/llm-recommender

Conversation

@AVHopp

@AVHopp AVHopp commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds an example for the LLMRecommender as well as some explanation in the recommender user guide.

The exact design of the example, and in particular how to deal with the fact that we cannot load a real LLM but would probably like to display real results is something we probably still need to discussed.

Compiled version of documentation:


Stack created with GitHub Stacks CLI • Give Feedback 💬

@AVHopp
AVHopp added this pull request to stack #934 October 16, 2026 09:52

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use this thread for a more general discussion on this example.

My main question is: How do we want to deal with having to rely on some sort of mocks as we should definitely NOT have any code that might just execute LLM queries in our examples while still having a nice way of showing actual results? The results that I show here now are pre-computed, but having them requires some ugly code at the end of the example which we probably don't want.

One alternative would be to move this into the user guide, where we could then also explain a bit more about the pros and cons of the LLM Recommender and the different meta recommenders. What are your thoughts? Note that for this reason, the SVGs are also not yet optimized and compressed as I first want us to come to a decision how to deal with those at all (will then also get rid of them by force pushing)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use some of the already inclued csv datasets or basically anything form the benchmark suite to create a mock and reudce the code needed for that in the example

i see no problem in that as long as its clearly stated in the example that the recommendations here are mocked and the example is just there to demonstrate how to set up the LLMRecommender

@AVHopp
AVHopp marked this pull request as ready for review October 16, 2026 10:47
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The example misses the two-phase transition and can terminate simulations early by sampling excluded configurations.

3 open findings
What changed in this PR

Adds documentation and an example for using BayBE’s LLM recommenders alongside Bayesian optimization.

Changes:

  • Documents provider setup, prompt construction, metadata, and limitations.
  • Adds a mocked chemical optimization comparison.
  • Includes light- and dark-theme comparison plots.
File Description
examples/​LLM/​llm_recommender.py Demonstrates LLM and hybrid recommendation strategies.
examples/​LLM/​llm_recommender_sonnet_5_light.svg Adds the light-theme Sonnet 5 comparison plot.
examples/​LLM/​llm_recommender_sonnet_5_dark.svg Adds the dark-theme Sonnet 5 comparison plot.
examples/​LLM/​LLM_Header.md Introduces the LLM examples category.
docs/​components/​recommenders.md Explains LLM recommender configuration and behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


# ## Settings

N_DOE_ITERATIONS = 3

def _mock_query_model(self, prompt):
"""Return a JSON string with randomly sampled candidates."""
batch = searchspace.discrete.exp_rep.sample(BATCH_SIZE)
Comment on lines +166 to +167
# In practice, replace ``"test/model"`` with a real LiteLLM model identifier such as
# ``"anthropic/claude-sonnet-4-6"`` and ensure the corresponding API key is set.
BayBE makes a single automatic recovery attempt by re-sending the full context
along with a description of what went wrong.

### Enriching recommendations with natural language

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use telegraph style for all headings

solvent = SubstanceParameter(
"Solvent",
data={"DMAc": "CC(N(C)C)=O", "p-Xylene": "CC1=CC=C(C)C=C1"},
encoding="MORDRED",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
encoding="MORDRED",

(isnt needed for this example, save space, reduce complexity)


### Limitations

{class}`~baybe.recommenders.pure.llm.llm.LLMRecommender` does not support

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be reworded so be more robust to changes int he future. For instance Doesnt support [insert property that describes whats not supported], for instance CustomTransformation...

)
~~~

### Limitations

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,3 @@
# Large Language Models

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not evens ure this example is reuqired? what additional thing does it teach compared to the instructions in the user guide? (also consisering the difficulties in executing this and the need for mocking etc)

This branch has not been deployed

No deployments
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.

3 participants