April 15, 2024
Pinterest Engineering
Pinterest Engineering Blog

Adopted by Pinterest a number of person dealing with surfaces, Adverts, and Board.

Jianjin Dong | Workers Machine Studying Engineer, Content material High quality; Michal Giemza| Machine Studying Engineer, Content material High quality; Qinglong Zeng | Senior Engineering Supervisor, Content material High quality; Andrey Gusev | Director, Content material High quality; Yangyi Lu | Machine Studying Engineer, Dwelling Feed; Han Solar | Workers Machine Studying Engineer, Adverts Conversion Modeling; William Zhao | Software program Engineer, Boards Basis, Jay Ma | Machine Studying Engineer, Adverts Light-weight Rating

LinkSage: Graph Neural Community based mostly mannequin for Pinterest off-site content material semantic embeddings

Pinterest is the visible inspiration platform the place Pinners come to look, save, and store the most effective concepts on this planet for all of life’s moments. Many of the Pins are linked to off-site content material to offer Pinners with inspiration and actionability. It’s essential to grasp off-site content material (pictures, textual content, construction), as a result of understanding their semantics is a vital consider assessing how secure (e.g. community guidelines), useful, related, and actionable (e.g. Adverts and Buying) the off-site content material is. Extra importantly, Pinterest can have a greater understanding of Pinterest customers by means of customers’ click on by means of occasions. Each of the above can enhance general engagement and monetization of Pinterest contents. To realize it, we developed LinkSage, which is a Graph Neural Network (GNN) based mostly mannequin that learns the semantics of touchdown web page contents.

Determine 1: Off-site content material understanding and its purposes

To make full use of Pinterest off-site content material to enhance Pinners’ engagement and purchasing expertise, we established the next objectives:

  • Unified semantics embedding: Present a unified semantic embedding of all of the Pinterest off-site content material. All of the touchdown pages associated to downstream fashions can leverage LinkSage embedding as a key enter.
  • Graph based mostly mannequin: Leverage the Pinner’s curation information to construct a heterogeneous graph that helps several types of entities. The GNN can study from close by touchdown pages/nodes to enhance accuracy.
  • XSage ecosystem: Make the LinkSage embedding appropriate with all of the XSage embedding house.
  • Multi-dimensional illustration: Present a multi-dimensional illustration of the LinkSage embedding so customers would have a flexibility of selecting efficiency vs price.
  • Impression on engagement and monetization: Enhance each engagement (e.g. lengthy clicks) and purchasing/adverts expertise (e.g. CVR) by means of a greater understanding of Pinterest content material and Pinner profile.

On this weblog, we contact on:

  • Technical design
  • Key improvements
  • Offline outcomes
  • On-line outcomes


Most Pins are related to a touchdown web page. We deal with “(Pin, touchdown web page):” as a constructive pair if the Pin and its related touchdown web page have related semantics, and we leverage Pinterest Cohesion ML sign to judge the semantic similarity between a Pin and its touchdown web page. We additionally label a “(Pin, touchdown web page)” pair as constructive if the Cohesion rating is increased than a sure threshold.

For damaging pairs, we embrace each batch and random negatives. Within the case of batch negatives, we use Pins which might be paired with different touchdown pages in the identical batch. Within the case of random negatives, we use random Pins throughout Pinterest, which will not be seen within the constructive pairs. This helps to coach a mannequin generic to new contents.

Within the latter model of LinkSage, we’d leverage Pinner onsite engagement information and Pinner off-site conversion information to complement our coaching targets.


We leverage Pinner’s curated information to construct the graph. Graph compilation and random stroll is performed utilizing Pinterest XPixie, which helps heterogeneous graphs of several types of entities. In our case, a heterogeneous graph is constructed by utilizing “(Pin, touchdown web page)” pairs. We leverage Pinterest Cohesion ML sign to filter out non-cohesive pairs, just like coaching information technology. Thus, all of the “(Pin, touchdown web page)” pairs used within the graph have related semantics. To extend the graph density, we leverage Pinterest Neardup ML sign to cluster related Pin pictures to a picture cluster. Graph pruning is completed on each graph nodes and edges to make sure graph connections are usually not skewed on sure fashionable touchdown pages or Pins. On this graph, touchdown pages with related semantics are linked with Pins which might be cohesive to the touchdown pages.

After the random stroll, for every touchdown web page, we get a listing of its neighbor touchdown pages and their go to counts. Random stroll is configurable based mostly on the node entity sort.

In our latter model, we absolutely make the most of the heterogeneous graph characteristic of XPixie that we add extra several types of entities, together with Pinterest Boards and hyperlink clusters.


There are three kinds of options: self touchdown web page options, neighbor touchdown web page options, and graph construction options.

For each self touchdown pages and neighbor touchdown pages, we use two kinds of content material options: touchdown web page textual content embedding (which summarize the semantics of title, description, principal physique textual content), and visible embedding of every crawled picture. We carry out a weighted aggregation of all of the crawled pictures by their measurement to scale back the calculation whereas holding the principle crawled pictures’ info of the touchdown pages.

For graph construction options, we use graph node go to counts and self diploma to symbolize the topological construction of the graph. Graph node go to counts symbolize the significance of the neighbor touchdown pages, whereas self diploma represents the recognition of the self touchdown web page within the graph.


The mannequin leverages a Transformer encoder to study the cross consideration of self touchdown web page options, neighbor touchdown web page options, and graph construction options.

The textual content and crawled picture options are cut up within the transformer encoder to let the mannequin study the cross consideration of them. The neighbors are reverse sorted by the visited counts so the highest neighbors can be extra necessary than the underside ones. Along with place embeddings, our mannequin can study the significance of various neighbors. The variety of neighbors is chosen to stability computational price and mannequin efficiency.

Within the latter model, we cut up crawled pictures and deal with them as separate tokens within the transformer encoder, which would supply the mannequin with extra correct visible info of the touchdown pages.

Determine 2: Mannequin schematics of LinkSage

Multi-dimensional illustration

Downstream groups would devour totally different dims of embedding based mostly on their choice between efficiency and computational price. As a substitute of coaching 5 totally different fashions individually, we leverage the analysis of Matryoshka Representation Learning to offer 5 dims of LinkSage in place by coaching one mannequin. Shorter dims would seize a rough illustration of the touchdown pages, and extra particulars are embedded within the longer ones.

Determine 3: Schematic of the loss operate of multi-dimensional illustration

Compatibility of XSage

The compatibility of the embedding house between LinkSage and XSage (e.g. PinSage) would make the downstream utilization simpler. Downstream groups may even use proximity in embedding house to match the similarity of various contents throughout Pinterest, like Pins and their touchdown pages. To realize this, we leverage PinSage because the illustration of the Pins in our coaching goal.

Incremental serving

Pinterest has tens of billions of touchdown pages related to Pins. To serve all of the touchdown pages, it might take an enormous quantity of computational price and time. To resolve it, we apply incremental serving that we solely run serving of each day crawled touchdown pages. After each day inference, we merge in the present day’s inference outcomes with the earlier ones. Our incremental serving not solely saves a considerable amount of pointless computations but additionally retains the identical accuracy and protection as the total corpus serving.


Recall is essentially the most generally used metric for rating duties. When given a question touchdown web page, it evaluates how good the mannequin can retrieve the constructive candidate Pins amongst all of the negatives. Larger recall means a greater mannequin.

Desk 1: Recall of LinkSage throughout totally different serving dimensions.

From the desk above, by utilizing 256 dims of LinkSage, the likelihood of fetching the constructive candidate Pins is 72.9% from the highest 100 rating outcomes. Through the use of 64 dims of it, it saves 75% of the fee and the efficiency solely drops by 8.3%.

Rating distribution

Rating distribution is plotted to point out the distribution of cosine similarity scores between (1) question touchdown web page and constructive candidate Pins, and (2) question touchdown web page and damaging candidate Pins

Determine 4: Rating distribution of LinkSage constructive and damaging pairs

From the histogram beneath, nearly all of the damaging pairs have a rating < 0.25 and the imply worth is near 0. Alternatively, greater than 50% of the constructive pairs have a rating > 0.25.


Kurtosis is used to judge the power of the embedding to differentiate between totally different touchdown pages.

For embedding pairwise cosine similarity distribution, a smaller kurtosis is preferable as a result of a wide-spread distribution tends to have higher “decision” to differentiate between queries (aka touchdown pages) of various relevance.

The Kurtosis of LinkSage is 1.66.

Determine 5: Kurtosis evaluation of LinkSage


Given a touchdown web page, the highest okay ranked Pins will be fetched and visualized to examine whether or not the touchdown web page and Pins have related semantics.

We launched A/B experiments in a number of person dealing with surfaces, Adverts, and Boards.

Consumer dealing with surfaces

A number of person dealing with floor groups have adopted LinkSage into their rating mannequin to enhance the understanding of each candidate Pins and person profiles (by means of Consumer Sequence).

On Pinterest, “repin, lengthy click on, engaged classes” are the important thing indicators of constructive person engagement. Alternatively, “disguise” is the important thing indicator of damaging person engagements on the platform. We noticed important positive factors on all of the metrics.

Desk 2: LinkSage positive factors on person dealing with floor rating mannequin: from candidate Pins (high) and person sequence (backside)


Adverts has adopted LinkSage into their Conversion rating mannequin and Engagement rating mannequin.

On Pinterest Adverts, conversion rate per impression (iCVR), conversion quantity, lengthy click through rate (GCTR30), and cost per click (CPC) are the important thing indicators of person conversion and engagement. We noticed important positive factors on all of the metrics.

Desk 3: Mixed positive factors with LinkSage on Adverts conversion (high) and engagement rating mannequin (backside)


LinkSage use within the Boarding rating mannequin (or known as Board Picker) has improved the understanding of exterior hyperlinks. Important positive factors have been noticed:

Desk 4: LinkSage positive factors on Board rating mannequin

We developed LinkSage, a Graph Neural Community-based mannequin, which is skilled utilizing a heterogeneous graph that helps several types of entities (e.g. Pins and touchdown pages). It leverages Pinner curated information to construct the graph and coaching targets. It makes use of Pinterest ML alerts (e.g. Cohesion and Neardup) to prune the graph/goal and enhance the graph density. It incorporates Pinterest ML alerts (e.g. PinSage) into coaching to make its embedding house appropriate with XSage. It applies innovative analysis of Matryoshka Illustration Studying to offer multi-dimensional illustration. It applies incremental serving to serve all of the Pinterest touchdown pages corpus with a low computational price and time.

We comprehensively evaluated the standard of LinkSage embeddings with offline metrics and on-line A/B experiments on floor rating fashions. We’ve got seen substantial on-line positive factors throughout a number of person dealing with surfaces, Adverts, and Board, which covers all the important thing surfaces of Pinterest.

This work fills the clean of all of the Pinterest off-site content material understanding. It supercharges the backend of all the opposite touchdown pages alerts’ growth (e.g. Hyperlink High quality). It enriches Pinterest’s understanding of Pins, Pinterest customers, and powers the way forward for adverts and purchasing at Pinterest.

In case you are involved in such a work we do, be a part of Pinterest!

Within the latter model of LinkSage, we’d enhance the graph technology, characteristic engineering, and mannequin structure. We’d incorporate extra Pinterest entities within the heterogeneous graph to extend graph density. We’d cut up crawled pictures as separate enter to the transformer’s encoder to scale back info dilution. We’d discover FastTransformer to save lots of computation time and value.

Along with batch serving, we’d set up a Close to Actual Time (NRT) infrastructure to serve LinkSage in actual time. Pinterest has leveraged Apache Flink for NRT serving; for instance, NRT Neardup efficiently reduces the latency to sub-seconds as a substitute of hours. We’d set up an analogous streaming pipeline to extend the protection of recent contents with out compromising accuracy.

Contributors to LinkSage growth and adoption:

  • ATG (GraphSage framework)
  • Search Infrastructure (XPixie)
  • Dwelling Feed
  • Adverts Conversion
  • Content material Curation
  • Notification
  • Search
  • Associated Pins
  • Adverts Sign
  • Adverts Engagement
  • Adverts Relevance

To study extra about engineering at Pinterest, take a look at the remainder of our Engineering Weblog and go to our Pinterest Labs web site. To discover and apply to open roles, go to our Careers web page.