-
Notifications
You must be signed in to change notification settings - Fork 76
[WIP] Add automatically generated LLM context files #575
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
base: dev
Are you sure you want to change the base?
Conversation
I am currently leaning towards going with the compact file only:
|
Codecov Report✅ All modified and coverable lines are covered by tests. |
Thanks for opening the discussion. As I already indicated in the previous discussion, I'm skeptical that we do ourselves a favor with that addition and currently opposed to merging this. Besides the general concerns surrounding LLMs, I think our users are better served by working with the tutorials and documentation. If we include files like the above, we suggest to our users that using LLMs is a viable strategy to write code with BayesFlow, and that this is a workflow we are willing to offer support for. Given the widely reported accuracy problems of LLMs, also for tasks like summarization, I'm skeptical that the output is sufficiently accurate to be useful for anyone who is not already familiar with the code. Also, the tutorials convey important information on how to use ABI and highlight potential issues, so using an LLM as a shortcut might backfire when users no longer encounter this kind of information. @elseml Could you provide a few non-cherrypicked example interactions of how a user would use an LLM with this setup, assuming they have little prior knowledge of BayesFlow, and the results they would obtain? If possible, please use tasks that are not part of the documentation. This would help me judge what kind of code we would expect to see. |
Hi Valentin, thanks for bringing in your concerns! I fully agree about the reliability problems of LLMs. However, I am pretty convinced that the a substantial share of BF users already uses LLM assistance and the usage of LLM assistance in coding will continue to increase. Given these assumptions, the feature is for me mainly about equipping BF users with tools for mitigating the damage of hallucinations (i.e., by providing the LLMs with a better grounding in the BF code). A bit in the direction of companies hosting their own internal LLM instances to prevent data leakage due to employees already using LLMs for their tasks. But yeah, this WIP PR is meant as an open testing ground, so we might very well conclude after more testing that, even when providing context, current LLMs are still not accurate enough yet to be of any use for BF users. If we indeed decide to proceed with this feature, I would support adding a prominent disclaimer highlighting these concerns, emphasizing that LLM assistance is supplementary to, rather than a replacement for, consulting the tutorials. Concerning example interactions: Here are two trials for the frequent use case of evidence accumulation modeling (only testing the compact context file since ChatGPT upload limitations are pretty strict): Some observations:
I think more constrained applications (e.g., debugging / asking specialized questions about existing code like in the forum) might be better test cases than full code generation from scratch. I will test that out as well when upload limits allow. As stated above, I would also be very interested in seeing which other use cases other people come up with. |
Summary
TL;DR: LLMs code generation can be sloppy for BayesFlow. This PR introduces automatically generated context files for constraining LLM code generation.
Full summary: This PR introduces a pipeline for automatically generating LLM context markdown files for BayesFlow. The goal is to make LLM assistance more accurate and user-friendly by providing lightweight, up-to-date repository snapshots (aka some very basic RAG) based on gitingest. Users can download a single context file to provide their LLM with the latest BayesFlow state.
This addition targets the broad pip install userbase (power users might just pass their local repo clone to an IDE-integrated LLM, but standard users might not have a local repo clone or use an IDE-integrated LLM). As discussed previously, this is a WIP PR for openly testing and discussing whether this addition is beneficial in lowering the barrier to entry for BayesFlow or if it adds confusion. See
llm_context/README.md
for further infos.Key Additions
llm_context/
folder addedbuild_llm_context.py
), requirements, and generated context files.llm_context_full-<TAG>.md
→ full project snapshot: README + examples + source code (bayesflow/
) (~250k tokens).llm_context_compact-<TAG>.md
→ compact snapshot: README + examples (~45k tokens).examples/*.ipynb
) are automatically converted to Markdown before context file generation.bayesflow-context-*
files inllm_context/
are removed before generating new ones.<TAG>
placeholder, and uploads them to the corresponding GitHub release.Open Questions
Downloads for Pre-Generated Context Files
llm_context_full_dev.md
llm_context_compact_dev.md
(Tagging some people I remember discussing this with @niels-leif-bracher @han-ol @stefanradev93 @vpratz @marvinschmitt @paul-buerkner)