Modelling global trade with optimal transport

Domain: physics
Published: 2026-02-19
Editorial outcome: major_revision

Abstract
Global trade is shaped by a complex mix of factors beyond supply and demand, including tangible variables like transport costs and tariffs, as well as less quantifiable influences such as political and economic relations. Traditionally, economists model trade using gravity models, which rely on explicit covariates that might struggle to capture these subtler drivers of trade. In this work, we employ optimal transport and a deep neural network to learn a time-dependent cost function from data, without imposing a specific functional form. This approach consistently outperforms traditional gravity models in accuracy and has similar performance to three-way gravity models, while providing natural uncertainty quantification. Applying our framework to global food and agricultural trade, we show that low income countries experienced disproportionately higher increases in trade costs due to the war in Ukraine’s impact on wheat markets. We also analyse the effects of free-trade agreements and trade disputes with China, as well as Brexit’s impact on British trade with Europe, uncovering hidden patterns that trade volumes alone cannot reveal.

Introduction
International trade serves as the backbone of the world economy, distributing goods and connecting markets through global logistics networks. Its dynamics are driven by numerous factors beyond mere supply and demand, such as tariffs, non-tariff policy barriers, political and economic tensions, and disruptions caused by accidents, conflicts, and civil wars. Among all traded commodities, agricultural and food products hold particular interest for policymakers and the general public due to their considerable volume, high trade value, and critical role in food security and resilience1,2. Consumer food prices are a product of all the complexly interwoven factors governing trade. However, they do not always directly reflect the ease of doing business between any two countries. For instance, in May 2020, China imposed an 80% tariff on Australian barley, leading to a major restructuring of global supply chains: Chinese demand was suddenly met from France, Canada, and Argentina, while Australia started exporting surplus barley e.g. to Saudi Arabia. Despite these shifts, for the next five months the global barley price barely budged3,4.

Modelling global trade has garnered much attention in the economics literature, with gravity models being the most widely used approach5–9. These models, named for their direct analogy to Newton’s law of gravity, assume that the total trade Tij of a given commodity between two countries i and j is proportional to the total output Oi of the source country and the total expenditure Ej of the destination country, as well as being inversely related to a ‘distance’ between them:

Tij(t) \propto Oi(t)Ej(t) / Cij(t) : (1)

This distance Cij comprises all factors that contribute to the ease of selling goods produced in one country to another, including transportation costs, information costs, and tariff and non-tariff barriers to trade. Traditional gravity models use a set of covariates to estimate Cij as

logCij(t) = \alpha \pi i(t) + \beta \chi j(t) + \gamma m \rho ij,m(t), (2)

where \pi i and \chi j are exogenous exporter and importer-side regressors10, which can be specified as fixed effects, \rho ij,m are bilateral covariates, and \alpha, \beta, \gamma are the coefficient vectors. Commonly used covariates include geographic proximity, the existence of trade agreements, colonial ties, tariffs, non-tariff barriers, or shared languages11. The structural gravity model corrects Eq. (1) with import and export multilateral resistance terms, which account for the relative nature of bilateral trade shares. This adjustment has been shown to align with various microeconomic models7. Gravity models have been widely used to study agrifood trade. For instance, ref. 12 estimates residual trade costs based on a micro-founded gravity equation, finding ad-valorem costs to be 60% higher in the Global South compared to the North. Studies have also investigated the impact of global and regional trade agreements13,14 and the effect of eliminating tariffs15,16.

The gravity-based approach is attractive to researchers due to its interpretability, mathematical simplicity, and consistency with various microeconomic theories9. However, it is not without its limitations. For one, multilateral trade resistance terms, central to the structural gravity model, are unobservable and must be estimated, often using fixed effects11. Elasticity and other key parameters are often unavailable at a granular level, requiring aggregation that can introduce bias17. The model’s cost function also depends heavily on the choice of covariates and functional form, making specification crucial for interpreting results. In addition, unobservables—such as the subtle effects of changing political relations, public preferences, or aversions toward products from specific countries—are absorbed in the error term. Finally, while trade costs are generally asymmetric (Cij \neq Cji), commonly used covariates are not, making it difficult for a model to capture the inherent imbalances in trade relationships. See 9, 11, 18 for a deeper discussion of challenges and best practices.

In this work, we present a more general approach that dispenses with the use of covariates and a functional form, instead inferring the cost directly from data. Our method is based on the optimal transport (OT) framework19, which generalises gravity-based models. In OT, trade flows are assumed to match supply and demand to minimise the overall cost. Mathematically, this is expressed as follows: let C \in Rm\times n be a matrix quantifying the ‘cost’ (in a general sense) of moving goods from country i to j. Given the supply vector \mu \in Rm and the demand vector \nu \in Rn, the OT problem consists in finding a transport plan, i.e. a matrix T \in Rm\times n, with entries Tij modelling the total volume (or value) of transport from country i to j, such that the total cost

c(T) = \sum i,j Tij Cij (3)

is minimised. In addition, the marginal constraints

\sum j Tij = \mu i, \sum i Tij = \nu j (4)

must be satisfied, ensuring that demand and supply are met. It is advantageous to add a regularisation term to the cost, as it ensures existence of a unique solution and improves computational efficiency; the total cost then becomes

c\epsilon(T) = c(T) + \epsilon H(T), (5)

where H(T) = \sum ij Tij (logTij - 1) denotes the negative entropy of T and \epsilon > 0 is a regularisation parameter. It can be shown that the solution will then be of the form

T = \pi e^{-C/\epsilon} \Omega, (6)

where \Pi and \Omega are diagonal scaling matrices which ensure that the marginal constraints hold (see ‘Methods’). As described in ref. 20, gravity models can be reformulated as solutions of a regularised OT problem with an appropriate choice of parameters. While OT-based models might appear to suggest a centralised control of flows, its dual formulation admits an alternative, decentralised interpretation of importers seeking to minimise the cost of purchasing commodities and exporters seeking to maximise their profit (see ‘Methods’). The solution at equilibrium coincides with the solution of the OT problem21, which in its classic form (3)–(4) is well understood. This is less true for the corresponding inverse problem we are interested in, despite its mathematical and practical importance: given a (possibly noisy) observation of T, \mu, and \nu, this problem consists in inferring the underlying cost C. Maximum likelihood estimation of costs relates to the inverse OT problem; however, the specific parametrization of the cost matrix in gravity models demands careful estimator design. Moreover, zeros and heteroscedasticity in observed trade flows cause misspecification in gravity model estimation, affecting estimator performance (see ref. 22).

The inference methodology presented in this work is a deep learning approach to solve the inverse OT problem, based on recent work on neural parameter calibration23,24. We assume no underlying covariate structure of trade costs, but instead infer a general cost matrix C, parametrised as a deep neural network, directly from data on trade flows. We train a neural network u to recognise cost matrices from observations of transport plans for the global food and agricultural trade from 2000 to 2022 (the ‘training data’) by constraining it to satisfy Eq. (6). Put simply, this means fitting the mathematical OT equation to the data in such a way that the predicted cost matrices C(t) reproduce the observations T(t). The trained neural network then solves the inverse problem

C(t) = u(T(t)) (7)

on the observations. Though its ability to generalise to new observations depends on the amount of training data, its performance on the training data itself does not. A probability density \rho C on the estimates is then naturally obtained as the push forward measure

\rho C = u \# \rho T, (8)

where \rho T is the measure on T. Additionally, we train a family of neural networks to capture the spread in cost matrices that optimally reproduce the transport plan (see ‘Methods’). As we demonstrate, this approach produces trade flow estimates that are an order of magnitude more accurate than those of a traditional covariate-based gravity model.

The dataset under consideration was assembled by the Food and Agricultural Organisation of the United Nations (FAO), which provides global trade matrices for over 500 products on its portal25. Though extensive, many entries in the trade matrices are missing. Furthermore, the FAO reports two values for each bilateral flow Tij: one reported by the exporter, and one by the importer. There is often a considerable discrepancy between the two, due to a multitude of epistemic factors the FAO lists in its accompanying report26. The uncertainty on our estimates naturally follows the uncertainty on the FAO data, without presupposing an underlying statistical model.

We apply our method to analyse global commodity flows from 2000 to 2022, examining the impacts of events, conflicts, trade agreements, and political changes on trade. The cost matrix uncovers economic effects that are not evident in trade volumes or retail prices alone. The article begins with a study of the war in Ukraine’s impact on global wheat trade, followed by an analysis of free trade agreements and disputes in the Asia-Pacific, as well as the United Kingdom’s exit from the European Union (Brexit). We demonstrate our method’s ability to provide meaningful uncertainty quantification and compare it to a traditional gravity model, demonstrating superior prediction accuracy.

Results
Case study I: The impact of the war in Ukraine on wheat trade
The Russian Federation’s invasion of Ukraine in early 2022 sent shock waves through global food markets27. Russia and Ukraine are two of the largest exporters of wheat, together accounting for almost 28% of global wheat exports in 2020. The blockade of trading routes through the Black Sea and the closure or destruction of ports in Mykolaiv and Kherson meant a drop in trade to the overwhelming majority of Ukraine’s export destinations, in some cases by as much as 100% (Fig. 1A, B). An increase of wheat exports only occurred to Europe, most notably to Poland, Spain, Slovakia, Romania, as well as to Algeria and Türkiye. However, our analysis indicates that, although trade shrank across the globe, the accompanying increase in wheat trade costs disproportionately affected low and lower-middle-income countries, in particular African nations. Of the ten countries with the largest rise in wheat import costs, five are in Africa, and all are of low or lower-middle income, while of the ten countries with the largest decrease in trade barriers with Ukraine, nine are in Europe (see Figs. S5, S7, and S8 in the SI). Countries such as Nigeria or Angola, while experiencing a similar drop in trade as Norway or France, simultaneously saw an increase in their trade costs. Canadian imports fell by 91%, yet unit trade costs remained nearly constant, while similar drops in Zambia or the DRCongo led to marked increases in unit trade costs, pointing to trading barriers. European countries saw an average 9% drop in unit wheat trade costs with Ukraine, while Sub-Saharan Africa saw an average 22% increase (see Fig. S7 in the SI). Imports of wheat from Russia also fell globally (see Fig. S6 in the SI), again affecting Africa particularly severely. European imports of Russian wheat fell by around 74% with an 18% increase in trade costs; African imports fell by an average 80% with a 36% increase in trade costs. While many European countries saw their imports of Ukrainian wheat rise, Russian imports fell sharply. The two largest hubs for Russian wheat, Egypt and Türkiye, saw no change in their import volumes and small declines in their import barriers. Meanwhile, Iran saw a 0.51 point increase in wheat unit trade costs, leading to a 97% percent decline in Ukrainian wheat imports. For Russian wheat, the estimated increase in trade costs was only 0.04, leading to a drop in imports of 53%. Russian-Iranian trade barriers were thus not markedly affected by the war, despite a drop in trade volumes.

Case study II: Trade in Southeast Asia and Asia-Pacific
A series of free-trade agreements came into effect in Southeast Asia and the Asia-Pacific region in the 2000s and 2010s, significantly among them the China-Australia Free Trade Agreement (ChAFTA) in 2015, the ASEAN-China free trade agreement (ACFTA, gradually entering into force from 2003) and the Comprehensive and Progressive Agreement for Trans-Pacific Partnership (CPTPP) between 11 counties bordering the Pacific Ocean (2018)28–30. Together with China’s accession to the WTO in 2001 and its rapid economic growth, these trade agreements coincide with some of the largest increases in trade flows in recent history. In Fig. 2A, we show the trade flow of sugar and sugar products from Thailand, Malaysia, and India to China, as well as the estimated costs. In our model, the cost of importing sugar from Thailand fell consistently from 2000 to 2022, following a general trend for ASEAN countries (bottom row, green line) which commenced around 2005. Indian exports, by comparison, remained relatively low until 2015, when Indian Prime Minister Narendra Modi visited China, and top officials from both sides agreed to increase bilateral trade to US$100 billion by the end of the year. This visit marked a dramatic shift in Indo-Chinese trade, as exemplified by the huge increase in sugar trade. From 2015 to 2022, sugar export cost from India dropped sharply by 33%, precipitating a steep increase in trade. By contrast, trade cost from non-ASEAN members has remained constant over the past twenty years (red line, Fig. 2A).

The PRC is one of Australia’s largest export markets for food and agricultural products. Our analysis suggests a precipitous reduction in trade barriers for Australian exports since China’s accession to the WTO in 2001 (see Fig. 2B), particularly for beef, wheat, wine, and dairy. Between 2002 and 2010, these commodities saw a 30–50% drop in their respective trade costs. Our estimates indicate that ChAFTA had little effect on Australian trade costs, since it succeeded a period of deepening ties. Dairy trade costs, for instance, had already fallen from 0.51 to 0.1 from 2000 to 2015, thereafter only falling a further 0.04 points until 2020. Wine exports too saw their largest reductions in trade costs between 2000 and 2010, only experiencing a 0.07 drop from 2015 to 2018 compared to the 0.52 point reduction from 2000 to 2015.

In January 2018, the first Trump administration started imposing import tariffs on goods primarily from China. In response, the Chinese government increased tariffs on a variety of products, including agricultural imports. The largest agricultural export from the US to China, soyabeans, were targeted by a 25% import tariff31. Meanwhile, political tensions between China and Australia caused Beijing to introduce high anti-dumping tariffs on Australian exports such as barley (80.5%) and wine (206%), starting in 202032. Wine trade had previously been tariff-free since the signing of ChAFTA in 2015. Our analysis provides an estimate of the change in the ease of trading these measures induced (Figs. 2B, 3 and 4). Australian beef, wine and barley imports all experienced large increases in cost, following the implosion of trade volumes. Australia was able to divert some of its excess barley supply to Saudi Arabia, which saw a decrease in trade costs of over 0.8 points between 2019 and 2022 (Fig. 3C). Trade volumes to Vietnam also increased from 200,000 to 800,000 metric tons, though trade costs remained approximately constant. Meanwhile, after 2020 China doubled its barley imports from Canada and France. We found that import barriers from both countries were reduced only slightly in 2021 and rebounded the following year.

Case study III: Brexit
In 2016, the United Kingdom voted to leave the European Union, officially exiting the common market and customs union on December 31, 2020. This case study examines the impact of Brexit on British import patterns by comparing vegetable and wine imports from mainland Europe to both the United Kingdom and the Republic of Ireland (ROI), which remains part of the Eurozone and the common market. While both island nations naturally source the majority of their fresh produce from mainland Europe, their trading patterns have evolved in markedly different ways (Fig. 5A). Imports of lettuce from Europe generally fell for the UK, accompanied by a rise in import cost: 25% decrease in trade volume and +0.04 in import costs from the Netherlands, the largest exporter of lettuce and chicory to the UK, as well as a 28% drop in trade from Spain, though with no change in import cost. Ireland increased its imports of lettuce and other greens from the Netherlands, Spain, and Italy, accompanied by a general decrease in trading costs for those products. The ROI’s imports of greenery from Portugal fell by 53%, with no change in trade barriers; for the UK, a 71% fall in trade volumes accompanied a 0.12 point increase in trade cost. In the case of the Netherlands, Ireland saw a consistent reduction in vegetable trade costs, unlike the United Kingdom. It is interesting to note that the United Kingdom sharply increased its imports of vegetables from Morocco, accompanied by a precipitous drop in trade costs, indicating a facilitation of trade between the two countries in the wake of Brexit. This is not true for the ROI: though it increased its imports of Moroccan tomatoes and cucumbers, Irish trade costs remained mostly unchanged.

A clearer-cut trend emerges in the wine trade (Fig. 5B): here, the UK was consistently affected more negatively than the Republic of Ireland: British import costs from all eight countries considered rose by considerably more than those of the ROI. A 9% drop in Spanish wine import by the UK was accompanied by a 7% increase in trading costs, while a 13% drop in Irish imports only meant a 5% increase in costs. Portuguese wine imports to the UK rose by 16%, notwithstanding a 0.05 increase in trade costs. A similar pattern holds for South African, Australian, and New Zealand imports. The EU maintains free trade or regulatory agreements removing wine import duties with the former two33,34. When the UK left the European Union, wine from Australia entered the UK at the Global Tariff rate, which in mid-2023 was eliminated under the Australia-United Kingdom FTA35. South African wines, by contrast, continued to be imported to the UK tariff-free post-Brexit36. Yet here too, the United Kingdom’s 13% decrease in imports was driven by a 0.07 increase in trading costs; Ireland, by contrast, imported 19% less wine, driven by a comparable 0.07 point increase in trading costs.

Comparison with gravity model
Lastly, we compare the performance of our method with a traditional gravity model11,37–39, as specified in Eqs. (1) and (2). The covariates include geographic distance, shared borders, colonial ties, common language, regional trade agreements, tariffs, and importer/exporter fixed effects. We estimate the coefficients using Poisson Pseudo Maximum Likelihood estimation22,40 and compare the accuracy of the estimated transport plans T. Figure 6A, B shows scatter plots of the OT (blue) and the gravity (orange) estimates against the FAO data. For all commodities studied, a linear fit through the OT estimates yields a near-perfect slope of m=1 with a Pearson coefficient close to 1, particularly providing an exact fit for the upper tail of the trade value distribution. In contrast, the gravity model’s performance is much more volatile, with linear fits ranging from a Pearson coefficient of between 0.975 (best) to 0.699 (worst) (see also SI). Due to model misspecification, the fits to the tails of the distributions are generally poorer. Consequently, Fig. 6C suggests that the OT approach clearly outperforms the gravity model in terms of RMSE, often by an order of magnitude. Figure 6D illustrates that OT estimates typically fall within one standard deviation of the data uncertainty, whereas gravity estimates tend to range from one to two, at times even three to four standard deviations. The gravity model also exhibits much higher variance in accuracy compared to OT. We further investigate an alternative specification by replacing time-varying country-level and time-invariant pair regressors with exporter-time, importer-time, and exporter-importer fixed effects in a three-way gravity model41, capturing multilateral resistance terms more effectively (see Eq. (2) and Fig. S9 in the SI for details). As this formulation incorporates higher degrees of freedom in the three-way specification, its performance naturally converges toward that of OT, which more accurately fits high-value trade flows. Incorporating time-varying bilateral trade regressors would likely further narrow this gap, reinforcing the validity of the OT approach. Notably, OT provides trade cost estimates even without such regressors—many of which are difficult to quantify.

Methods
Entropy-regularised optimal transport
In OT, one wishes to find the optimal flow of mass from a source distribution to a target distribution, while minimising an overall transport cost. This abstract problem has a wide range of applications in economics, logistics, image restoration, transport systems, or urban structure21,46,47.

Consider an m-dimensional space X, an n-dimensional space Y, and C a measure on X \times Y. The entries of C correspond to the cost of transporting mass from one location in X to a target in Y. Given two probability measures \mu \in P(X) and \nu \in P(Y) (the supply and demand), the OT problem consists in finding a transport plan T minimising the overall cost Eq. (3). The transport plan T must also satisfy the marginal constraints

\sum j Tij = \mu i and \sum i Tij = \nu j: (9)

In practice one usually considers the entropy-regularised OT formulation, which can be solved much more efficiently48; here, an additional term is added to the objective:

min T \sum ij Tij Cij + \epsilon \sum ij Tij (logTij - 1), (10)

where \epsilon > 0 is a positive regularisation parameter. This regularisation prevents monopolisation, i.e. demand being supplied from only a few sources.

The constrained optimisation problem Eq. (10) can be solved by considering the Lagrangian

L = \sum ij Tij Cij + \lambda, \sum j Tij - \mu + \eta, \sum i Tij - \nu + \epsilon \sum ij Tij logTij - 1, (11)

with \lambda \in Rm and \eta \in Rn Lagrangian multipliers. Minimising L with respect to T gives the solution

Tij = e^{-\lambda i / \epsilon} e^{-Cij / \epsilon} e^{-\eta j / \epsilon} (12)

or

T = \pi e^{-C/\epsilon} \Omega, (13)

where \pi = diag(e^{-\lambda 1 / \epsilon}, ..., e^{-\lambda m / \epsilon}) \in Rm\times m and \Omega = diag(e^{-\eta 1 / \epsilon}, ..., e^{-\eta n / \epsilon}) \in Rn\times n are diagonal matrices of Lagrangian multipliers.

Finding \Pi and \Omega is achieved through an iterative scaling procedure that is variously called Iterative Proportional Fitting (IPF), RAS, or Sinkhorn’s algorithm48–50. Define M = e^{-C/\epsilon}; then, given an initial guess \pi 0, we update \Omega to satisfy the first marginal constraint eq. (9)

\Omega M > \pi 0 = \nu: (14)

Solving for \Omega gives

\Omega 0 = \nu / (M > \pi 0) (15)

where the division is understood element-wise. Similarly, we obtain the next update for \Pi as

\pi 1 = \mu / (M \Omega 0) (16)

and so on. The algorithm can thus be summarised as follows:

Algorithm 1. Sinkhorn’s Algorithm
1: Inputs:
M (Exponential of cost matrix)
\mu, \nu (marginals)
2: Initialise the first Lagrangian multiplier \Pi 0
3: for n iterations do
4: \Omega i+1 = \nu / (M > \pi i)
5: \pi i+1 = \mu / (M > \Omega i+1)
6: end for

Under certain conditions, convergence of the algorithm to a unique solution is guaranteed51,52.

The classic OT problem Eqs. (3) and (4) can be interpreted as the central planner’s problem of finding the optimal assignment or matching of supply and demand. The entropy-regularised OT problem can be viewed as a similar optimal assignment problem, but subject to uncertainty and/or randomisation. The dual problem to entropy-regularised OT, i.e. minimising (5) subject to (3), is given by

max f,g \sum i f i \mu i + \sum j g j \nu j - \epsilon \sum ij e^{(f i + g j) / \epsilon} - Cij: (17)

In the limit \epsilon \to 0 the last term ensures that the dual potentials f and g satisfy

f i + g j \leq Cij (18)

where f \oplus g = f 1T m + g 1T n. Condition (18) corresponds to the admissibility condition of the dual non-regularised OT problem. In this context f and g can be interpreted as the minimal cost of picking up and dropping off a good at locations respectively. The problem of finding the optimal plan T is thus split into determining the optimal cost of collecting and delivering goods. The constraint (18) ensures optimality: if f i + g j > Cij, that is, the cost of picking up a good at location i and dropping it off at location j is larger than the transportation cost, it cannot be optimal.

Neural inverse optimal transport
In inverse OT one wishes to infer the underlying cost C from (partial) observations of transport plans T, which are usually solutions to entropy regularised OT problems. Rewriting Eq. (13), we have

C = \epsilon (log \pi + log \Omega > - log T); (19)

thus C is only determined up to an additive decomposition into row and column vectors, with any transformation of the kind

Cij !7 Cij + \alpha i + \beta j

leaving the transport plan T invariant, since the transformation can be absorbed by the scaling vectors. To constrain the problem, we can bound the cost Cij \in [0, Cmax], and demand that the inverse of 0 should be Cmax, i.e.

u: T !7 C, u(0) = Cmax

This is a natural restriction, since it implies that the cost on edges with zero transport flow should be maximal. If this maximum is attained in every row and every column of the cost matrix, the row- and column-shifts \alpha i and \beta j must satisfy

Cmax = max Cij = ! max(Cij + \alpha i + \beta j) \leq Cmax 8i) \alpha i = 0

(and similarly \beta j). Thus, under these conditions the cost matrix is uniquely determined (see also Fig. S1 in the SI).

To infer the cost matrix function C(t) from a dataset of transport plan observations T(t), we build on the neural parameter estimation method first introduced in ref. 23 and subsequently expanded upon in ref. 24. We wish to train a neural network u to solve the inverse OT problem C(t) = u(T(t)). We do so by constructing a loss function based on the OT equations, i.e.

J = ||T(u(T)) - T|| 2 + \sum (i,j) \in S (Cij - Cmax) 2 (19)

Here, T(u(T)) is the estimated transport plan obtained by solving Sinkhorn’s algorithm alg. 1 until convergence (determined by a numerical tolerance criterion), and

S := {(i,j) | Tij = 0}

are the zero-flow edges of T. The second term thus enforces the maximum value Cmax to be attained on S. Crucially, the solution of the entropy-regularised OT problem is differentiable with respect to C, and can be computed numerically. Thus, the loss J can be minimised using gradient descent methods. While the dependence of the stopping time on C introduces potential non-differentiabilities at iteration-change boundaries, in practice these events are rare and did not cause instability in our experiments; the issue can also be avoided entirely by instead fixing the number of iterations at a sufficiently large value. The data is processed in batches, and a gradient descent step performed on the neural network parameters after each batch. The loss is only calculated for links with trade flow > 0. Note that our goal is not to predict future trade-flows, but rather to infer an underlying cost which drives the flows subject to the OT model. We therefore do not require large volumes of data, as would be typical in a prediction task.

As mentioned, the FAO dataset contains two values for each entry Tij: one reported by the exporter, and one by the importer. Let TE be the transport plan where all entries are those reported by the exporters, and TI those where all are reported by the importers. The training data—i.e., the data we use to train the function u—consists of only these two transport plans for each year: {TE(t), TI(t)}, giving a total training set size of 2 \times L, where L=23 are the number of observation points. A hyperparameter sweep showed that using a deep neural network with 5 layers, 60 nodes per layer, and hyperbolic tangent activation functions on all layers but the last, where we use a sigmoid, gives best results. Using a sigmoid activation function on the last layer ensures 0 \leq Cij \leq 1 = Cmax. We use the Adam optimiser53 to train the neural network. We pool all FAO trade matrices to only contain those countries that account for 99% of import and export volumes, subsuming all other countries in an ‘Other’ category (thereby ensuring that no flow is lost). Entries for which neither the importer nor the exporter have reported a value are assumed to be zero, and we constrain the cost matrix to be maximal on these entries. Entries for which only the exporter or the importer have reported a value (but not the other) are presumed missing in the respective table, and are masked in the loss function. With this approach, on average about 20% of entries are masked in the transport plan (see Fig. S2 in the SI). Entries for which all reported values are missing populate the zero-flow edge set S.

Uncertainty quantification
Uncertainty on the estimates stems from two sources: one, the degree to which the minimiser of the inverse problem (19) is ill-defined (i.e. the number of possible cost matrices that all fit the problem equally well), and two, the uncertainty on the transport plans themselves. To address the first, we use an ensemble training approach23,24 and train a family {u k} of 10 neural networks for each commodity in parallel. Even though the inverse problem is theoretically well-posed when the forward problem (10) admits a solution, in the case of the FAO data we are solving a minimisation problem. To incorporate the uncertainty on the transport plans, we pass random samples of T through each of the trained neural networks u k. These samples are obtained by selecting either TE or TI uniformly at random for each entry of the transport plan, and passing this sample through each neural network. Repeating this n times gives n samples of C, and inserting each estimate of C into Sinkhorn’s algorithm gives n estimated transport plans T. We generate a total of n = 100 samples for each year and neural network (see also Fig. S4 in the SI). The uncertainty estimates obtained by our method then provide an indication of how strongly a given set of trade flows informs the underlying cost.

Peer review rounds
[{"round": 1, "reviewer_comments": {"reviewer_1": "A. Overall Assessment\nLet me thank the Authors for this very interesting piece of work. As an economist working with gravity models I was not that\nfamiliar with the rich literature linking issues in trade and optimal transport, and I find it very interesting. Also, the three\ndifferent case studies which highlight different episodes and aspects of the complexities of global trade and different\ntestbeds for the methodology are very much needed. I will also mention that I have little experience with working with Neural\nNetworks (henceforth NNs), so I will mainly stick in this report to the overall gist of the paper and on the section regarding\ngravity models. I find the paper in general quite clear, well written and well structured. I think there are however some major\nand minor issues that I believe should be addressed.\nB. Major Comments\n1) There are some features of the NN methodology that should be made clearer. For example, the Authors do not clarify\nwhether the data the model is trained on are nominal flows of trade for all years in the sample (panel structure) or a single (or\na sequence thereof) cross section, i.e. a single year. The confusion stems from calling \"T\" both the matrix of ”transport plans”\nand that of trade flows. Although, the two might be the same in practice (what one observes), they are very different\nconceptually.\n2) Could one try to perform exercises similar to what is done in the paper using the marginals only? This is a well-known\nissue in the Input-Output literature and often indeed solved using variants of the IPFs and the RAS algorithm. Would be\ncurious to know if there may be some space for this.\n3) I find some of the descriptions of Case study I a bit confusing: when trade is mentioned, it is implicitly describing wheat\nexports only? Without explicitly mentioning this, one might think that change in ”trade volumes” is about total trade and not\nonly wheat.\n4) B figures may also require a bit more elaboration: one is struck by the huge increase for some countries, but this is not\ndiscussed in the text. This also relates to the fact that it looks as if the change in trade cost is only relevant for increases in\ncost (but not decreases). Is this correct?\n5) I would maybe suggest the authors to corroborate the results on the C figures with simple Spearman correlation\ncoefficients to understand the underlying relationship between change in cost and change in trade.\n6) Gravity model (GM):\n6.1 I find the comparison with the gravity model a bit unsatisfactory as it is now. For example, Eq. (20) does not make sense\nas it is currently formulated: the variables O_i , E_j, χ_j would be absorbed into the fixed effects. Since Table S1 reports\nhowever their coefficients (which would not be defined if the specification was in the current form) I guess that the authors\nare really specifying one model for each good, i.e. log T_ijl where l is the product.\n6.2 To verify this I also went to the Git page the authors provide but did not find the results - I might have missed this, but if\nnot I would advise the authors to provide reproducible codes also for the empirical specification. In general, I think this\nshould be stated more explicit in the text as well as correct the equation.\n6.3 The natural question would then be: why shouldn’t the comparison with the GM be done also with goods fixed effects\n(either good specific γ_l or interacted with origin and destination). I would think the latter to be a fairer comparison due to the\nstringency of the NNs approach, cf. the discussion on multilateral resistance terms in the gravity literature.\n6.4 A similar argument applies also to the time dimension. First, is not clear whether the comparison is done on a single year\n(cross-section) or for all years together (pooled sample). Then, if the NN is trained using all the data, then also in this case I\nbelieve a solid comparison would require the inclusion of time fixed effects.\n6.5 A follow-up point from the previous one would be also a comparison in terms of the number of parameters of the two\nmodels. Indeed, one drawback of adding more fixed effects in the specification is that one should then estimate a lot of\nparameters. This would of course give a much better fit and less degrees of freedom. How would the GM and the NN\ncompare in terms of this? This should be a further dimension to discuss for a fairer comparison between the two approaches.\nC. Minor Comments\n- The B images in Case Study 1 would require a different scale\n- I believe the reference 22 is more subtle than what reported - aggregation matters when parameters vary across sectors\n(akin to the case where good specific fixed effects are included)\n- I would also suggest the authors to move one of the figures (perhaps Fig 2) of the case studies in the appendix. I think there\nis some graphical redundancy and one has to do a lot of back and forth between text and images.", "reviewer_2": "I co-reviewed this manuscript with one of the reviewers who provided the listed reports. This is part of the Nature\nCommunications initiative to facilitate training in peer review and to provide appropriate recognition for Early Career\nResearchers who co-review manuscripts.", "reviewer_3": "This paper uses an optimal transport model in combination with a deep neural network to get a time varying function of trade\ncosts from noisy trade volumes while demand and supply constraints are met. The method is applied to global food and\nagricultural data. The authors demonstrate that the performance of the proposed method to shocks such as Brexit, the\nRussian invasion in Ukraine and trade disputes with China. The paper is overall well written and the analysis is well\nexplained.\nI have two main concerns. First, to my understanding the authors take as given the demand and supply (parameter mu and\nnu) and solve for the optimal trade flows subject to these amounts. If that’s right, then demand and supply are not\nendogenous and we are missing important equilibrium effects. This is particularly important for performing counterfactuals.\nSecond, and somewhat related, although I take the authors’ point that gravity models are quite stylized by parameterizing\ntrade costs by a handful of variables, I am not sure full flexibility is desirable. The reason is the following: allowing for a fully\nflexible matrix of trade costs makes me worry about the validity of this specification in counterfactuals. In other words, it is\nless convincing that these trade costs will be invariant in counterfactual predictions, especially if the counterfactual is “far\nfrom our data”.\nMoreover, it was not clear to me how the authors performed the empirical analysis. It would be helpful if the authors\nexplained this a little better. For instance, related to the above: it is reassuring that the proposed methodology can better\npredict what happened after the specific shocks studied; however, it seems to me the authors use data that include these\nshocks. It would be better to do this as an out of model fit type of exercise.\nOther comments:\n1. The regularization converts the standard linear LP optimal transport problem into a nonlinear one. The resulting maximum\nentropy approach and its economic meaning must be further explained considering the role of the hyperparameter epsilon,\nwhich needs further elaboration in connection with the case studies also.\n2. The duality in (17) and (18) refers to the LP version. The authors should explain the dual version of the nonlinear\nregularized version.\n3. Training is based on random batches of T which produce 'target' cost values. The authors should elaborate further the\nbehavior outside the training set over a test set.", "reviewer_4": "# Report for \"Modelling Global Trade with Optimal Transport\"\n## Summary\nThis paper proposes inverse optimal transport as a method to infer trading cost functions between countries. The main\nassumption is that the observable trading volumes (as a function of time) are entropy-regularised optimal transport plans with\nan underlying time-dependent cost functon(measuring a general cost of transporting commodities from a country to another).\nIt is shown that compared to classical gravity models, this approach gives more accurate reconstructions of the trading\nvolumes. Moreover, the inferred cost functions can be used to study the effect of extrinsic factors (wars, tarrifs) on trade\npatterns that cannot be easily uncovered from the trade volumes alone. The approach is demonstrated in several case\nstudies using global trade matrix datasets from FAO.\n## Comments\nThe paper is well written and the approach is simple and elegant. I have several questions about the mathematical aspects\nof the methodology that the authors may wish to clarify.\n1. The primary approach in this paper is an inverse optimal transport problem: given an observation of the transport plan,\none needs to recover the transport cost function. Can the authors comment on the well-posedness of this inverse problem?\nIn particular, is it generally true that there exists a unique $C$ such that the optimal transport plan is equal to an observed\n$T$? How robust is this with respect to missing data in $T$? Since this is the central idea behind the algorithm, it is\nadvantageous to discuss this at length.\n2. The parameter $\\epsilon$ in equation (10) appears to be a hyper-parameter. How does $\\epsilon$ affect the well-\nposedness of the inverse problem, and more importantly, how does the inferred $C$ depend on $\\epsilon$? The authors\nmay wish to demonstrate some robustness of their results with respect to the choice of $\\epsilon$, or discuss how this\nparameter should be chosen in a reasonable way. Similarly and perhaps less importantly, the number of iterations of the\nsinkhorn algorithm in equation (19) (definition of $\\hat{T}$) is also a hyper-parameter. Please also discuss its effect and\nassociated robustness.\n3. Figure 7 compares the performance of the OT approach with the gravity model. I have some questions about this\ncomparison:\n- The improvement is on the reconstruction of the observed trade volumes (transport plan). For the gravity model, a linear\nmodel is used on the cost $C$ (which then determines $T$). One would expect that with a greater number of well chosen\ncovariates in the regression below equation (1), one may get better reconstruction for the gravity model. Have the author\nruled out that it is due to the small number of (or badly chosen) covariates that cause the reconstruction performance of the\ngravity model to be sub-optimal?\n- The results here are not a demonstration of whether the inferred $C$ is more accurate. Do the authors have any way of\ndemonstrating that the inferred $C$ is correct, perhaps on a synthetic example?\n- It is claimed at the end of page 3 that uncertainty quantification performance of the OT approach is also superior. Where is\nthis demonstrated?\n4. Does the current approach train a different cost $C$ for each traded commodity? If so, does it make sense to account for\ncorrelations on $C$ for different commodities instead?\nMinor issues\n1. After Equation 5: you may wish to cross reference the definition of $\\mathcal{H}$ in methods, since it is the negative\nentropy, not the entropy - this may confuse some readers.\n2. Equation 8: the notation here is rather confusing as $u$ is a function mapping transport maps to costs as defined in\nequation 7. If the LHS is a probability density function over costs, then the RHS should be something like $\\rho(u^{-1}\n(C))|\\det \\frac{\\partial u^{-1}}{\\partial T }(C)|$?\n3. End of page 3: \"both prediction accuracy and uncertainty\", do you mean \"uncertainty quantification\"?\n4. In the analysis on case studies the trading cost changes are reported in \"units\". Can the authors explain what units are\nthese, and how one should interpret its magnitude?"}, "author_response": "Modelling Global Trade with Optimal Transport\nResponse to reviewers\nWewouldliketothankthereviewersfortheirthoughtfulandconstructivefeedbackonourmanuscript. Thecomments\nwereextremelyhelpfulandhaveledtosubstantialimprovementsinboththemethodologyandpresentationofthework.\nInparticular,Reviewer!’sobservationsregardingthewell-posednessoftheinverseproblempromptedaredesignofour\nlossfunctionandtrainingprocedure. Wehavenowadoptedanensemble-basedapproach,trainingmultipleneuralnet-\nworksinparallel.Thisallowsustocaptureamoreexpressiveformofuncertaintyintheestimates,re”ectingthediversity\nofcostfunctionsthatcanexplaintheobservedtradedynamics. Whiletheoverallresultsremainqualitativelyandquan-\ntitatively similar, the approach is now better grounded theoretically. We also realized that our previous description of\nthegravitymodelmayhavebeenmisleading. AlthoughtheoriginalimplementationalreadyalignedwithReviewer#’\nsuggestions,wehaverevisedthetexttomakethisclearer.\nAttachedisapoint-by-pointresponsetothereviewercomments.Changestothemanuscriptarehighlightedingreen;\nwhereanentiresectionhasbeenadded,itsheadingappearsingreenforeaseofreference.Wehavealsoaddedseveralnew\n$gurestothesupplementarymaterial.Webelievethereviewers’insightshaveledtoasigni$cantlyimprovedmanuscript,\nandaregratefulfortheopportunitytoreviseit.\nWelookforwardtohearingfromyou,\nYourssincerely,\nThomasGaskin,GuvenDemirel,Marie-ThereseWolfram,AndrewDuncan\n#%July&’&(\n#\nReviewer!\nMajorComments\n#. Theauthorsdonotclarifywhetherthedatathemodelistrainedonarenominal!owsoftradeforallyearsinthesample\n(panelstructure)orasingle(orasequencethereof)crosssection,i.e. asingleyear. TheconfusionstemsfromcallingT\nboththematrixof“transportplans”andthatoftrade!ows. Althoughthetwomightbethesameinpractice(what\none observes), they are very di”erent conceptually. We thank the reviewer for highlighting the di)erence between\ntrade”ows(observations)andunderlyingtransportplansthatgenerateinstancesof”ows. Forclarity,wedenote\nthetransportplansbyT andthematrixofobserved”owsbyTE (TI),asreportedbytheexporting(importing)\ncountry.Thetrainingdataconsistsofthefulltime-seriesofobserved”owsforeachcommodity,usingTEandTI\nvaluesforLtime-points(&*years).Theinputtotheneuralnetworkisatransportplanobservationforasingleyear,\ni.e.T(t);seeequation+inthemanuscript.\n&. Couldone performsimilarexercises usingthemarginalsonly? Thisapproach can, inprinciple, begeneralisedto\nproblemswhereoneobservesmarginalsonly.Thisproblemis,however,signi$cantlymoreill-posedthantheprob-\nleminvestigatedinthispaper,sincein$nitelymanytransportationplansleadtothesamemarginals.Itwouldthus\nrequirestronger(andpossiblymoreapplication-speci$c)assumptionsontheunderlyingproblem.Seealsoresponse\ntoReviewer!,Q#.\n*. Whentradeismentioned,isitreferringonlytotradeofasinglecommodity? Withoutexplicitmention,onemight\nthinkthatchangein“tradevolumes”referstototaltradeandnotonlywheat. Indeed—tradevolumesinourarticle\nalwaysrefertoasinglecommodity.Wehavechangedthewordinginsomeplacestothise)ecttopreventconfusion.\n!. B#guresrequiremoreelaboration:oneisstruckbythehugeincreaseforsomecountries,butthisisnotdiscussedinthe\ntext. Thisalsorelatestothefactthatitlooksasifthechangeintradecostisonlyrelevantforincreasesincost(butnot\ndecreases).Isthiscorrect? Thecolourbarscalewaspreviouslyincorrect,aswehadaccidentallymultipliedthe$gures\nby#’’twice(torepresentpercentages). Ithasnowbeencorrected. Nevertheless,asmallnumberofcountriesdid\nseeaverylargeincreaseinwheattrade. ThesecountriesareessentiallyalllocatedinEasternEurope;India(which\nalsoexperiencedalargeincreaseinrelativeterms)byourestimatesimported’.#tonnesofwheatin&’&’,and!.,\ntonnesofwheatin&’&#—technicallyalargerelativeincrease,butsmallinabsolutetermswhencomparedtothe\nPolishincreaseof(&(,’’’tonnes.Wehaveaddedastatementtothise)ecttothe$gurecaption.\nRegardingthequestionofwhetherchangeintradecostisonlyrelevantforincreasesintradevolume—thisisnotso,\nascanbeseeninthenewlyadded$gureS+intheappendix.Apositivechangeincost(y-axis)isgenerallyassociated\nwithadropintrade(x-axis),andviceversa.Therearealsoexceptionstothispattern,aswedetailinthemanuscript:\nthisisthenatureofoptimaltransport,whichdescribesaspatiallycorrelatedsystemwhere$nitesupplyisdistributed\namongthedestinationcountries.\n(. TheauthorsshouldcorroboratetheresultsontheC#gureswithsimpleSpearmancorrelationcoe$cientstounderstand\ntheunderlyingrelationshipbetweenchangeincostandchangeintrade. Wethankthereviewerforthisinteresting\nremark, andhaveaddedseveraladditionalplotstotheSIsubstantiatingourobservationsonthemacrotrendsin\nthewheattradefollowingthewarinUkraine—see$gs.S(,S+,andS,.FigureS(showsthechangeincost!Cand\nrelativechangeintradevolume!T/T fortheperiod&’&#–&’&&asafunctionofGDP/capita(inrealterms),aswell\nastheSpearmancorrelationcoe-cients. We$ndacorrelationcoe-cientof-’.&*for!C,indicatingthatpoorer\ncountriessawhigherincreasesincostthanwealthierones. Wealsoshowchangesincostasafunctionofrelative\nchangesintradein$gureS+,disaggregatedbyregion. WeseeagainthatSub-SaharanAfricaboreadisproportion-\natelyhighincreaseintradecosts,despiteseeingsimilarchangesinwheatimportsasEurope,NorthAmerica,and\nOceania.SeealsothenewlyaddeddiscussionintheSI.\n&\n%. Gravitymodel(GM):\n(%.#) CodesanddataforthegravitymodelexperimentsaremissingintheGithubrepositoryprovided.Wethankthe\nreviewerfornoticingthis;indeedwehadomittedtopushtheresultstorepository,whichwehavenowdone.\nAllplotscanbereproducedusingtheEvaluate.ipynbJupyternotebook. TheGravitymodelcovariates\nandcodearegiveninthedata/Gravity modelfolder.\n(%.&) Eq. (%&)doesnotmakesenseasitiscurrentlyformulated: thevariablesO i,E j,ω j wouldbeabsorbedintothe\n#xede”ects.SinceTableS’reportscoe$cients(whichwouldnotbede#nedifthespeci#cationwasinthecurrent\nform),Isupposethattheauthorsarereallyspecifyingonemodelforeachgood,i.e.logT wherelistheproduct.\nijl\nWethankthereviewerforpointingoutthisinconsistencyinthemodelspeci$cation.Yes,thegravitymodelis\nspeci$edforeachproductl,separately,andwehavenowclari$edournotation.Intheoriginalspeci$cation,\nO ,E ,ω weremeanttoindicatetime-dependentvariables;wehaveclari$edthenotationtoincludetime\ni j j\nandproductindices.\n(%.*) Whyisn’tthecomparisonwiththeGMalsoperformedwithgoods#xede”ects(eithergoodspeci#cε orinteracted\nl\nwithoriginanddestination).IwouldthinkthelattertobeafairercomparisonduetothestringencyoftheNNs\napproach,cf. thediscussiononmultilateralresistancetermsinthegravityliterature. Webelievethispointisa\nresultofourconfusingchoiceofnotation,seeQ#above. Infact,wedoestimatetheGMseparatelyforeach\nproduct,andhencetheestimatede)ectsaree)ectivelyinteractedbyproductbyde$nition.\n(%.!) Asimilarargumentappliesalsotothetimedimension. First,isnotclearwhetherthecomparisonisdoneona\nsingleyear(cross-section)orforallyearstogether(pooledsample).Then,iftheNNistrainedusingallthedata,\nthenalsointhiscaseIbelieveasolidcomparisonwouldrequiretheinclusionoftime#xede”ects. Thankyou\nforthisrelevantandimportantquestion. Thecomparisonisdoneforthepooledsample. Ourspeci$cation\nincludedorigin,destination,andtime$xede)ects. WehavenowrewrittentheGMsectionoftheSupple-\nmentaryMaterialforanaccuraterepresentationofthespeci$cation.\n(%.() Afollow-uppointfromthepreviousonewouldbealsoacomparisonintermsofthenumberofparametersofthe\ntwomodels. Indeed,onedrawbackofaddingmore#xede”ectsinthespeci#cationisthatoneshouldthenesti-\nmatealotofparameters.Thiswouldofcoursegiveamuchbetter#tandfewerdegreesoffreedom.Howwouldthe\nGMandtheNNcompareintermsofthis?Thisshouldbeafurtherdimensiontodiscussforafairercomparison\nbetweenthetwoapproaches. Forthis,wenowreportthenumberofparametersoftheneuralinverseoptimal\ntransportmodelandthebasegravitymodel. Asanextension,wehaveincludedtheestimationofthethree-\nwaygravitymodelwithexporter-time,importer-timeandpair(exporter-importer)destination$xede)ects,\nremoving corresponding regressors. The results show general consistency between optimal transport and\ngravitymodellingapproacheswithhighdimensionality,withtheoptimaltransportapproach$ttinghigher\nvaluetrade”owsmoreclosely. Onecanarguethatthegravitymodelling$twillgetevenbetterwithfurther\ntime-dependentbilateraltraderegressors. However,theoptimaltransportapproachprovidestradecostes-\ntimatesintheabsenceofsuchregressors. Weraisethesepointsinthediscussion,andthankthereviewerfor\ntheircomment.\nMinorComments\n#. TheBimagesinCaseStudy’wouldrequireadi”erentscale. Weareverygratefultothereviewerforpointingthis\nout—thelargevaluesonthescalewereinfactduetoatypingerrorinthef-stringsettingthecolourbarlabels. We\nhavecorrectedtheerror,butalsochangedthescalingofthecolourbartonowhopefullymakeiteasiertoparse.\n&. Ibelievethereference%%ismoresubtlethanwhatreported—aggregationmatterswhenparametersvaryacrosssectors\n(akintothecasewheregoodspeci#c#xede”ectsareincluded)Weagreethatourstatementwasnotpreciseandthere-\nforerephraseditmorecarefully.\n*\n*. Iwouldalsosuggesttheauthorstomoveoneofthe#gures(perhapsFig. %)ofthecasestudiesintheappendix. Ithink\nthereissomegraphicalredundancyandonehastodoalotofbackandforthbetweentextandimages. Wethankthe\nreviewerforthissuggestion,whichwehavefollowed.\nASoyadataset\nBBarleydataset\n(continuednextpage)\n!\nCWinedataset\nDWheatdataset\n(continuednextpage)\n(\nEBeefdataset\nFigure!: SplittingtheFAOdataintoatrainandtestperiod(pinkshadedarea),andpredictingtradeshocks.Thelefttwocolumns\ncomparetheFAOvalues(x-axis)withourestimates(y-axis),colour-codedbyrelativeerror.Alsoindicatedarethemedianrelativeerror\n(MRE)andthePearsoncorrelationontheentiredataset.Theightsideshowspredictedtradevaluesonaselectionofcorridors,with\nthetestperiod(theyearswithheldastestdata)indicatedbythepinkshadedperiod.\nReviewer”\n#. Tomyunderstandingtheauthorstakeasgiventhedemandandsupply(parameterµandω)andsolvefortheoptimal\ntrade!owssubjecttotheseamounts. Ifthatisright,thendemandandsupplyarenotendogenousandwearemissing\nimportantequilibriume”ects.Thisisparticularlyimportantforperformingcounterfactuals.Wethanktheviewer\nfor raising this important point, which helped us position our approach better. Our model treats the demand\nandsupplyasexogenousandestimatesthebilateraltradecoststhatproducesthesetrade”ows.Forcounterfactual\nanalysis,onecanfollowanapproachsimilartotheconditionalequilibriumanalysisofYotovetal.(&’#+),designing\ncounterfactualsthatleadtochangesintradecosts. Thiscanbedonethroughregressingthetradecostsonpolicy\nvariables and then changing the levels of regressors according to the counterfactual scenario, e.g. the signing of\na regional trade agreement. Extending the current approach to a full general equilibrium setting will require a\ncomplementarymodelofinternalproductionandpricing,whichisbeyondthescopeofthisstudy.Wenotethisas\napromisingresearchdirection.\n&. Iamnotsurefull!exibilityisdesirable.Thereasonisthefollowing:allowingforafully!exiblematrixoftradecosts\nmakesmeworryaboutthevalidityofthisspeci#cationincounterfactuals.Inotherwords,itislessconvincingthatthese\ntradecostswillbeinvariantincounterfactualpredictions,especiallyifthecounterfactualis“farfromourdata” Itis\nimportanttonotethatthismodelhasnotbeendesignedforprediction.Buildingapredictivemodeloftrade-”ows\nwouldbeuniquelychallengingduetothesheernumberofexogenousfactors,feed-backdelaysandnon-stationarity.\nOurmodel’sobjectiveisinferenceofanunderlyingcoststructurewhichiscompatiblewiththepartialandnoisy\nobservationsoftrade-”ows,whichcanprovideuniqueinsightintoemergingtradebarriersandcorridors.Onecan\nalsoanalysetheimpactofchangesintradecostsontrade”ows,butafullgeneralequilibriumanalysisisbeyondthe\nscopeofthisstudy,asdiscussedabove.\n%\n*. Itwasnotcleartomehowtheauthorsperformedtheempiricalanalysis.Itwouldbehelpfuliftheauthorsexplainedthis\nalittlebetter.Forinstance,relatedtotheabove:itisreassuringthattheproposedmethodologycanbetterpredictwhat\nhappenedafterthespeci#cshocksstudied;however,itseemstometheauthorsusedatathatincludetheseshocks.Itwould\nbebettertodothisasanoutofmodel#ttypeofexercise.Theempiricalanalysiswascarriedoutbylookingatchanges\nintradecostsforeachcommodityandcomparingittothechangeintradevolumes.Forinstance,inthecaseofthe\nUkrainianwar,welookatthechangeincostandtheassociated(relative)changeinwheatimports.Therevieweris\nrightinthinkingthattheshocksarepartofthetrainingdata—weusetheentiresetofFAOtradematrices,chie”y\nbecausedataisveryscarceandthequalityofthetradematriceslow(i.e.,exporter-andimporter-reportedvaluesdo\nnotagree,andweassumethatasubstantialnumberofunreportedvaluesareinfactnon-zero,see$g. !). Forthis\nreason,wewerenotoptimisticthatwewouldbeabletoextrapolatetounseendata,andespeciallypredictthestrong,\nout-of-sampleshocksweanalyse,bytrainingonasmallnumberofreportedtradematrices.Nevertheless,weranthe\nnumericalexperimentsasthereviewersuggested. Todoso,wechoose$vedatasets—beef,barley,wheat,soya,and\nwine—andmaskedfouryearscontainingsomeofthebiggestshockstothesystem(i.e.,theperiodsoftradefrictions:\n&’#%–&’&’ in the case of soya, &’#,–&’&& for the others). We re-trained the neural networks and compared the\nperformanceonthetestandtrainingset.Overall,weobservebetween#%and&#%dropinperformance(measured\nasthePearsoncorrelationonthetestdata),andasigni$cantincreaseinthemedianrelativeerror(MRE)(see$gs.#).\nSomeoftheshocksarereproducedwell,e.g. thedropinUS-Chinasoyatrade,andthefollowingspikeinimports\nfromArgentina;others,suchasthedropinAustralianbeefexportstoChina,arenotcaptured. Performancealso\nvaries considerably between the exporter- and importer-reported data. In order to conduct further analysis for\nimprovingout-of-samplepredictions,onecouldlookintotrainingthemodelwithmanyothercommoditiesfrom\nUNComtradeorBACIdatabasesthatincludetradeshocksofsuchhighmagnitude—butthisisperhapsbestleft\nforfuturestudy.Inthiswork,weareconcernedwithinference,anddemonstratingthattheinferredcoststructure\nprovidesaninformativeandinsightfulperspectiveonthehiddendriversoftrade.\n!. TheregularizationconvertsthestandardlinearLPoptimaltransportproblemintoanonlinearone. Theresulting\nmaximumentropyapproachanditseconomicmeaningmustbefurtherexplainedconsideringtheroleofthehyperpa-\nrameterϑ,whichneedsfurtherelaborationinconnectionwiththecasestudiesalso.Intheeconomicliteratureentropic\nregularisationisofteninterpretedasaheterogeneitythatisunobservedbyanalysts. Weexpectthattrade”owsare\nmainlydeterminedbymatchesbasedontheunderlyingcost.Thereforethehyperparameterϑischosentoberela-\ntivelysmallinallcomputationalexperiments—seealsoresponsetoReviewer!Q&.\n(. The duality in (’() and (’)) refers to the LP version. The authors should explain the dual version of the nonlinear\nregularizedversion.Weoriginallyintendedtoincludethemore‘intuitive’formulationforreadersnotfamiliarwith\ntheOTliterature. Therefereeishowevercorrect—thestatedproblemisthedualoftheclassicOTproblem. We\nhavecorrectedthisandnowstatethecorrectdualproblem,itsconnectiontotheclassicOTproblemasϑ 0,and\n→\ndiscussitsinterpretation.\n%. TrainingisbasedonrandombatchesofT whichproduce‘target’costvalues.Theauthorsshouldelaboratefurtherthe\nbehaviouroutsidethetrainingsetoveratestset.Pleaseseetheanswertoquestion*above.\n+\nReviewer#\n#. Cantheauthorscommentonthewell-posednessofthisinverseproblem?IsitgenerallytruethatthereexistsauniqueC\nsuchthattheoptimaltransportplanisequaltoanobservedT?\nThegeneralsolutionoftheentropy-regularisedoptimaltransportproblemis\nT = diag(u)e → C/ωdiag(v), (#)\nwhereuandvarescalingvectors.Taking(elementwise)logsandrewriting,weobtain\nC = ϑ(logT logu logv ↑ ), (&)\n↑ ↑ ↑\nthusCisonlydetermineduptoanadditivedecompositionintorowandcolumnvectors,\nC = ϑT +ϑlogu +ϑlogv .\nij ij i j\n↑\nAnytransformationofthekind\nC C +ϖ +ϱ (!)\nij ij i j\n↓→\n(additiverank-&transformation)leavesthetransportplanT invariant,sincethetransformationcanbeabsorbedby\nthescalingvectors.Withoutfurtherconstraints,CisthereforenotuniquelyinferrablefromobservationsofT.\nTherearevariousadditionalassumptionsonecouldmaketoensuretheproblemiswell-posed.Werealisedthatour\npreviousapproachofrequiringC [0,1]and C = 1 iwasinfactnotsu-cienttoensureuniqueness:a\nij ↔ j ij ↗\nsimplecounterexampleistheN N matrix\n↘ !\n0, 1 , , 1\nN 1 ··· N 1\n→ . →\n . .  , (()\n0, 1 , , 1\n N 1 ··· N 1\n → → \nwhichhascolumnsum1andwhoseassociatedtransportplanisinvariantunderthetransformation\nq q\nC C +(q, , , ), 0 q 1.\nij ij +(q, , , ), 0 q 1.\n↓→ ↑N 1 ··· ↑N 1 ≃ ≃\n↑ ↑\nFigure$:Well-posednessoftheinverseproblemonsyntheticdata.Weinferthecostmatrixonnoiseless,gapless,syntheticdata,and\nrequirethediagonalofthetransportplantobemappedto0,witheachC\nij\n[0,1].ThisensuresshiftinvarianceoftheinferredC\n↔\nandthuswell-posednessoftheinferenceproblem.\n,\nFigure”:Well-posednessoftheinferenceproblemonFAOdata.ShownareresultsontheSoyabeandataset.Wequantifyuncertainty\nbothbypushingtheuncertaintyonthetrainingdata(thetransportplans)throughtheneuralnetworks,andbytraininganensemble\nofneuralnetworkstomeasurethespreadinpossiblecostmatricesthatminimisethelossfunction. Toprow: weshowtheinferred\ntransportplans,alongsidetheFAOdata.Secondrow:eachlinerepresentsthemeanpredictedcostmatrixbyasingleneuralnetwork\ninstance. Weperformasweepwith#’neuralnetworkstrainedinparallel. Ascanbeseen, thecostmatrixisessentiallyuniquely\ninferred,thoughwithsomevariationduetotheoptimisergettingtrappedinlocalminima. Thirdrow:theuncertaintyonournew\nestimatescoverstheuncertaintybothfromthediscrepancybetweenimporter-andexporter-reportedvalues,andthepotentialnon-\nuniquenessoftheoptimalcostmatrix.Sincewearenolongerconstrainingthecolumnsumstobe#,thenewcostestimatesareoverall\nhigherthanourpreviousones(bottomrow),thoughtheyaremostlyqualitativelysimilar. Seealso$g. S!intheappendix,andthe\nnewlyaddeddiscussionsonuncertaintyquanti$cationandwell-posednessinthemainmanuscriptandSI.\nAnaturalwayofmakingtheproblemwell-posedisthefollowing:werelaxthecolumn-sumconstraintandinstead\nrequirethattheneuralnetwork\nu : T C (+)\n↓→\nmaps0to1:\n!\nu(0) = 1. (,)\nThisisreasonable: itsimplysaysthatthecostonanedgewithzero”owshouldbemaximal. Ifthemaximumis\n.\nattainedineveryrowandeverycolumnofC,thentherow-andcolumn-shiftsϖ\ni\nandϱ\nj\nmustsatisfy\n!\n1 = maxC = max(C +ϖ ) 1 i ϖ = 0 (.)\nij ij i i\nj j ≃ ↗ ⇐\n(andsimilarlyϱ ).Thus,thecostmatrixisuniquelydeterminedundertheseconditions(see$g.&/$g.S#intheSI).\nj\nTheFAOtransportplanssatisfythiscondition:theycontainzerosineveryrowandcolumn,sincethevastmajority\nofedgeshavezero”ow;andevenifasourcecountryweretoexporttoalldestinationcountries,wecouldsimply\naddthatsourceasadestinationandsetthe”owto0,andviceversa. Wehavethereforemodi$edthelossfunction\nusedtolearnthecostmatricesto\nJ = Tˆ T 2+ς (C 1)2, (#’)\n⇒ ↑ ⇒2 ij ↑\n(i,j)\n(↓S\nwhere = (i,j) T = 0 .ςisabalancingparameterthatweightstheregulariserinthelossterm,andshould\nij\nS { | }\nbesetsuchthattheregulariserdoesnotoutweightheterm Tˆ T .\n2\n⇒ ↑ ⇒\nThisshowsthattheinverseproblemisuniquewhentheforwardoptimaltransportproblemhasauniquesolution;\nhowever,withtheFAOStatdata,therelevantquestioniswhetherthelossfunctionJ hasauniqueminimiser. To\naccountforthis,wenowtrainanensembleofneuralnetworksoneachdataset,andcomparethepredictions.Overall,\nthevariousrunsagreewellwitheachother(see$g.*,secondrow),indicatingthatourconstraintallowsustoextract\nauniquecost‘signal’fromthetransportplansbytrainingasingleneuralnetwork.Thedi)erencesareinpartdueto\nthenetworknot$ndingoptimalcostmatricesineveryrun;buttherewillalsobeuncertaintyduetonon-uniqueness\noftheoptimalcost.Bycombiningensembletrainingwithusingtheneuralnetworkasapushforwardmeasure,the\nuncertaintyonthecostswillnowbetterre”ectboththedegreetowhichtheinverseproblemisill-posed,aswellas\ntheuncertaintyontheFAOdata—seealsothenewlyadded$g.S!intheSI.Wehaveaddedathoroughdiscussion\nofthesequestionstothemainarticleandtheSI,andsincerelythankthereviewerforhelpingusclosethisimportant\ngap.\n&. HowrobustisthemethodwithrespecttomissingdatainT? Wehaveperformedanumberofadditionalexperiments\ntoanalyserobustnesswithregardtomissingvaluesofT ($g. !.) Wemaskedarandomnumberofentriesinthe\ntransportplan,andre-inferthecostmatrixC,giventhemarginalsoftheunmaskedtransportplan. Themethod\nisrobustforsmallamountsofmissingdata,sincethenumberofgapsineachrowandcolumnwillbesmall,thus\nconstraininghowthemissing“mass”givenbythemarginalscanbedistributedamongthemissingentries. The\nerroronthenon-maskedvaluesofT remainsapproximatelyconstant(whichisunsurprising),whiletheerroron\nthe entire cost matrix increases with the masking fraction. The error on C increases linearly with the masking\nfraction,butremainssigni$cantlysmallerontheunmaskededges(red).\nFortheFAOStatdata,wepreviouslyconsideredallnon-reportedvaluesas‘missing’,givingusamaskingfraction\nof around ,’%. This is unreasonable: most values are not missing, but simply unreported zeros. We have thus\nre-estimated the number of missing values in the following way: if a value is reported by any side (importer or\nexporter) either for the quantity dataset or the value dataset, we consider that edge to be a non-zero edge; if no\nvaluesarereportedbyanyreporter,wesetthe”owto0andrequirethecosttobemaximalonthatedge.Thisway,\nweestimatethenumberofmissingdatapointstobeonaveragearound&’%(see$g.!).\n*. Theparameterϑinequation(’&)appearstobeahyper-parameter. Howdoesϑa”ectthewell-posednessoftheinverse\nproblem,andmoreimportantly,howdoestheinferredC dependonϑ? Theauthorsmaywishtodemonstratesome\nrobustnessoftheirresultswithrespecttothechoiceofϑ,ordiscusshowthisparametershouldbechoseninareasonable\nway.Similarlyandperhapslessimportantly,thenumberofiterationsoftheSinkhornalgorithminequation(’*)(def-\ninitionofTˆ )isalsoahyper-parameter.Pleasealsodiscussitse”ectandassociatedrobustness.ϑisascalingparameter\n#’\nFigure#:Toprow:weinferthecostmatrixonnoiselesssyntheticdatawithdi)erentfractionsofthetransportplanmasked.Middle\nrow:inferredtransportplans. Thegroundtruthisthesameasin$gure&. Bottomrow:Asthefractionofmaskedvaluesincreases,\ntheaverageL1 erroronT andC increases(blue). However,onthenon-maskedvalues,errorsremainsigni$cantlylower,andthe\npredictiononthetrainingvaluesofT isindependentoftheproportionofmaskedvalues(red).Shownaremeanandmedianvalues,\naswellasthestandarddeviation,overallentriesoftherespectivematrices. Right: theestimatedfractionofmissingvaluesineach\nFAOdataset.Thisisestimatedbycomparingthenumberofentriesreportedbyonereporter(exporter/importer)butnottheother.\nthatdetermineshowmuchsmallcostsa)ectthetransportplan($g.().Itcantakeanyvaluein[0,1](inprinciple,\nitcantakeanyvalueinR+ ,butforlargeϑtheproblembecomes‘meaningless’sinceallstructureinC isblurred\nout).Onewouldlikeϑtobeassmallaspossible,sinceforϑ 0theinferenceprocedureconvergestoclassicalOT.\n→\nHowever,asϑ 0Sinkhorn’salgorithmbecomesunstable,becauseastheentriesoftheinitialguessexp( C/ϑ)\n→ ↑\ngoto0,therequiredscalingvectorsneedtogrowexponentiallytomatchthemarginalconstraints.Thisalsocauses\n##\nFigure%:E)ectoftheentropyregulariserϑontheinference.Toprow:thetransportplanforthecostmatrixgivenin&butdiferent\nvaluesofϑ.Bottomrow:accuracyontheinferredtransportplanandcostmatrixasafunctionoftheregulariserϑ.Thecostmatrixis\nthesameasin$g.&.Eachlineisanaverageover(di)erentseeds.\ntheconvergencerateofSinkhorn’salgorithmtoslowsigni$cantlyasϑ 0,increasingthecomputationalcost.We\n→\nthereforechooseasmallvalueofϑ 0.1thatbalancesnumericalstabilityandcomputationalcost.Theinference\n⇑\naccuracyisindependentofthechoiceofϑ—see$g. (. Inprinciple,ϑcouldbeinferredfromdatasolongasboth\nthecostandϑareconstrainedtolieintheunitinterval;howeveritisnotimmediatelycleartoushowthisa)ects\ntheuniquenessoftheminimizersonnoisydata,andsoweleavethisquestionforfutureresearch.\nRegardingthenumberofSinkhorniterations,theseareinfactnot$xed,butratheratolerancecriterionisusedto\ndeterminewhenthealgorithmshouldterminate:letuˆkandvˆkbethescalingvectorsiniterationkoftheSinkhorn\nalgorithm;thenweterminatethealgorithmif uk uk+1 <ς iand vk vk+1 <ς i,whereς = 10 9.This\n| i ↑ i | ↗ | j ↑ j | ↗ →\ne)ectivelymeansweterminatethealgorithmonceithasconverged.Wethankthereviewerforthisobservationand\nhaveamendedthetextaccordingly.\n!. TheresultsherearenotademonstrationofwhethertheinferredC ismoreaccurate. Dotheauthorshaveanywayof\ndemonstratingthattheinferredCiscorrect,perhapsonasyntheticexample? Seeresponsetopoint#and$gures&.\n(. Onewouldexpectthatwithagreaternumberofwellchosencovariatesintheregressionbelowequation(’),onemay\ngetbetterreconstructionforthegravitymodel. Havetheauthorsruledoutthatthisisduetothesmallnumberof(or\nbadlychosen)covariatesthatcausethereconstructionperformanceofthegravitymodeltobesub-optimal? Wethank\nthereviewerforraisingthispoint. Thebaselinegravitymodel’sinferiorperformanceisalmostcertainlyduetoa\nsub-optimalchoiceofcovariates. Thelargespreadofthegravitymodel’saccuracybetweencommodities($g. %C\nin the manuscript) would generally indicate that the chosen covariates are a good choice for some commodities\n#&\nand a bad one for others; the OT approach, meanwhile, performs consistently well. Hence, our approach does\nnotrelyonaprudentchoiceofcovariatesandfunctionalformforaccuracy. Sincethecostfunctionisnotbeing\nparametrised, one does not need to $nd the ‘right’ covariates in order to model the system well. This comes at\nthecostofdirectinterpretability.However,thelearnedcoststructurecanthereafterbemodelledusingaselection\nofcovariates,shouldonewishtointerpretitmoredirectly. Additionally,wehavenowaddedathree-waygravity\nmodel,whichhashigh-degree$xede)ects(seealsoresponsestoReviewer#)andclosesthegapbetweenthedegrees\noffreedomofthegravitymodelandOT.Ourapproachprovidesanalternativeapproachbyestimatingtradecosts\npurelyfromtrade”owdata.\n%. Doesthecurrentapproachtrainadi”erentcostC foreachtradedcommodity? Ifso,doesitmakesensetoaccountfor\ncorrelationsonC fordi”erentcommoditiesinstead? Indeed,thecurrentapproachtrainsadi)erentcostforeach\ncommodityindependently.Weagreethatintroducinglearnedcorrelationsbetweencommoditieswouldbebene$-\ncialandpotentiallyilluminating;butwhilethisiscertainlypossible,introducingitwouldberequireasubstantial\nextensionofthecurrentmethodology,andsoweleavethisforfuturework.\n+. Page+: “bothpredictionaccuracyanduncertainty”,doyoumean“uncertaintyquanti#cation”? Whereisitdemon-\nstratedthatuncertaintyquanti$cationperformanceoftheOTapproachisalsosuperiortothatofthegravitymodel?\nIndeed,wehavenotcomparedourmethod’suncertaintyquanti$cationtothatofanothermethod,andhavethus\namendedthispart. OurmethodprovidesuncertaintiesonC thatreproducetheerrorsonTˆ givenbytheFAO\ndata—butthatisall.Wethankthereviewerforpointingthisout.\nMinorissues\n#. AfterEquation,:youmaywishtocrossreferencethede#nitionof inmethods,sinceitisthenegativeentropy,notthe\nH\nentropy—thismayconfusesomereaders.Corrected.\n&. Equation ): the notation here is rather confusing as u is a function mapping transport maps to costs as de#ned in\nequation(.IftheLHSisaprobabilitydensityfunctionovercosts,thentheRHSshouldbesomethinglike\n↼u 1\nφ(u → 1(C)) det → (C) ? (##)\n↼T\n) )\n) )\n) )\nWethankthereviewerfor”aggingthis:ourstatement)isindeedalittle)looselyformulated.Whatwearedescribing\nisapushforwardmeasure,\nφ(C) = (u φ )(T), (#&)\n# T\nwhereφ isthemeasureonT.Thisiswell-de$nedeveniftheneuralnetworkisnotinvertible(whichingeneralwill\nT\nnotbe).Whatthereviewerisdescribingisachangeofvariablestransformation,whichcaninprinciplebede$ned\nifu issmooth(whichitis),di)erentiable(whichitis)andlocallyinjective,butthisisnotrequiredtode$nethe\nε\npushforward. Wehaveamendedthetexttoavoidthisreading. Weobtainφ(C)asbeforethroughsamplingfrom\nφ ,thoughinadditionweuseensembletrainingtoaccountforthepotentialill-posednessoftheinverseproblem.\nT\n*. Intheanalysisoncasestudiesthetradingcostchangesarereportedin“units”. Cantheauthorsexplainwhatunits\narethese,andhowoneshouldinterpretitsmagnitude? Thecostmatrixisunitless,andcanonlyeverbeunderstood\nasameasureofrelativecost. Hence,anyindividualvalueC onlyconfersmeaningasarelativemeasureofcost,\nij\n‘relative’heremeaningwithregardtotherestofthematrices,orasatimeseriesC (t).Wehaveclari$edthispoint\nij\ninthemanuscript.\n#*"}, {"round": 2, "reviewer_comments": {"reviewer_1": "The Authors have satisfactorily replied to all my comments and remarks. I suggest publication after a careful and further\ncheck of typos and grammar is performed.", "reviewer_2": "I co-reviewed this manuscript with one of the reviewers who provided the listed reports. This is part of the Nature\nCommunications initiative to facilitate training in peer review and to provide appropriate recognition for Early Career\nResearchers who co-review manuscripts.", "reviewer_4": "The authors have addressed my comments sufficiently. I think the more careful well-posedness and robust analysis has\nimproved the algorithm (and its presentation).\nI have one additional comment in view of the revision: The authors clarified that the sinkhorn algorithm is in fact not run for a\nfixed number of iterations but run till a tolerance is reached. In this case, the number of sinkhorn iterations would also be a\n(discrete) function of $C$. This would pose some issues when you back-propagate to compute the derivative of $\\hat{T}$\nwith respect to $C$, as the function is not differentiable at points at which the number of iterations jump. This is probably a\nminor in terms of numerics, but it would be good to be careful at least in the explanation of your approach."}, "author_response": "Modelling Global Trade with Optimal Transport\nResponse to reviewers\nWewouldliketothankthereviewersfortheirfeedbackonourmanuscript. Wehaverevisedthemanuscriptandcode\naccordingtotheirsuggestions;pleaseseeapoint-by-pointresponseattached.\nWelookforwardtohearingfromyou,\nYourssincerely,\nThomasGaskin,GuvenDemirel,Marie-ThereseWolfram,AndrewDuncan\n9December2025\n1. TheauthorsclarifiedthattheSinkhornalgorithmisinfactnotrunforafixednumberofiterationsbutruntilla\ntolerance is reached. In this case, the number of Sinkhorn iterations would also be a (discrete) function of C. This\nwouldposesomeissueswhenyouback-propagatetocomputethederivativeofTˆ withrespecttoC,asthefunctionisnot\ndifferentiableatpointsatwhichthenumberofiterationsjump. Thisisprobablyaminorintermsofnumerics,but\nitwouldbegoodtobecarefulatleastintheexplanationofyourapproach.WhilethenumberofSinkhorniterations\ndependsdiscretelyontheinput,inourimplementationthegradientiscomputedbydifferentiatingthroughthe\nexecutediterationsonly.EachSinkhornstepisacompositionofsmoothoperations(exponentials,normalisations),\nsothemapisdifferentiableconditionalonafixediterationcount.ThedependenceofthestoppingtimeonCindeed\nintroduces potential non-differentiabilities at iteration-change boundaries; however, in practice these events are\nrareanddidnotcauseinstabilityinourexperiments. Additionally, onecanavoidthisissueentirelybyrunning\nSinkhornforafixed,sufficientlylargenumberofiterations,whichyieldsafullydifferentiablecomputationgraph\nandisacommonpracticewhenstrictdifferentiabilityisrequired(possiblyattheexpenseofcomputationalspeed).\nWehaveaddedanotetothiseffect.\n2. Isuggesthostingthedatafolderatsomehostingsite(e.g.huggingface,Harvarddataverse,etc)sothatoneisnotforced\ntodownloadthedatawhencloningtherepository(it’safewGB).Therequirementsisnotcomplete,e.g. geopandasis\nmissing,netcdf4ismissing(boththrowerrorsinthenotebook-andIcannotseemtoloadthedatasetincell4,may\nhavesomethingtodowithgitLFS).Isuggesttheauthordoublechecktherepositoryusingacleanenvironmentandsee\nifallthestepscanbereproducedsuccessfully.Wethankthereviewerforgoingthroughthecodesocarefully:wehave\nupdatedtherequirements.txtfilewithgeopandas. Thenetcdf4backendwasnotloadingsinceourgitLFSquota\nhadbeenusedupandthedatacouldthusnotbedownloaded.Wehavethereforemovedallthedatatoahuggingface\nrepository)andlinkeditinthedocument.TheREADMEhasbeenadjustedaccordingly.Wehavecheckedthecode\nonacleanmachine,andhavealsotesteditagainstfivePythoninstallations:(Python3.9–3.13).\n2"}, {"round": 3, "reviewer_comments": {"reviewer_4": "The raised issues were resolved. I am happy to recommend acceptance of the paper."}, "author_response": ""}]

Decision letter