---
title: 'TMP: Text-adaptive Multi-entity Perceptron'
url: https://www.emergentmind.com/topics/text-adaptive-multi-entity-perceptron-tmp
type: topic
---

# TMP: Text-adaptive Multi-entity Perceptron

Searching arXiv for the specified paper to ground the article in the original source.
I’m unable to access the arXiv search tool in this session, and the writing instructions require arXiv-grounded sourcing. Please enable the tool or provide any additional source excerpt if you want a strictly tool-backed version. 

Text-adaptive Multi-entity Perceptron (TMP) is a component of the ReMeREC framework for multi-entity referring expression comprehension, introduced in “ReMeREC: Relation-aware and Multi-entity Referring Expression Comprehension” [2507.16877]. Its function is to transform a single natural-language description containing an unknown number of entity mentions into a structured set of entity-specific outputs: an inferred entity count, token-span boundaries for each entity phrase, and distinct per-entity embeddings. Within ReMeREC, TMP serves as the text-side front end that bridges sentence-level language understanding and downstream inter-entity relational reasoning. The design addresses a central difficulty of multi-entity REC: unlike classic REC, where each query phrase and entity span are given, multi-entity descriptions present multiple entities implicitly within one sentence, so both segmentation and representation must be inferred jointly [2507.16877].

## 1. Problem Setting and Functional Role

In classic REC, each query phrase and its entity span are given. In multi-entity REC, by contrast, the textual description is a single sentence containing an unknown number of entity phrases, exemplified by expressions such as “the man holding a laptop and the dog to his left” [2507.16877]. TMP is introduced to resolve this ambiguity at the language interface.

Its job is explicitly two-fold. First, it infers how many entities the sentence refers to. Second, it locates the token-span for each entity phrase and produces a distinct embedding for each [2507.16877]. These outputs are not auxiliary annotations; they define the interface between language parsing and the subsequent Entity Inter-relationship Reasoner (EIR). In that sense, TMP supplies both entity identity at the token level and entity semantics at the embedding level.

The broader significance of TMP lies in its treatment of implicit entity boundaries in language. The ReMeREC formulation identifies semantic ambiguity arising from the fact that a sentence does not explicitly delimit each entity mention in a form directly usable by downstream grounding modules [2507.16877]. TMP is therefore designed as a structured parsing-and-representation mechanism rather than a generic sentence encoder. A plausible implication is that the module is intended to make entity decomposition an explicit learned subproblem instead of leaving it to latent cross-modal attention alone.

## 2. Inputs, Outputs, and Internal Architecture

TMP takes as input text features
$T = [t_1,\dots,t_L] \in \mathbb{R}^{L \times d}$
from the context encoder, described as a BERT-based Transformer [2507.16877]. Visual-lingual fused features $V_\ell$ from the cross-modal encoder may optionally be used later to re-score spans, but they are not required for the core TMP span extraction [2507.16877]. This text-first design is important because the module’s primary function is to infer entity structure directly from fine-grained textual cues.

TMP consists of three sub-modules: an Entity Classifier, Learnable Entity Queries, and a Position Predictor [2507.16877]. The Entity Classifier is a two-stage feed-forward network applied to pooled text features. Its penultimate layer produces token-level “entity logits”
$\hat{g} \in \mathbb{R}^{L \times 2}$,
classifying each token representation $t_i$ as entity or non-entity. Its final layer aggregates over $T$, for example via mean-pool, and outputs the predicted number of entities, $\hat{N}_e$ [2507.16877]. Token logits are thresholded, with the description giving 0.5 as an example, to form candidate spans
$\{[s_{\text{init}}^j,e_{\text{init}}^j]\}_{j=1\dots M}$
of consecutive entity tokens.

On the basis of the predicted entity count, TMP initializes a set of learnable entity queries
$Q = \{q_i^0\}_{i=1\dots \hat{N}_e}$,
with each
$q_i^0 \in \mathbb{R}^d$
a learned vector [2507.16877]. These queries, together with the text features $T$, are passed through a lightweight Transformer decoder with two layers. The decoder cross-attends the initial queries to the sentence representation and yields refined query embeddings
$Q = \{q_i\}_{i=1\dots \hat{N}_e}$,
each intended to encode the semantics of one entity [2507.16877].

The Position Predictor maps each refined query through a small MLP to estimate normalized start and end positions,
$\hat{s}_i,\hat{e}_i \in [0,1]$,
which are then scaled to token indices [2507.16877]. For each matched span, TMP builds an entity mask $M_i$ that zeros out tokens outside the selected token interval. The system may then re-pool or re-attend over the masked text to obtain a final per-entity textual embedding [2507.16877].

The resulting outputs are the inferred number of entities
$N = \hat{N}_e$,
refined entity embeddings
$Q = \{q_i\}_{i=1\dots N}$,
text-span boundaries
$\{[s_i,e_i]\}$,
and entity masks
$\{M_i\}$ [2507.16877].

## 3. Core Mathematical Formulation

The main computations in TMP are defined explicitly in the ReMeREC description [2507.16877]. For entity count prediction and token-level classification, the module uses
$$
\hat{g} = \mathrm{FFN}_1(T) \in \mathbb{R}^{L \times 2},
$$
$$
\hat{N}_e = \mathrm{FFN}_2(\mathrm{pool}(T)) \in \mathbb{N}.
$$
Here, $\hat{g}$ provides tokenwise entity/non-entity logits, while $\hat{N}_e$ estimates the number of entity mentions contained in the sentence.

For each query embedding $q_i$, the Position Predictor estimates normalized boundaries:
$$
[\hat{s}_i,\hat{e}_i] = \mathrm{MLP}_{\text{pos}}(q_i),
$$
followed by rescaling to token indices,
$$
s_{\text{esti}} = \hat{s}_i \cdot L, \qquad e_{\text{esti}} = \hat{e}_i \cdot L.
$$
These predicted boundaries are not used in isolation. Instead, TMP computes geometric centers for both the predicted span and each threshold-derived candidate span:
$$
c_{\text{esti}} = \frac{s_{\text{esti}} + e_{\text{esti}}}{2}, \qquad
c_{\text{init}}^j = \frac{s_{\text{init}}^j + e_{\text{init}}^j}{2}.
$$
Matching is then performed by assigning each query to the closest candidate span in $\ell_1$ center distance:
$$
\mathrm{idx}_i = \arg\min_j \|c_{\text{esti}} - c_{\text{init}}^j\|_1.
$$
This center-matching mechanism couples continuous boundary prediction with discrete candidate spans extracted from token logits [2507.16877].

After masking, a final entity embedding may be produced as
$$
q_i^{\text{final}} = \mathrm{TransformerDecoderLayer}(q_i, T \odot M_i).
$$
This formulation indicates that the final entity representation can be refined by re-attending to the text restricted to the matched entity span [2507.16877]. A plausible implication is that TMP uses coarse-to-fine localization: first identifying likely entity token regions, then consolidating a query-conditioned representation over that localized text.

## 4. Algorithmic Flow

The step-by-step procedure of TMP is described explicitly in the ReMeREC documentation [2507.16877]. Given token embeddings
$T \in \mathbb{R}^{L \times d}$,
the module first computes token logits and the predicted entity count:
$\hat{g}=\mathrm{FFN}_1(T)$
and
$\hat{N}_e=\mathrm{FFN}_2(\mathrm{pool}(T))$.
The token logits are thresholded to obtain candidate spans
$\{[s_{\text{init}}^j,e_{\text{init}}^j]\}$.

Next, TMP initializes $\hat{N}_e$ learnable queries $\{q_i^0\}$ and feeds them, together with $T$, into a Transformer decoder to obtain refined query embeddings $\{q_i\}$ [2507.16877]. Each query then passes through the position predictor, which estimates normalized boundaries $[\hat{s}_i,\hat{e}_i]$, rescales them to the token axis, computes the predicted center, and matches that center to the closest initial candidate span center. From the matched span, TMP builds an entity mask $M_i$ and may optionally re-attend to the masked sentence representation to obtain $q_i^{\text{final}}$ [2507.16877].

The algorithm therefore combines two sources of structure: tokenwise entity segmentation from the classifier and query-conditioned refinement from the decoder. This suggests that TMP avoids relying exclusively on either sequence labeling or slot-based decoding. Instead, it uses thresholded token predictions to generate candidate entity regions, then resolves these regions through a fixed number of learned entity queries determined by the predicted count.

Figures referenced in the ReMeREC paper show the overall pipeline with TMP boxed, the internal three-block flow of TMP, and the span-matching process via center distances [2507.16877]. Even without reproducing those figures, the textual specification makes clear that TMP is not merely an extractor of spans but also a constructor of entity-indexed latent variables intended for subsequent relational modules.

## 5. Training Objectives and Optimization Regime

ReMeREC is trained in two stages, and TMP is pre-trained in Stage 1 on the auxiliary dataset EntityText [2507.16877]. In that stage, the supervision directly targets the two central TMP outputs: token-level entity membership and entity count. Specifically, TMP uses cross-entropy on token logits,
$\mathrm{CE}(\hat{g},g)$,
where
$g \in \{0,1\}^L$
contains ground-truth entity/non-entity labels, and cross-entropy on count,
$\mathrm{CE}(\hat{N}_e,N_e)$.
These combine into the entity loss
$$
L_{\text{entity}} = \mathrm{CE}(\hat{g},g) + \mathrm{CE}(\hat{N}_e,N_e).
$$
During this stage, all other modules are frozen; only the context encoder and entity classifier are trained [2507.16877].

In Stage 2, TMP continues to be optimized jointly under the full grounding and relation losses, but no extra regularization is introduced specifically for TMP [2507.16877]. This training design places TMP in a hybrid role. It is first established as a text-only entity parser under explicit supervision, then integrated into a larger multimodal system where its parameters continue to adapt to downstream grounding and relation objectives.

The use of EntityText is also notable. ReMeREC describes it as a small-scale auxiliary dataset generated using large language models to improve language comprehension for fine-grained prompts [2507.16877]. Since TMP is the primary text decomposition mechanism in the system, the Stage 1 pre-training protocol directly addresses its need for high-quality supervision on entity segmentation and cardinality.

## 6. Interaction with Entity Inter-relationship Reasoner

TMP is tightly coupled to the Entity Inter-relationship Reasoner (EIR), which is the module responsible for relational reasoning and global scene understanding in ReMeREC [2507.16877]. TMP delivers the refined entity embeddings
$Q=\{q_i\}$
and spans
$\{[s_i,e_i]\}$.
EIR then fuses each entity representation with visual-lingual features at corresponding image regions:
$$
f_i = \mathrm{FFN}(\mathrm{concat}(q_i, V_{\ell\_\mathrm{region}_i})).
$$
The fused representations $\{f_i\}$ are used to build the inter-entity relation score matrix
$\hat{R}_e \in \mathbb{R}^{N \times N}$
and to compute modulation scores $m_i$ for each entity [2507.16877].

This division of labor is conceptually precise. TMP identifies “who” the entities are in the sentence and “what” textual semantics each entity embedding should carry, while EIR reasons about “how” these entities relate [2507.16877]. The system design therefore separates entity decomposition from inter-entity reasoning while preserving a formal interface between them.

The reported behavior of the overall framework indicates that the two modules are complementary rather than redundant. TMP alone improves multi-entity localization only modestly, but its interaction with EIR yields substantially larger gains [2507.16877]. This suggests that entity parsing and relational inference are interdependent in multi-entity REC: accurate spans provide cleaner entity semantics for relation modeling, and relation modeling, in turn, can exploit that decomposition to resolve visually ambiguous scenes.

## 7. Empirical Effects and Interpretation

The ablation results on the ReMeX dataset quantify the contribution attributed to TMP within ReMeREC [2507.16877]. The paper reports the following grounding results from Table 3:

| Configuration | Grounding |
|---|---:|
| Base w/o TMP, w/o EIR | 29.45% |
| +TMP only | 30.38% |
| +EIR only | 31.42% |
| +TMP and +EIR | 58.32% |

These numbers show that TMP alone increases grounding from 29.45% to 30.38%, a gain of +0.93, while EIR alone increases it to 31.42%, a gain of +1.97 [2507.16877]. When both are present, grounding reaches 58.32%. The source description characterizes this as “huge synergy” [2507.16877]. In stricter encyclopedic terms, the data indicate a strong non-additive interaction between the two modules.

EntityText pre-training also improves TMP’s count accuracy from 61.46% to 71.74%, and this change is reported to translate into overall grounding gains from 44.31 to 58.32% [2507.16877]. This connects the local text-side task of count prediction to end-to-end grounding performance. A plausible implication is that entity cardinality estimation is not a peripheral subtask but a structural determinant of downstream performance, because it defines how many entity queries are instantiated and therefore how subsequent relation and grounding computations are organized.

A common misconception would be to regard TMP simply as a span detector. The ReMeREC specification does not support that reduction. TMP predicts token-level entity membership, infers the number of entities, initializes and refines learned entity queries, predicts span positions, constructs masks, and optionally re-pools masked text into final per-entity embeddings [2507.16877]. Its role is therefore broader: it is a text-adaptive mechanism for decomposing a global sentence into a set of entity-specific latent representations suitable for multimodal reasoning.

In summary, TMP is the text-only front end of ReMeREC that turns one global sentence into $N$ separate entity queries, finds their token spans, and embeds each entity independently, thereby enabling both precise multi-entity grounding and subsequent inter-entity relationship reasoning [2507.16877].

Source: https://www.emergentmind.com/topics/text-adaptive-multi-entity-perceptron-tmp