Skip to main content

Real architecture · Staff

QuintoAndar: H3 geographic embeddings at multiple resolutions

Connects the classic "proximity service" to recommendation.

18 min read · Source: QuintoAndar · Content reviewed on October 23, 2026

Short answer

Connects the classic "proximity service" to recommendation. The paper describes a housing search problem: with thousands of available properties per city, users struggle to find their ideal home.

01 · CONTEXT

Why location needs more than a neighborhood ID

The paper describes a housing search problem: with thousands of available properties per city, users struggle to find their ideal home.

The paper cites a survey of nearly 800 respondents, in which more than 50% of participants rank location as the most critical factor in the rental decision. Despite this clear preference, the authors state that the recommender recognized the importance of this concept suboptimally, even with access to several geographic features.

Two challenges arise. The first: the number of properties in each place is limited and unevenly distributed, which creates severe item sparsity when recommending within narrow geographic boundaries. The second: the search often goes beyond strictly adjacent neighborhoods, because renters frequently consider places that share key attributes, such as proximity to the beach, healthcare, and public transit, safety levels, and price ranges.

02 · THE INDEX

H3 as a geographic vocabulary

The paper uses H3 (Hexagonal Hierarchical Spatial Index), which converts latitude and longitude pairs into compact 64-bit hexagonal identifiers, at multiple resolutions. According to the paper, this gives a uniform grid that is consistent across neighboring cells, useful for multiscale geographic context.

ResolutionDescription in the paperApproximate cell size
Resolution 6Grossa~43 km2
Resolution 9Fina~0.01 km2

The authors' proposal is to integrate this hierarchical grid, at multiple levels, into a two-tower neural architecture.

03 · ARCHITECTURE

Two towers, location at multiple scales

As baselines, the paper uses a matrix factorization learned with ALS, whose only feature for each item is the resolution 9 cell, and a two-tower that embeds only the resolution 9 cell for locations and the user ID for users, each through an embedding layer and a few dense layers.

  1. The diagram starts with the property's location, which goes through a converter to hexagonal cells.

    Architecture diagram: Multi-scale location tower
    CLProperty locationentrada
    CLProperty city
    CPHexagonal cell convertercoordinates to cells
    CPCity embedding
    CPCell embedding, coarse scale
    CPCell embedding, medium-coarse scale
    CPCell embedding, medium-fine scale
    CPCell embedding, fine scale
    CPConcatenation and dense layers
    CPLocation embedding
    CPUser tower
    CPUser-location similarity
  2. In the multi-resolution model, the city has its own embedding layer and the H3 cells at resolutions 6, 7, 8, and 9 each have theirs.

    Architecture diagram: Multi-scale location tower
    CLProperty location
    CLProperty city
    CPHexagonal cell converter
    CPCity embeddingcity vector
    CPCell embedding, coarse scalecoarse scale
    CPCell embedding, medium-coarse scale
    CPCell embedding, medium-fine scale
    CPCell embedding, fine scalefine scale
    CPConcatenation and dense layers
    CPLocation embedding
    CPUser tower
    CPUser-location similarity
  3. The embeddings of the city and of all the cells are concatenated into one vector and refined by two fully connected layers with ReLU, resulting in the final location embedding.

    Architecture diagram: Multi-scale location tower
    CLProperty location
    CLProperty city
    CPHexagonal cell converter
    CPCity embedding
    CPCell embedding, coarse scale
    CPCell embedding, medium-coarse scale
    CPCell embedding, medium-fine scale
    CPCell embedding, fine scale
    CPConcatenation and dense layersrefina
    CPLocation embeddingoutbound
    CPUser tower
    CPUser-location similarity
  4. The user tower follows the same design as the single-resolution baseline, with the user ID as input.

    Architecture diagram: Multi-scale location tower
    CLProperty location
    CLProperty city
    CPHexagonal cell converter
    CPCity embedding
    CPCell embedding, coarse scale
    CPCell embedding, medium-coarse scale
    CPCell embedding, medium-fine scale
    CPCell embedding, fine scale
    CPConcatenation and dense layers
    CPLocation embedding
    CPUser toweruser
    CPUser-location similaritycomparison
ModelLocation inputHow it learns
Matrix factorizationOnly the resolution 9 H3 cellLatent factors learned with ALS
Two-tower, single resolutionOnly the resolution 9 H3 cellInfoNCE contrastive loss
Two-tower, multi-resolutionCity and H3 cells at resolutions 6, 7, 8, and 9InfoNCE contrastive loss

04 · TRAINING

Contrastive loss and in-batch negatives

The training data are user-property interactions collected on the platform from January 1, 2022 to December 31, 2024. Only high-intent events are included, such as scheduling a visit or making an offer; lower-intent signals, such as clicks, are left out.

  1. The models are trained on high-intent user-property interactions; in the diagram, these pairs arrive at the two towers, one for the user and one for the location.

    Architecture diagram: Batch contrastive training
    DBHigh-intent interactionspositive examples
    CPUser tower
    CPLocation tower
    CPBatch similarity matrix
    CPKnown-positives mask
    CPContrastive loss
  2. The vectors from the two towers are compared within the same batch, forming a similarity matrix.

    Architecture diagram: Batch contrastive training
    DBHigh-intent interactions
    CPUser tower
    CPLocation tower
    CPBatch similarity matrixin-batch comparison
    CPKnown-positives mask
    CPContrastive loss
  3. Training maximizes the similarity of the observed positive pairs and minimizes that of the negative pairs in the same batch, using a contrastive loss in the InfoNCE formulation.

    Architecture diagram: Batch contrastive training
    DBHigh-intent interactions
    CPUser tower
    CPLocation tower
    CPBatch similarity matrix
    CPKnown-positives mask
    CPContrastive losspulls together and pushes apart
  4. A mask avoids comparing user interactions with locations that are known positives but appear off the diagonal of the similarity matrix.

    Architecture diagram: Batch contrastive training
    DBHigh-intent interactions
    CPUser tower
    CPLocation tower
    CPBatch similarity matrix
    CPKnown-positives maskmask
    CPContrastive loss

The authors describe 32-dimensional embeddings, the Adam optimizer with a learning rate of 0.001, a batch size of 512, and training for 15 epochs.

05 · EVALUATION

Results and what they do not prove

  1. In the intrinsic evaluation, an embedding is created for each H3 cell observed in training and collapse-detection metrics are run over the entire set of vectors.

    Architecture diagram: Intrinsic and extrinsic evaluation
    DBEmbeddings of the observed cells
    NWCollapse metricschecks for collapse
    DBSimilar properties module logs
    CPAnchor-candidate similarity
    CPThreshold pruning
    CPOffline re-ranking simulation
    NWRent-flow rate
  2. In the extrinsic evaluation, the authors analyze one month of production logs from March 2025 for the similar properties module, an item-to-item recommender that shows homes similar to an anchor property.

    Architecture diagram: Intrinsic and extrinsic evaluation
    DBEmbeddings of the observed cells
    NWCollapse metrics
    DBSimilar properties module logshistorical logs
    CPAnchor-candidate similarity
    CPThreshold pruning
    CPOffline re-ranking simulation
    NWRent-flow rate
  3. Cosine similarity is computed between the anchor's embedding and each candidate's, and the recommendations below each threshold are progressively pruned.

    Architecture diagram: Intrinsic and extrinsic evaluation
    DBEmbeddings of the observed cells
    NWCollapse metrics
    DBSimilar properties module logs
    CPAnchor-candidate similaritysimilaridade
    CPThreshold pruningpoda
    CPOffline re-ranking simulation
    NWRent-flow rate
  4. The impact is measured by the rent-flow rate, which counts strong-intent actions, such as scheduling an in-person visit or sending a rental offer.

    Architecture diagram: Intrinsic and extrinsic evaluation
    DBEmbeddings of the observed cells
    NWCollapse metrics
    DBSimilar properties module logs
    CPAnchor-candidate similarity
    CPThreshold pruning
    CPOffline re-ranking simulation
    NWRent-flow ratebusiness metric

The single-resolution two-tower model increases information abundance by 158% (from 6.0 to 15.5) and the average simulated rent-flow uplift by 84% (from 3.2% to 5.9%). Adding the multi-resolution embeddings raises abundance by another 40% (from 15.5 to 21.7) and the uplift by another 85% (from 5.9% to 10.9%).

ModelInformation abundanceAverage simulated rent-flow uplift (%)
Matrix factorization6.03.2
Two-tower, single resolution15.55.9
Two-tower, multi-resolution21.710.9

The paper plots the singular value spectrum of the normalized covariance of each model's embeddings, and the multi-resolution model has the flattest decay; according to the paper, a slower decay in the log-spectrum indicates variance better distributed across the embedding dimensions.

As future work, the authors mention richer location attributes, such as distance to points of interest, including subway stations and police stations.

Frequently asked questions

What is QuintoAndar: H3 geographic embeddings at multiple resolutions?

Connects the classic "proximity service" to recommendation.

What does the QuintoAndar: H3 geographic embeddings at multiple resolutions design cover?

It is organized in these sections: Why location needs more than a neighborhood ID, H3 as a geographic vocabulary, Two towers, location at multiple scales, Contrastive loss and in-batch negatives, and Results and what they do not prove.

How long is QuintoAndar: H3 geographic embeddings at multiple resolutions and what level is it?

It takes about 18 minutes to read and is rated Staff level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.