Optimization Using Pathwise Algorithmic Derivatives of Electromagnetic Shower Simulations (2405.07944v1)
Abstract: Among the well-known methods to approximate derivatives of expectancies computed by Monte-Carlo simulations, averages of pathwise derivatives are often the easiest one to apply. Computing them via algorithmic differentiation typically does not require major manual analysis and rewriting of the code, even for very complex programs like simulations of particle-detector interactions in high-energy physics. However, the pathwise derivative estimator can be biased if there are discontinuities in the program, which may diminish its value for applications. This work integrates algorithmic differentiation into the electromagnetic shower simulation code HepEmShow based on G4HepEm, allowing us to study how well pathwise derivatives approximate derivatives of energy depositions in a sampling calorimeter with respect to parameters of the beam and geometry. We found that when multiple scattering is disabled in the simulation, means of pathwise derivatives converge quickly to their expected values, and these are close to the actual derivatives of the energy deposition. Additionally, we demonstrate the applicability of this novel gradient estimator for stochastic gradient-based optimization in a model example.
- Exploration of differentiability in a proton computed tomography simulation framework. Physics in Medicine & Biology 68, 24 (dec 2023), 244002. https://doi.org/10.1088/1361-6560/ad0bdd
- Progress in End-to-End Optimization of Detectors for Fundamental Physics with Differentiable Programming. arXiv:2310.05673 [physics.ins-det]
- Forward-Mode Automatic Differentiation of Compiled Programs. http://arxiv.org/abs/2209.01895 arXiv:2209.01895 [cs].
- S. Agostinelli et al. 2003. Geant4—a simulation toolkit. Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 506, 3 (7 2003), 250–303. https://doi.org/10.1016/S0168-9002(03)01368-8
- Efficient Aerodynamic Design using the Discrete Adjoint Method in SU2. In 17th AIAA/ISSMO Multidisciplinary Analysis and Optimization Conference. American Institute of Aeronautics and Astronautics, Inc., Washington, D.C. https://doi.org/10.2514/6.2016-3518 arXiv:https://arc.aiaa.org/doi/pdf/10.2514/6.2016-3518
- J. Allison et al. 2006. Geant4 developments and applications. IEEE Transactions on Nuclear Science 53, 1 (Feb. 2006), 270–278. https://doi.org/10.1109/TNS.2006.869826
- J. Allison et al. 2016. Recent developments in Geant4. Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 835 (Nov. 2016), 186–225. https://doi.org/10.1016/j.nima.2016.06.125
- Automatic Differentiation of Programs with Discrete Randomness. In Advances in Neural Information Processing Systems, S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (Eds.), Vol. 35. Curran Associates, Inc., 10435–10447. https://proceedings.neurips.cc/paper_files/paper/2022/file/43d8e5fc816c692f342493331d5e98fc-Paper-Conference.pdf
- Unbiased Warped-Area Sampling for Differentiable Rendering. ACM Trans. Graph. 39, 6 (2020), 245:1–245:18.
- Systematically Differentiating Parametric Discontinuities. ACM Trans. Graph. 40, 107 (2021), 107:1–107:17.
- Etalumis: bringing probabilistic programming to scientific simulators at scale. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis (Denver, Colorado) (SC ’19). Association for Computing Machinery, New York, NY, USA, Article 29, 24 pages. https://doi.org/10.1145/3295500.3356180
- Pablo de Castro and Tommaso Dorigo. 2019. INFERNO: Inference-Aware Neural Optimisation. Computer Physics Communications 244 (2019), 170–179. https://doi.org/10.1016/j.cpc.2019.06.007
- Toward the end-to-end optimization of particle physics instruments with differentiable programming. Reviews in Physics 10 (2023), 100085. https://doi.org/10.1016/j.revip.2023.100085
- Rick Durrett. 2019. Probability: Theory and Examples. (2019). https://services.math.duke.edu/~rtd/PTE/PTE5_011119.pdf Version 5 January 11, 2019.
- Herbert Fischer. 1991. Automatic differentiation of the vector that solves a parametric linear system. J. Comput. Appl. Math. 35, 1 (1991), 169–184. https://doi.org/10.1016/0377-0427(91)90205-X
- Jean Charles Gilbert. 1992. Automatic differentiation and iterative processes. Optimization Methods and Software 1, 1 (1992), 13–21. https://doi.org/10.1080/10556789208805503
- Paul Glasserman. 2003. Estimating Sensitivities. Springer New York, New York, NY, 377–420. https://doi.org/10.1007/978-0-387-21617-1_7
- Peter W. Glynn. 1990. Likelihood ratio gradient estimation for stochastic systems. Commun. ACM 33, 10 (oct 1990), 75–84. https://doi.org/10.1145/84537.84552
- Generative Adversarial Nets. In Advances in Neural Information Processing Systems, Z. Ghahramani, M. Welling, C. Cortes, N. Lawrence, and K.Q. Weinberger (Eds.), Vol. 27. Curran Associates, Inc. https://proceedings.neurips.cc/paper_files/paper/2014/file/5ca3e9b122f61f8f06494c97b1afccf3-Paper.pdf
- Andreas Griewank and Andrea Walther. 2008. Evaluating Derivatives. Society for Industrial and Applied Mathematics, Philadelphia, PA, US. https://doi.org/10.1137/1.9780898717761
- Adjoining Independent Computations. In Automatic Differentiation of Algorithms: From Simulation to Optimization, George Corliss, Christèle Faure, Andreas Griewank, Laurent Hascoët, and Uwe Naumann (Eds.). Springer New York, New York, NY, 299–304. https://doi.org/10.1007/978-1-4613-0075-5_35
- Michael Kagan and Lukas Heinrich. 2023. Branches of a Tree: Taking Derivatives of Programs with Discrete and Branching Randomness in High Energy Physics. arXiv:2308.16680 [stat.ML]
- Diederik P. Kingma and Max Welling. 2014. Auto-Encoding Variational Bayes. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, Yoshua Bengio and Yann LeCun (Eds.). http://arxiv.org/abs/1312.6114
- ADEV: Sound Automatic Differentiation of Expected Values of Probabilistic Programs. Proceedings of the ACM on Programming Languages 7, POPL (Jan. 2023), 121–153. https://doi.org/10.1145/3571198
- Differentiable Monte Carlo Ray Tracing through Edge Sampling. ACM Trans. Graph. (Proc. SIGGRAPH Asia) 37, 6 (2018), 222:1–222:11.
- Niels Lohmann. 2024. JSON for Modern C++. https://github.com/nlohmann/json
- Distributions for Compositionally Differentiating Parametric Discontinuities. Proc. ACM Program. Lang. 8, OOPSLA1, Article 126 (apr 2024), 30 pages. https://doi.org/10.1145/3649843
- Monte Carlo Gradient Estimation in Machine Learning. Journal of Machine Learning Research 21, 132 (2020), 1–62. http://jmlr.org/papers/v21/19-346.html
- Mihály Novák. 2023a. HepEmShow: a compact EM shower simulation application. https://hepemshow.readthedocs.io/en/latest/
- Mihály Novák. 2023b. The HepEmShow R&D Project. https://github.com/mnovak42/hepemshow
- G4HepEm. https://github.com/mnovak42/g4hepem
- Stochastic Backpropagation and Approximate Inference in Deep Generative Models. In Proceedings of the 31st International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 32), Eric P. Xing and Tony Jebara (Eds.). PMLR, Bejing, China, 1278–1286.
- High-Performance Derivative Computations Using CoDiPack. ACM Trans. Math. Softw. 45, 4, Article 38 (dec 2019), 26 pages. https://doi.org/10.1145/3356900
- Gradient estimation using stochastic computation graphs. In Proceedings of the 28th International Conference on Neural Information Processing Systems - Volume 2 (Montreal, Canada) (NIPS’15). MIT Press, Cambridge, MA, USA, 3528–3536.
- D. F. Shanno. 1970. Conditioning of quasi-Newton methods for function minimization. Math. Comp. 24, 111 (1970), 647–656. https://doi.org/10.1090/S0025-5718-1970-0274029-X
- Nathan Simpson and Lukas Heinrich. 2023. neos: End-to-End-Optimised Summary Statistics for High Energy Physics. Journal of Physics: Conference Series 2438, 1 (feb 2023), 012105. https://doi.org/10.1088/1742-6596/2438/1/012105
- Policy gradient methods for reinforcement learning with function approximation. In Proceedings of the 12th International Conference on Neural Information Processing Systems (Denver, CO) (NIPS’99). MIT Press, Cambridge, MA, USA, 1057–1063.
- Charlie Tang and Russ R Salakhutdinov. 2013. Learning Stochastic Feedforward Neural Networks. In Advances in Neural Information Processing Systems, C.J. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K.Q. Weinberger (Eds.), Vol. 26. Curran Associates, Inc. https://proceedings.neurips.cc/paper_files/paper/2013/file/d81f9c1be2e08964bf9f24b15f0e4900-Paper.pdf
- Laszlo Urban. 2006. A model for multiple scattering in Geant4. (12 2006).
- Clad – Automatic Differentiation Using Clang and LLVM. Journal of Physics: Conference Series 608, 1, 012055. https://doi.org/10.1088/1742-6596/608/1/012055
- Automatic differentiation of dominant eigensolver and its applications in quantum physics. Phys. Rev. B 101 (Jun 2020), 245139. Issue 24. https://doi.org/10.1103/PhysRevB.101.245139
- Monte Carlo Estimators for Differential Light Transport. Transactions on Graphics (Proceedings of SIGGRAPH) 40, 4 (2021). https://doi.org/10.1145/3450626.3459807
Sponsor
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Collections
Sign up for free to add this paper to one or more collections.