Two inputs, one learned rule
Write the encoder as , where is its single parameter set. For inputs and , an example comparison is Euclidean distance:
The multiplier 2 is applied twice; there are no separate left and right multipliers. This toy demonstrates parameter sharing and distance computation. It has learned no semantic meaning, and 4 has no universal interpretation as “similar” or “different.”
What the training pairs ask it to preserve
Similar pairs are penalised for being apart. Dissimilar pairs are penalised only inside the margin. Their paper describes summing the gradient contributions from both branches to update the shared parameters. Labels in other implementations may reverse this convention; check the loss before assigning them.
For the fixed toy distance 4 and an illustrative margin 5, the loss would be 8 if the pair were labelled similar, or 0.5 if labelled dissimilar. These are alternative labels for the same calculation, not simultaneous training labels. This loss alone does not require dissimilar distances to grow indefinitely. Training only by bringing similar pairs together admits collapse: a constant encoder puts every input at the same point.
In a disclosure-matching application, positive pairs might be independently labelled descriptions of the same event type. Negative pairs should include plausible confusions, such as two passages sharing accounting vocabulary but describing different events. This is a proposed research use: shared weights do not establish that the labels capture an economically useful distinction.
Split the underlying records before making pairs
A held-out pair can still contain a document already used in training, or a near duplicate of it. Randomly splitting a prebuilt pair table can therefore test familiarity with its components. Separate underlying records first, then construct training pairs within the training partition. If the claim concerns unseen issuers or identities, keep those groups separate too; allowing the same issuer in both periods answers a different generalisation question.
Finally, evaluate the intended decision. A small distance is a comparison under the fitted representation. It is not automatically a calibrated probability, proof that two events have the same economic consequences, or evidence of a profitable signal.
Sources
- Jane Bromley and co-authors, “Signature Verification Using a ‘Siamese’ Time Delay Neural Network” (1993), §4: paired branches constrained to identical weights.
- Sumit Chopra, Raia Hadsell and Yann LeCun, “Learning a Similarity Metric Discriminatively, with Application to Face Verification” (2005), §§1–2: shared mapping, symmetric comparison and verification for previously unseen identities.
- Raia Hadsell, Sumit Chopra and Yann LeCun, “Dimensionality Reduction by Learning an Invariant Mapping” (CVPR 2006; author manuscript dated November 2005), §§2.1 and 3.1: contrastive-loss labels, margin, collapse and shared-parameter training.
- scikit-learn, “Common pitfalls and recommended practices”, §§12.1–12.2: consistent preprocessing, splitting first and training-only fitting.