{"paper_id":"2412.05300","title":"AD-HOC: A C++ Expression Template package for high-order derivatives backpropagation","authors":["Juan Lucas Rey"],"paper_date":"2024-11-25","paper_type":"software-tool","paper_url":"https://arxiv.org/pdf/2412.05300v2","page_url":"https://thequant.space/flowcharts/ad-hoc-a-c++-expression-template-package-for-high-order-der/","scores":{"empirical_rigor":3,"math_complexity":8.5,"quadrant":"Lab Rats"},"proposes":{"status":"available","statement":"The paper introduces AD-HOC, a header‑only C++ library for high‑order automatic differentiation that computes user‑specified derivatives of arbitrary order in a single backpropagation pass without source code generation.","quote":"This document presents a new C++ Automatic Differentiation (AD) tool, AD-HOC (Automatic Differentiation for High-Order Calculations).","summary":"This document presents a new C++ Automatic Differentiation (AD) tool, AD-HOC (Automatic Differentiation for High-Order Calculations). This tool aims to have the following features: -Calculation of user specified derivatives of arbitrary order -To be able to run with similar speeds as handwritten…","strategy":null},"assumptions":{"status":"available","items":[{"assumption":"The calculation is represented as a directed acyclic graph (DAG) of elementary functions.","type":"model","stated":"implied","quote":"Let’s assume we have a calculation tree described as a DAG (Directed Acyclic Graph) where elementary univariate (exp, cos,...), bivariate (×, +, incomplete elliptic integral of the ﬁrst kind,...) or even in some cases trivariate functions (incomplete elliptic integral of the third kind5) are used in a particular order.","support":"full"},{"assumption":"Only the necessary derivatives are expanded, truncating higher‑order terms when not needed.","type":"execution","stated":"implied","quote":"Given that we only need the second-order derivatives of the ﬁnal result, we only need to expand the exp univariate function up to order 2. This example shows a second-order backpropagation, but could have been performed with a higher order, by keeping larger expansions at every stage instead of truncating at order 2.","support":"full"}]},"datasets":{"status":"none_found","items":[],"known":[],"sample":{"start":null,"end":null,"market":null,"asset_class":null,"frequency":null},"data_resolution":"none"},"transaction_costs":{"status":"not_applicable","modeled":"n/a","headline_net_of_costs":null,"detail":null,"quote":null,"source":"front_matter","rule":"R3","candidates":{"front_matter":"n/a","evidence_card":"n/a","evidence_card_quoted":false},"meaning":"the paper reports no trading or execution result"},"results":{"status":"available","evaluation_type":"unclear","findings":[{"finding":"AD-HOC achieves runtimes comparable to source‑code‑generation tools or handwritten code while avoiding source generation.","kind":"performance","quote":"This paper introduces a new AD tool, AD-HOC (Automatic Diﬀerentiation for High-Order Calculations), which oﬀers comparable run times to source code generation tools or handwritten code, while avoiding the need for source code generation.","support":"full"},{"finding":"Benchmarking on a Black‑Scholes pricing task shows that AD-HOC can compute the price and multiple higher‑order Greeks with competitive speed on an Apple M3 Pro using GCC -O3.","kind":"performance","quote":"We will therefore benchmark the runtime of a simple Black-Scholes price against the calculation of the same price and these 3 additional cherry-picked derivatives. The code for calculating Black-Scholes can be taken as deﬁned in the previous section and instantiated with a double type as follows (this is referred as the BASE version of the code): double S = 100., K = 102., V = 0.15, T = 0.5, R = 0.01; double Price =","support":"full"},{"finding":"The tool enables calculation of second‑order and higher‑order derivatives needed for portfolio risk and high‑frequency trading applications.","kind":"theoretical","quote":"With AD-HOC, a powerful enough tool to create high-order derivatives backpropagation trees, we can calculate second-order derivatives, very much needed in ﬁnance, or even higher-order derivatives.","support":"full"}],"reported_performance":null,"out_of_sample":{"method":"none","headline_out_of_sample":null}},"independent_evidence":{"status":"none_found","supports":[],"contradicts":[],"qualifies":[],"compared_with":12,"citations":{"cited_by_in_corpus":0,"by_independent_authors":0,"how_cited":{"used_as_baseline":0,"uses_method_or_data":0,"extends":0,"discusses_findings":0,"mentions":0,"unclassified":0},"independent_papers":[],"scope":"Citations between papers in this corpus only; citations from outside it are not counted."}},"implementation":{"status":"available","public":true,"code_url":"https://github.com/juanlucasrey/AD-HOC","note":null},"replication":{"status":"none_found","card":null,"note":"No replication of this paper has been run by thequant.space yet."},"extraction":{"text_source":"fulltext","model":"openai/gpt-oss-120b","version":2,"extracted_at":"2026-11-14T19:53:42Z"},"provenance":{"claims":"Everything here is what the authors state in the paper. Nothing was re-run or reproduced by the platform.","quotes":"Assumptions, datasets, cost detail and findings were extracted by a language model. Every quote is verbatim paper text. Where an item has `support`, \"full\" means every figure in it appears in the quoted sentences and \"partial\" means a figure is stated elsewhere in the paper; items with a figure found nowhere in the paper were discarded.","datasets_known":"datasets.known lists well-known vendors and public datasets by a stable id, found by a dictionary over the full text where the sentence says the data is used; it is independent of the model and covers only names in the dictionary.","flags":"transaction_costs.modeled, results.evaluation_type and results.out_of_sample.method are platform classifications (structured-decision models); see https://thequant.space/score-guide/#penalty-flags","comparisons":"supports / contradicts / qualifies are a language model's reading of two papers' quoted findings, restricted to closely related papers that share no author. They are pointers to read, not verified replications, and coverage is partial.","implementation":"code_url is a repository the paper itself presents as its own (rule-scored, ambiguous cases judged by a model), checked for liveness when it was recorded."},"docs":"https://thequant.space/agents/"}