Neural Entity Linking in JPMorgan Chase
Last Updated on August 2, 2022 by Editorial Team
Author(s): Harshit Sharma
Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.
Neural Entity Linking at JPMorganΒ Chase
JPMC published a paper in 2021 highlighting their approach to Entity Linking. This article summarizes the problem statement, solution, and other key technical components of theΒ paper
What is EntityΒ Linking?
It's the task of assigning a unique identity to ambiguous mentions of named entities in aΒ text.
Here, βParisβ from the text is given a unique identity via a URL (the most common type of URI) βwikipedia.org/wiki/Parisβ. Note that the type of URI used to identify the mentioned entity depends on the domain uniquely. For eg, Instead of a web address, we could have used ISBNs if we were to identify books from aΒ text.
JPMC was interested inΒ :
Mapping mentions of financial institutions from news articles to the entities stored in their internal knowledge base (stored as a Knowledge Graph)
An example is shownΒ below:
There are two sub-problems that must beΒ defined:
- Recognition:
Extraction of mentions from financial news articles. JPMC has used Spacy forΒ this. - Linking:
Choosing the correct entity from the internal Knowledge Graph to be linked to the extracted mentions in the previous step. The paper discusses thisΒ step.
A pictorial representation of this is shownΒ below:
- String Matching
These approaches capture the βmorphologicalβ structure of the entity names. The team experimented with
(a) Jaccard
(b) Levenshtein
(c) Ratcliff-Obershelp (also known as Gestalt-Pattern-Matching)
(d) Jaro Winkler
(e) N-Gram Cosine Similarity
The con of these approaches is that they focus just on the βsyntacticsβ of the names and not the semantics. An example of a failure case would be the matching of βLumierβ and βLumierβ. Even though they are exactly the same, they refer to two different entities.
2. Context Similarity Methods
These methods take the contexts around mentions and entities to give a similarity score.
The Context for βmentionβ is text to the left and right of the mention, whereas
the Context for βentityβ is all the data that's stored in the KG for this entity.
Finally, Cosine similarity / Jaccard similarity can be used on top of the contextΒ vectors.
3. ML Classification
Naive Bayes, Logistic Regression, and SVM are trained on (mention, entity) pairs to find the ones that should beΒ linked
4. Learn to Rank Methods (LTR)
These models work in tandem with ML approaches, which might give us multiple (mention, entity) pairs as the solutions. LTR approaches just narrow down to the most probable solution.
The idea is to capture both Semantic distance(the meaning that the mention or entity stands for) and Syntactic distance (character composition of the name) between the names and use a contrastive loss function to train aΒ model.
We will see below how both of these distances are calculated step byΒ step.
Step 1: Obtain embeddings for Entities andΒ Mentions
To come up with both of the distances, the authors have proposed to use embeddings for mentions as well as entities in theΒ KG.
To obtain Entity embeddings, the authors have used a Triplet Loss function (shownΒ below)
For each entity, they used 10 positive and 10 negative samples, making 10 <entity, positive word, negative word> triplets.
Unlike Entity embeddings, which they had precomputed, the mention embeddings were trained using the on-the-go embeddings approach, where the embedding matrix is learned during the trainingΒ itself.
Step 2: Calculate Syntactic DistanceΒ score
Before going further, it's worth mentioning βWide & Deepβ architecture which was introduced by Google in 2016. You can find their official blog here. We wonβt go into the details, but to give a summary, it's an architecture that has two componentsβββThe Wide component and the Deep component.
Syntactic Distance score calculation is done using the WIDE part, which consists of a Linear SiameseΒ Network.
The output of the siamese network is the vectors for both the entity and the mention, which are then compared to find the Euclidean distance.
Step 3: Calculate Semantic DistanceΒ score
Semantic Distance score calculation is done using the DEEPΒ part
eβ is the pre-trained embedding for the βApache Corpβ that was calculated in Step 1. To obtain the embedding for the mention, its left and right context words are fed into a Bi-LSTM network that trains the embeddings. The embedding vectors of mention (Vβ) and the entity (Vβ) are then used to find the Euclidean distance:
Step 4: Compute Contrastive Loss
Both Syntactic and Semantic distances are combined in a weighted fashion asΒ follows:
The contrastive loss function is then combined asΒ follows:
where Y is the ground truth value, where a value of 1 indicates that mention m and entity e are matched, 0 otherwise.
Combining all the pieces, the final model framework is shownΒ below:
At the time of writing this paper, JPMC was still in the process of deploying the model, which, once done, will help support users across JPMC in discovering relevant and curated news that matters to their business.
From the cost perspective, not all the mentions are fed through the JEL framework as that would be computationally expensive. JPMC has put another blocking layer to funnel out the mentions that share less than 2 bigrams with the entities from their internalΒ KGs.
Once again, here is the paper link if you would like to read the fullΒ paper.
Follow Intuitive Shorts (my Substack newsletter), to read quick and intuitive summaries of ML/NLP/DS concepts.
Neural Entity Linking in JPMorgan Chase was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.
Join thousands of data leaders on the AI newsletter. Itβs free, we donβt spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.
Published via Towards AI