hep-data-llm
Table of Contents
Introduction
This repo contains the code used to translate english queries for plots into the actual plots using LLM's and python packages and tools like ServiceX, Awkward, Vector, and hist. This is a proof-of-concept and not meant to be production level code.
Benchmark studies with the 8 adl-index as presented in conferences can be found in the results directory for various workflows.
Use --help at the root level and on commands (e.g. hep-data-llm plot --help) to get a complete list of options.
Installation
To run out of the box you'll need to do the following once:
Prerequisites:
- You'll need to have
dockerinstalled on your machine, and if you are on ARM, the multi-arch extensions (the source images are amd64 only):docker buildx create --name multiarch --driver docker-container --usedocker run --privileged --rm tonistiigi/binfmt --install amd64
- Build the
dockerimage to run the workflow. Which docker image is used depends on what workflow you are using.- ServiceX/Awkward:
docker build -t hepdatallm-awkward:latest Docker - ServiceX/RDF:
docker build -t hepdatallm-rdf:latest -f Docker/Dockerfile.RDF .that is used to runservicex,awkward, and friends:
- ServiceX/Awkward:
- If you are running a
servicexworkflow, get an access token. Make sure theservicex.yamlfile is either in your home directory or your current working directory. - You'll need token(s) to access the LLM. Here is what the
.envlooks like. Please create this either in your local directory or your home directory. Make sure only you can read it: this is access to a paid service!
api_openai_com_API_KEY=<openai-key>
api_together_xyz_API_KEY=<together.ai key>
openrouter_ai_API_KEY=<openrouter-key>
Running in a local python environment
pip install hep-data-llm
hep-data-llm plot "Plot the ETmiss of all events in the rucio dataset mc23_13p6TeV:mc23_13p6TeV.801167.Py8EG_A14NNPDF23LO_jj_JZ2.deriv.DAOD_PHYSLITE.e8514_e8528_a911_s4114_r15224_r15225_p6697." output.md
The output will be in output.md - view in a markdown rendering problem (I use vscode). A img directory will be created and it will contain the plot (hopefully).
Use hep-data-llm plot --help to see all the options you can give it. It defaults to using gpt-5, the most successful model in tests.
Default questions
A questions.yaml file is bundled with the package containing a list of common plotting questions. To run one of these questions by number, pass the index (starting from 1) instead of the full text:
hep-data-llm plot 1 output.md
This will execute the first question from questions.yaml.
Question references and metrics
Some questions include reference metrics for each expected plot to help validate the generated output. References live alongside the question text in questions.yaml and consist of per-plot average entries per event and mean values derived from the raw data list used to fill the histogram. For example:
questions:
- text: "Plot the ETmiss of all events in the rucio dataset user.zmarshal:user.zmarshal.364702_OpenData_v1_p6026_2024-04-23."
references:
plots:
- avg_entries_per_event: 1.0
mean: 38.5
When a question includes references, the generated plotting code is expected to print lines like METRIC: avg_entries_per_event=<N> mean=<M> for each plot, computed directly from the numbers passed into the histogram. The CLI will compare these against the reference pairs to determine success.
Running with uvx
This is great if you want to just run once or twice.
uvx hep-data-llm plot "Plot the ETmiss of all events in the rucio dataset mc23_13p6TeV:mc23_13p6TeV.801167.Py8EG_A14NNPDF23LO_jj_JZ2.deriv.DAOD_PHYSLITE.e8514_e8528_a911_s4114_r15224_r15225_p6697." output.md
This uses the uvx tool to install a temporary environment. If you want to keep this around to use, you can use uv tool install hep-data-llm. Do remember to update it every now and then!
Usage
new profile
Use the new profile <filename> to create a new profile. It copies the default profile, and you can then modify it and update it with new prompt or other items.
Creating a new workflow
Otherwise known as creating a new prompt, this is about creating a new prompt file and hint files and what it takes in the context of this package.
- General preparation - you'll need a docker container with the appropriate software installed. You'll also need a good set of test instructions.
- Use the
hep-data-llm new profile my-prompt.yamlcommand to create a "dummy" prompt file. - Edit the new profile
yamlfile:- If you are editing new hint files, then replace the list of hint files with a local (relative) reference to the hint files you want to use
- Choose a fairly cheap model to run (since you'll probably be running it a lot). Change the
model:entry (or you can use the--modeloption).
- When you are ready to test, use
hep-data-llm plot --profile my-prompt --ignore-cache hints <question> output.md. Replace<question>with your question or a question number from the default list of questions.- Note the
ignore-cache- the code always caches the hints files, even if they are located on the local disk. - Use
--repeat Nto record multiple, independent runs for each model. Every trial bypasses the LLM cache automatically so you get fresh outputs for each repetition without reusing earlier responses.
- Note the
Notes from adding a servicex-RDF workflow:
- The guardrail that looked for the
pngfile to be written out had to be altered - Hint files that described
servicexassumedawkwardoutput - it had to be split in two so that there was a short hint file that described how to generate aservicexrequest and a second one that described how to take the results and turn them into aawkwarddata. The same thing then had to occur forrdf. - A new
dockercontainer had to be built, in this case based on the ROOT container image.
License
hep-data-llm is distributed under the terms of the MIT license.
Metadata
Release files for hep-data-llm 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hep_data_llm-2.0.0.tar.gz | 37.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hep_data_llm-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.2 MB
Release files / hep_data_llm-2.0.0.tar.gz
| Download URL | hep_data_llm-2.0.0.tar.gz |
|---|---|
| Size | 37.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef2957618678dd7c0384aa183692b23a672841ac8383170bf0be0acf9bf128e0
|
|
BLAKE2b-256 checksum How to use checksums |
dad7423396472dd968f49abf548e321a1dc2a72c988a60f3fbd5e1b0a6b1104a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logRelease files / hep_data_llm-2.0.0-py3-none-any.whl
| Download URL | hep_data_llm-2.0.0-py3-none-any.whl |
|---|---|
| Size | 45.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36d65cd7de2af08dc88f07417fcd57acdf9fc3f9b5c01c1801efae0f0162a2c9
|
|
BLAKE2b-256 checksum How to use checksums |
934200b3799546f2626b7597bf1f46de98c569edb119634e3ab7c060fe3e2262
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency log