Improve TrinomialTree performance with entropy-based pruning under small time steps #2255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Entropy-Based Pruning in Trinomial Tree Lattices for Efficient Hull-White Pricing
Author: Prem Dev
Date: July 2, 2025
Abstract
In affiliation to issue #364
This document proposes an enhancement to QuantLib's
TrinomialTree
class to improve computational efficiency when the time discretization step is very small—a common scenario in pricing interest rate derivatives like Bermudan swaptions under the Hull-White model. The patch introduces entropy-based pruning to suppress unnecessary branching in nearly deterministic transitions. Benchmarks show an 8.6% increase in throughput without any test regressions.1. Context and Motivation
The Hull-White one-factor model assumes the short rate$r_t$ evolves as an Ornstein-Uhlenbeck process:
Where:
For small$\Delta t$ :
As$\Delta t \to 0$ , variance collapses. However, QuantLib’s tree expands nodes based on high branching even when the process becomes deterministic.
2. Observed Issue in QuantLib
The state spacing in
TrinomialTree
is:Node index is:
Problems when$\Delta t$ is small:
temp
becomes large3. Proposed Fix: Entropy-Based Pruning
We compute Shannon entropy:
Pruning Criteria
Interpretation
4. Empirical Results
5. Validation Logs
tests_before.txt
tests_after.txt
valgrind_before.txt
valgrind_after.txt
6. Conclusion
This patch addresses over-branching in
TrinomialTree
construction under small time steps—critical in Hull-White-based lattice models. The entropy-based pruning is: