G eo I ndia: A S eq2 S eq Geocoding Approach for I ndian Addresses (2024)

Abstract: Geocoding, the conversion of unstructured geographic text into structured spatial data, is essential for logistics, urban planning, and location-based services. Indian addresses with their diverse languages, scripts, and formats present significant challenges that existing geocoding methods often fail to address, particularly at fine-grained resolutions. In this paper, we propose GeoIndia, a novel geocoding system designed specifically for Indian addresses using hierarchical H3-cell prediction within a Seq2Seq framework. Our methodology includes a comprehensive analysis of Indian addressing systems, leading to the development of a data correction strategy that enhances prediction accuracy. We investigate two model architectures, Flan-T5-base (T5) and Llama-3-8b (QLF-Llama-3), due to their strong sequence generation capabilities. We trained around 29 models with one dedicated to each state, and results show that our approach provides superior accuracy and reliability across multiple Indian states, outperforming the well-renowned geocoding platform Google Maps. In multiple states, we achieved more than an 50% reduction in mean distance error and more than a 85% reduction in 99th percentile distance error compared to Google Maps. This advancement can help in optimizing logistics in the e-commerce sector, reducing delivery failures and improving customer satisfaction.

## introduction the rise of e-commerce has transformed the way we shop, offering unmatched convenience and a vast array of products at our fingertips. however, the smooth online shopping experience relies on a complex logistics network that ensures timely, efficient, and reliable delivery. geocoding plays a 1 https://www.uber.com/en-in/blog/h3/ 2 https://www.google.com/maps crucial role in this process. it helps in planning the logistics network, from selecting facility locations and assigning hubs or distribution centers to planning delivery routes. by ensuring timely deliveries, geocoding not only enhances the customer experience but also reduces failed deliveries and rto foot_0 , a financial threat to the e-commerce industry. building a geocoder for indian addresses presents unique challenges not typically encountered in other countries. unlike western countries with standardized addressing systems, indian addresses are highly diverse and lack uniformity. for example: in contrast to the simplicity of addresses like "10 downing street" in the uk, indian addresses can be significantly more complex. consider the example: "xx foot_1 , palasi mohania village madarsa chowk rto jama masjid araria bihar, 854333, purnia". here, it is challenging to discern that "palasi mohania" is intended as a locality, "madarsa chowk" and "rto jama masjid" as potential landmarks, "araria" as the municipality within the city of "purnia", and "854333" as the postal code. this complexity is compounded by the use of various regional terms like street, main/cross, colony, and more, which vary significantly among states and regions. the traditional use of addresses in india was relatively informal until the advent of e-commerce in the early 2000s. previously, addresses were shared verbally or handwritten for postal deliveries, often including landmarks to guide the recipient. however, entering these addresses into digital systems for online shopping has highlighted the inconsistencies inherent in indian addresses. several factors contribute to the difficulty of geocoding in india: lack of standardization: there is no standardized format for addresses across india. each state and even different regions within states use varied terminologies and structures, making it challenging to develop a one-size-fits-all geocoding solution. for example, an address in mumbai might be written as "flat no. xx, building no. 5, xx society, andheri west, mumbai, maharashtra, 400053" which includes specific details about the building and locality. in contrast, an address in a rural area of tamil nadu might be "house no. xx, near big temple, thanjavur district" which relies more on prominent local landmarks. inconsistent address formatting: addresses may be written in various orders, with elements like the state, pincode, or house number appearing in different sequences. for example, an address in chennai might be written as "no. xx, 2nd cross street, besant nagar, chennai -600090, tamil nadu" while another in the same city could be "besant nagar, xx, 2nd cross street, chennai -600090, tamil nadu". incomplete and erratic data: addresses often lack key components or contain errors, such as misspellings and incorrect locality or street names. for example, the locality "daharahara chawk" can be misspelled as "dharhara chowk". reliance on landmarks: many addresses in india use informal descriptions and landmarks, like "near the big banyan tree" or "behind the supermarket" which are not standardized and can be ambiguous. this is especially prevalent in rural areas, making them difficult to incorporate into a geocoding model. traditionally, geocoding has been addressed using rule-based and heuristic strategies. however, recently, kothari et al. @xcite and @xcite formulated geocoding as a seq2seq task, where coordinates are converted into grids and predicted in an autoregressive manner. building on this research, we have conducted empirical evaluations, incorporating the nuances of indian addresses and scaling the solution across all 29 indian states using low-latency and high-throughput model serving infrastructure. the major contributions of this work are: ## related work the evolution of geocoding techniques has transitioned from traditional rule-based and heuristic strategies to sophisticated deep learning models. initial geocoding research used rule-based and traditional machine learning methods that mapped text to geographic locations by extracting and ranking entries from address databases @xcite @xcite @xcite . although these methods worked well, they faced challenges in regions without extensive, high-quality databases, limiting their effectiveness in areas with sparse or non-standardized address data @xcite @xcite . to overcome the limitations of traditional methods, researchers began using deep learning models for geocoding. these models predict geographic locations directly from text, reducing the need for external databases and improving generalization @xcite @xcite . early approaches treated geocoding as either a coordinate prediction task. for example, liu et al. @xcite used deep learning to estimate twitter user locations from text, achieving good results. radford et al. @xcite developed a model to predict geographic coordinates directly from event text. however, these regression-based methods often struggled with the continuity and infinite nature of geographic coordinates, leading to learning difficulties and performance degradation due to data quality issues. in response to the challenges faced by regressionbased models, researchers explored grid-based classification approaches, where the earth's surface is divided into discrete grids, and models predict the corresponding grid category based on input addresses @xcite @xcite @xcite @xcite . for example, cardoso et al. @xcite combined grid classification with coordinate regression, using context-aware word embeddings and bidirectional lstm networks to transform text and predict grid categories. this hybrid approach addressed some limitations of pure classification models but still faced challenges related to the high dimensionality of the output space, particularly in fine-grained geocoding tasks. recently, researchers have begun addressing this problem using a seq2seq formulation @xcite @xcite , employing an encoder-decoder architecture. the input is an address, and the target is an alphanumeric string generated by hierarchical grid systems like h3, and s2 foot_2 . this approach has proven to be more effective than others. ## methodology we formulated geocoding as a hexagonal grid prediction problem from raw addresses using a seq2seq framework. it includes training senten-cepiece tokenizer from scratch on a large corpus of data that represents the vocabulary of addresses from different indian states and fine-tuning of language models to generate alphanumeric h3 cells. ## data creation we extracted data for each state from database 8 of a large ecommerce platform where delivered latitudes and longitudes were stored against the addresses. we then converted co-ordinates to h3 indices after pre-processing. since our use case was to build a geocoder at the building or house level, we chose resolution 9, which covers radius of roughly 200 meters 9 of each cell. to maintain consistency and ensure representative location data, we selected the most frequently occurring h3 index for each address. this process involves calculating the frequency of each h3 index associated with an address and selecting the index with the highest count. we prefixed each address with a specific prompt to enhance the model's understanding. the prompts used for each model are provided in appendix c. ## empirical study as it is not efficient to conduct extensive experiments on each state simultaneously, we decided to start with a model for a single city and then expand the best set of experiments to various states. this approach allowed us to focus our efforts and resources effectively. we picked two relatively more dense indian cities: nagpur, located in central india, and surat, situated in western india. the statistics for both are provided in ## real world deployment we deployed geoindia for a leading indian e-commerce platform, powering geofencing, hub allocation and route optimization for the past 4 months. to ensure a smooth experience with realtime inferencing (<100ms), we optimized model latency from ∼700ms to ∼80ms using nvidia ten-sorrt (nvidia). see appendix j for production workflow details. ## conclusion & future work in this work, we proposed geoindia, an effective solution that addressed complexities in geocoding diversely structured addresses. the proposed approach suggests that the region-specific fine-tuning leads to faster convergence. adjustments to parameters such as batch size and accumulation steps in data-scarce settings were discussed to achieve higher accuracy. we went on to discuss low latency model serving infrastructure with coverage across all states in india and concluded the effectiveness of the proposed solution by comparing it with top industry benchmark (google maps). in future, we will study the impact of noise, such as incorrect pincodes, on geocoding errors. additionally, we plan to explore complete fine-tuning of different llms. meta. introducing meta llama 3: the most capable openly available llm to date. https://ai.meta. com/blog/meta-llama-3/ . nvidia. tensorrt. https://developer.nvidia. com/tensorrt/ . benjamin j radford. 2021. regressing location on text for probabilistic geocoding. arxiv preprint arxiv:2107.00080. yaswanth reddy, sumanth sadu, abhinav ganesan, and jose mathew. 2022. address location correction system for q-commerce. in proceedings of the second international conference on ai-ml systems, pages 1-7. pavel serdyukov, vanessa murdock, and roelof van zwol. 2009. placing flickr photos on a map. in proceedings of the 32nd international acm sigir conference on research and development in information retrieval, pages 484-491. diogo alexandre araujo viegas. 2021. toponym resolution in text with neural language models. ph.d. thesis, instituto superior técnico lisbon, portugal. xiaobai a yao. 2020. georeferencing and geocoding. wei zhang and judith gelernter. 2014. geocoding location expressions in twitter messages: a preference learning method. journal of spatial information science, (9):37-70.