[Paper Review] Relaxed Earth Mover's Distances for Chain- and Tree-connected Spaces and their use as a Loss Function in Deep Learning
This paper proposes a relaxed, numerically stable Earth Mover's Distance loss (EMD²) for chain- and tree-structured output spaces, enabling efficient gradient computation via closed-form solutions. It demonstrates superior performance over cross-entropy and Sinkhorn Distance in low-data regimes, achieving higher Top-1 accuracy on ImageNet with only 50K images by better leveraging hierarchical output structure.
The Earth Mover's Distance (EMD) computes the optimal cost of transforming one distribution into another, given a known transport metric between them. In deep learning, the EMD loss allows us to embed information during training about the output space structure like hierarchical or semantic relations. This helps in achieving better output smoothness and generalization. However EMD is computationally expensive.Moreover, solving EMD optimization problems usually require complex techniques like lasso. These properties limit the applicability of EMD-based approaches in large scale machine learning. We address in this work the difficulties facing incorporation of EMD-based loss in deep learning frameworks. Additionally, we provide insight and novel solutions on how to integrate such loss function in training deep neural networks. Specifically, we make three main contributions: (i) we provide an in-depth analysis of the fastest state-of-the-art EMD algorithm (Sinkhorn Distance) and discuss its limitations in deep learning scenarios. (ii) we derive fast and numerically stable closed-form solutions for the EMD gradient in output spaces with chain- and tree- connectivity; and (iii) we propose a relaxed form of the EMD gradient with equivalent computational complexity but faster convergence rate. We support our claims with experiments on real datasets. In a restricted data setting on the ImageNet dataset, we train a model to classify 1000 categories using 50K images, and demonstrate that our relaxed EMD loss achieves better Top-1 accuracy than the cross entropy loss. Overall, we show that our relaxed EMD loss criterion is a powerful asset for deep learning in the small data regime.
Motivation & Objective
- To address the computational and numerical instability issues of Sinkhorn Distance (SD) in deep learning, particularly due to its ℓ₁ behavior and floating-point precision limitations.
- To derive closed-form gradients for Earth Mover's Distance (EMD) in chain- and tree-connected output spaces, enabling efficient backpropagation.
- To propose EMD², a relaxed EMD variant with ℓ₂ behavior that converges faster and is more numerically stable than SD.
- To evaluate the effectiveness of EMD² as a loss function in low-data deep learning settings, especially for hierarchical classification tasks.
- To demonstrate that modeling output space structure via EMD² improves generalization and Top-1 accuracy when training data is limited.
Proposed method
- Derives closed-form solutions for the EMD gradient in chain-connected output spaces (e.g., histograms) using dynamic programming or recursive decomposition.
- Extends the closed-form gradient derivation to tree-connected output spaces (e.g., WordNet, ImageNet hierarchies) by exploiting tree structure and flow conservation.
- Proposes EMD² as a relaxed version of EMD with ℓ₂ regularization, enabling faster convergence and improved numerical stability compared to ℓ₁-based SD.
- Uses the analytical gradient of EMD² in backpropagation, avoiding iterative solvers and enabling end-to-end training in deep networks.
- Employs a hierarchical output space representation (e.g., WordNet) to encode semantic relationships between classes in image classification.
- Combines EMD² with cross-entropy loss in a 1:1 ratio to balance fast convergence and holistic output space optimization.
Experimental results
Research questions
- RQ1Can closed-form gradients for EMD be derived in chain- and tree-connected output spaces to enable efficient deep learning training?
- RQ2Does a relaxed EMD variant (EMD²) with ℓ₂ behavior improve convergence speed and numerical stability compared to ℓ₁-based Sinkhorn Distance?
- RQ3In low-data regimes, does incorporating hierarchical output structure via EMD² lead to better generalization and higher Top-1 accuracy than standard cross-entropy loss?
- RQ4How does EMD² compare to combined loss strategies (e.g., SD + CE) in terms of stability and performance on large-scale hierarchical classification?
- RQ5What are the root causes of numerical instability in Sinkhorn Distance when used in deep learning with float32 precision?
Key findings
- On the ImageNet dataset with only 50,000 training images (4% of full set), EMD² achieved higher Top-1 accuracy than cross-entropy loss, demonstrating improved generalization in low-data regimes.
- The combination of EMD² and cross-entropy (1:1) achieved the fastest convergence and highest Top-1 accuracy, outperforming both individual losses and SD+CE combinations.
- EMD² showed faster convergence and lower error in a respiratory signal PSD prediction task with chain-connected outputs, confirming its efficiency in structured prediction.
- Sinkhorn Distance (SD) exhibited numerical instabilities in float32 precision, especially in large output spaces, limiting its practical use in deep learning despite its popularity.
- The EMD² loss optimized the entire output vector holistically, leading to better learning of hierarchical relationships, even when Top-1 accuracy improved more slowly than with cross-entropy.
- In full-data settings (1.28M images), EMD² did not outperform cross-entropy, confirming that hierarchical structure only provides benefit when data is scarce and generalization is critical.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.