An Automated, End-to-End Deep Learning Toolbox for Collider Physics Analysis
Project description
CoLLM
An Automated, End-to-End Deep Learning Toolbox for Collider Physics Analysis
CoLLM (Collider LLM) is an intelligent code generation tool that automates the creation of executable Python analysis scripts for LHCO (Les Houches Collider Olympics) files produced by fast detector simulations like Delphes. Simply describe your physics analysis in natural language, and CoLLM generates validated, runnable code.
✨ Key Features
- 🤖 LLM-Powered Code Generation — Leverages state-of-the-art code models (Qwen, DeepSeek) to generate physics analysis code
- 🔄 Automatic Error Correction — Self-healing code with automatic bug detection and fixing
- 🖥️ Dual Interface — Choose between Terminal UI (TUI) or Streamlit-based Graphical UI (GUI)
- ⚡ GPU Acceleration — Full support for CUDA (NVIDIA) and MPS (Apple Silicon)
- 📊 Built-in Validation — Syntax checking and pattern validation before execution
- 🔌 API Support — Use local models or HuggingFace Inference API
📦 Installation
pip install collm-hep
This installs everything you need, including the GUI.
🚀 Quick Start
Python API
from collm import generate_lhco_code
# Using local model
code = generate_lhco_code(
user_input_path="user_input.txt",
output_path="generated_analysis.py",
model_id="Qwen/Qwen2.5-Coder-14B-Instruct"
)
# Using HuggingFace API
code = generate_lhco_code(
user_input_path="user_input.txt",
output_path="generated_analysis.py",
model_id="Qwen/Qwen2.5-Coder-14B-Instruct",
use_api=True,
api_key="your_hf_api_key"
)
Command Line
# Generate code from input file
collm --input user_input.txt --output analysis.py
# Use HuggingFace API
collm --input user_input.txt --output analysis.py --api --api-key YOUR_KEY
# Run with configuration file
collm --config config.yml
# Launch GUI
collm --gui
User Input Format
Create a user input file with three sections:
[SELECTION_CUTS]
- Select electrons with pT > 10 GeV and |eta| < 2.5
- Select muons with pT > 10 GeV and |eta| < 2.4
- Require at least two leptons
- Require at least two jets
[PLOTS_FOR_VALIDATION]
- Plot the missing energy distribution
- Plot the invariant mass of leading and subleading leptons
- Normalize all histograms to one
[OUTPUT_STRUCTURE]
- Save the produced histograms into png with dpi=150
- Print summary statistics
- Print the number of events before and after selection cuts
⚙️ Configuration
Create a YAML configuration file for batch processing:
Output_dir: "./output/"
DEFAULT_MODEL: "Qwen/Qwen2.5-Coder-14B-Instruct"
MAX_RETRIES: 3
Input_file: "./data/signal.lhco"
User_input: "./templates/user_input.txt"
Use_api: False
Api_key: "your_huggingface_api_key"
🤖 Supported Models
| Model | Size | VRAM | Quality |
|---|---|---|---|
Qwen/Qwen2.5-Coder-32B-Instruct |
32B | ~48GB | ⭐⭐⭐⭐⭐ |
deepseek-ai/DeepSeek-Coder-V2-Instruct |
236B | ~40GB | ⭐⭐⭐⭐⭐ |
Qwen/Qwen2.5-Coder-14B-Instruct |
14B | ~20GB | ⭐⭐⭐⭐ |
deepseek-ai/deepseek-coder-6.7b-instruct |
6.7B | ~10GB | ⭐⭐⭐⭐ |
Qwen/Qwen2.5-Coder-7B-Instruct |
7B | ~10GB | ⭐⭐⭐ |
📚 LHCO File Format Reference
| Column | Field | Description |
|---|---|---|
| 1 | index |
Object index (0 = event header) |
| 2 | type |
Particle type code |
| 3 | eta |
Pseudorapidity |
| 4 | phi |
Azimuthal angle (radians) |
| 5 | pt |
Transverse momentum (GeV) |
| 6 | jmass |
Jet mass (GeV) |
| 7 | ntrk |
Track count (sign = charge) |
| 8 | btag |
B-tag flag (1.0 = b-tagged) |
| 9 | had/em |
Hadronic/EM energy ratio |
Particle Type Codes:
0= Photon1= Electron2= Muon3= Tau4= Jet6= MET
🔧 API Reference
Main Functions
from collm import generate_lhco_code, fix_code
# Generate LHCO analysis code
code = generate_lhco_code(
output_path: str,
model_id: str = "Qwen/Qwen2.5-Coder-14B-Instruct",
user_input_path: Optional[str] = None,
user_input_text: Optional[str] = None,
system_prompt_path: Optional[str] = None,
use_api: bool = False,
api_key: Optional[str] = None
) -> Optional[str]
# Fix buggy code
fixed_code = fix_code(
code: str,
error: str,
model_id: str = "Qwen/Qwen2.5-Coder-14B-Instruct",
use_api: bool = False,
api_key: Optional[str] = None
) -> str
Configuration Class
from collm.utils.config import CoLLMConfig
# Load from YAML
config = CoLLMConfig.from_yaml("config.yml")
# Access configuration
print(config.model_id)
print(config.output_dir)
# Save to YAML
config.to_yaml("new_config.yml")
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📖 Citation
If you use CoLLM in your research, please cite:
@software{collm2025,
title = {CoLLM: An Automated Deep Learning Toolbox for Collider Physics Analysis},
year = {2025},
url = {https://github.com/yourusername/CoLLM}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file collm_hep-0.1.0.tar.gz.
File metadata
- Download URL: collm_hep-0.1.0.tar.gz
- Upload date:
- Size: 50.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d25c7472f8bf2f975bd638fb4230c9580cbdc534817471fb2ab58ff07ab7becd
|
|
| MD5 |
7d8fbc1fc995d273f6659e2b1a476780
|
|
| BLAKE2b-256 |
60daebb4e7c3575c8e0fd3b8ad080b0f0eb4aadec83d542894d1391585788be7
|
File details
Details for the file collm_hep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: collm_hep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 56.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
222d8eff197671d5e780039a55f82a7c698f1152753044d03d5493c360a8965a
|
|
| MD5 |
278a77a19727c571b5e64aae5258f174
|
|
| BLAKE2b-256 |
5fa51ef4432466b21dcc9b8f99e45895666558a46254b3dfcb52baf0c806f49a
|