# A Dual-Enhanced Hierarchical Alignment Framework for Multimodal Named Entity Recognition
## 3 Methodology
### Dual-Enhanced Hierarchical Alignment (DEHA)
#### 3.2.2 Multi-Scale Spatial Local Contrast (MS-SLC)  
Although Semantic-Augmented Global Contrast (SAGC) alleviates cross-modal semantic deviation through knowledge injection, its global feature-based alignment is vulnerable to visual noise (such as background advertisements and irrelevant objects) and struggles to capture fine-grained entity-region associations. To address this, we propose a collaborative optimization framework with Multi-scale Spatial Local Contrast (MS-SLC); while global SAGC establishes modal consistency in a low-dimensional space to achieve semantic alignment, local MS-SLC leverages high-resolution features to preserve detail discriminability for boundary localization, thereby forming a complementary mechanism. Furthermore, the global module prevents overfitting by enforcing semantic consistency constraints, whereas the local module corrects global underfitting through maximum similarity-based spatial semantic validation, ultimately establishing a dynamic global-local coordination mechanism. As illustrated in Figure 4, MS-SLC dynamically selects the visual hierarchy most relevant to text tokens via multi-scale gating and employs a maximum similarity criterion to achieve noise filtering and fine-grained alignment. Figure 4: Multi-scale Spatial Local Contrast (MS-SLC) module in the DEHA framework for MNER. Specifically, we first perform multi-scale gated feature selection to obtain the association weights between each augmented semantic text \(t_{i}\) (as defined in Equation (4)) and each level of the visual pyramid, computed as  
\[a_{g}^{i}=\frac{\exp(W_{g}[t_{i};V_{g}])}{Z},\quad\alpha_{r}^{i}=\frac{\exp(W_{ r}[t_{i};V_{r}])}{Z},\quad\alpha_{l}^{i}=\frac{\exp(W_{l}[t_{i};V_{l}])}{Z}, \tag{8}\]  
where \(W_{g},W_{r},W_{l}\in\mathbb{R}^{2d\times 1}\) are learnable parameters and \(Z=\exp(W_{g}[t_{i};V_{g}])+\exp(W_{r}[t_{i};V_{r}])\)\(+\exp(W_{l}[t_{i};V_{l}])\) is the normalization factor. The visual level corresponding to the maximum weight is then selected as \(V^{*}\in\{V_{g},V_{r},V_{l}\}\); for example, entity nouns preferentially associate with region-level features \(V_{r}\) (e.g., \"apple\" matching the detected apple region), whereas adjectives associate with pixel-level texture features \(V_{l}\) (e.g., \"red\" corresponding to a color distribution). Next, we focus on key regions through maximum similarity to match each text token with the most relevant local visual feature, thereby enhancing fine-grained alignment. Within the selected level \(V^{*}\), we compute the maximum similarity between \(t_{i}\) and all visual features as  
\[s_{i}^{\text{local}}=\max_{v\in V^{*}}\frac{t_{i}\cdot v}{\lVert t_{i}\rVert \lVert v\rVert}, \tag{9}\]  
This maximization ensures that each text token aligns only with the most relevant visual region, after which a dynamic mask is generated to construct an adaptive noise filtering mechanism that counteracts global noise, defined as  
\[M_{i}(v)= \begin{cases}1,&\text{if }\frac{t_{i}\cdot v}{\lVert t_{i}\rVert \lVert v\rVert}\geq\beta\cdot s_{i}^{\text{local}},\\ 0,&\text{otherwise},\end{cases}  \tag{10}\]  
where \(\beta\in[0,1]\) is a relaxation threshold (set to 0.6 in our experiments) that retains features with similarity close to the maximum. We then define the local contrastive loss function as  
\[L_{\text{MS-SLC}}=-\frac{1}{n}\sum_{i=1}^{n}\log\frac{\sum_{v\in V^{*}}M_{i}(v) \cdot\exp\Bigl{(}\frac{\text{sim}(t_{i}\cdot v)}{\eta}\Bigr{)}}{\sum_{v^{ \prime}\in V_{\text{all}}}\exp\Bigl{(}\frac{\text{sim}(t_{i}\cdot v^{\prime} )}{\eta}\Bigr{)}}, \tag{11}\]  
where \(V_{\text{all}}=V_{g}\cup V_{r}\cup V_{l}\) is the set of all visual features encompassing features from all levels (both positive and negative samples), with an explicit distinction between \(v\) (features from the selected level) and \(v^{\prime}\) (all features), \(\text{sim}(t_{i},v)=\frac{t_{i}\cdot v}{\lVert t_{i}\rVert\lVert v\rVert}\) is the cosine similarity, and \(\eta\) is the temperature coefficient controlling the sharpness of the similarity distribution (default 0.1).