<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shivani Choudhary on Medium]]></title>
        <description><![CDATA[Stories by Shivani Choudhary on Medium]]></description>
        <link>https://medium.com/@shivani.r.choudhary?source=rss-a6dc1f1adb7e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Shivani Choudhary on Medium</title>
            <link>https://medium.com/@shivani.r.choudhary?source=rss-a6dc1f1adb7e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 09:16:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shivani.r.choudhary/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrating Large Language Models with ArcGIS]]></title>
            <link>https://medium.com/geoai/integrating-large-language-models-with-arcgis-5b72357b898e?source=rss-a6dc1f1adb7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b72357b898e</guid>
            <dc:creator><![CDATA[Shivani Choudhary]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 11:41:03 GMT</pubDate>
            <atom:updated>2025-01-31T06:17:15.356Z</atom:updated>
            <content:encoded><![CDATA[<p>Large Language Models (LLMs) like GPT 4, Claude Sonnet, and Llama have revolutionized the field of AI. These models have developed an intrinsic understanding of the world, having been trained on vast tranches of the Internet. What’s amazing is that these LLMs understand and generate text with such fluency, that they have been mistaken for being sentient!</p><p>Nonetheless, the field of natural language processing has reached a significant milestone through their development, as these models no longer rely on fine-tuning for text analysis tasks such as text classification or entity extraction. They can simply be <strong><em>prompted</em></strong> with a textual description of the task to be performed. They can also be provided with a handful of examples (<strong><em>few-shot learning</em></strong>), describing the input and expected output, and use <strong><em>in-context learning</em></strong> to apply their knowledge to new, unseen inputs. LLMs can generalize from a small set of examples and perform sophisticated text analysis without needing task-specific training or finetuning.</p><p>This ability of LLMs to extract information from text, summarize, reason or even translate text can be leveraged for a wide variety of Geospatial AI tasks including address standardization and enhancing disaster response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MjIDmrN1vptITaOj0yRZTQ.png" /></figure><h3>LLM integration with ArcGIS Pro</h3><p>With ArcGIS Pro 3.4, the text analysis tools in the GeoAI toolbox can leverage Mistral, an open source LLM, to train and use models for text classification, text transformation and entity recognition tasks. You can also integrate third-party LLMs like GPT and Llama by creating <strong>custom deep learning packages</strong> using <a href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/geoai/using-third-party-language-models-with-arcgis.htm">Python NLP functions</a>. This feature connects recent AI developments with practical GIS applications, allowing analysts to address complex problems more efficiently and accurately.</p><h4>Key Benefits:</h4><ol><li><strong>Customization</strong>: Tailor models to specific GIS use cases and geospatial datasets</li><li><strong>Flexibility</strong>: Integrate various AI architectures, from traditional machine learning to state-of-the-art LLMs</li><li><strong>Scalability</strong>: Automate and scale large-scale geospatial data processing</li><li><strong>Interoperability</strong>: Combine AI capabilities with ArcGIS Pro’s robust GIS tools</li><li><strong>Innovation</strong>: Quickly prototype and deploy cutting-edge AI solutions within a familiar GIS environment</li></ol><h3>Creating Custom Deep Learning Packages for NLP workflows</h3><p>Okay, now let’s get technical. How can you create your own custom NLP model within ArcGIS Pro? Here’s a step-by-step guide:</p><h4>Step 1: Define Your Model Structure</h4><p>Create a Python class with these required methods:</p><ul><li>__init__: Set up basic model information</li><li>initialize: Load your model and configurations</li><li>getConfiguration: Provide way to customize tool’s behavior</li><li>getParameterInfo: Define user-adjustable parameters</li><li>predict: The core function where your model processes data</li></ul><pre>class CustomNLPModel:  <br>    def __init__(self, **kwargs):  <br>    self.name = &quot;My Awesome NLP Model&quot;  <br>    self.description = &quot;Does amazing things with text&quot;  def initialize(self, **kwargs):  <br>    # Load your pre-trained model here  <br>    self.model = load_my_amazing_model()  <br>    <br>    def getConfiguration(self, **kwargs):  <br>    # Configure parameters  <br>    <br>    <br>    def getParameterInfo(self):  <br>    # Return parameter information for configuration  <br>    return [{  <br>    &quot;name&quot;: &quot;max_tokens&quot;,  <br>    &quot;dataType&quot;: &quot;integer&quot;,  <br>    &quot;required&quot;: False,  <br>    &quot;displayName&quot;: &quot;Max Tokens&quot;,  <br>    &quot;description&quot;: &quot;Maximum number of tokens to process&quot;,  <br>    &quot;value&quot;: 512  <br>    }]  <br>    <br>    def predict(self, feature_set, **kwargs):  <br>    # Your prediction logic here  <br>    text_data = feature_set.df[&#39;input_text&#39;].tolist()  <br>    results = self.model.predict(text_data)  <br>    return create_feature_set(results)</pre><h4>Step 2: Package Your Model</h4><p>Create a project folder structure:</p><pre>MyAwesomeModel/<br>├── CustomNLPModel.py<br>└── MyAwesomeModel.emd</pre><p>Define your model in the .emd file:</p><pre>{<br>    &quot;InferenceFunction&quot;: &quot;CustomNLPModel.py&quot;,<br>    &quot;ModelFile&quot;: &quot;path/to/model/weights&quot;<br>}</pre><p>Package into a .dlpk file:</p><ul><li>Zip the folder contents</li><li>Rename to MyAwesomeModel.dlpk</li></ul><h4>Step 3: Integrate with ArcGIS Pro</h4><ul><li>Open ArcGIS Pro</li><li>Navigate to the GeoAI Toolbox</li><li>Select the appropriate text analysis tool</li><li>Load your .dlpk file as the model</li><li>Configure parameters</li><li>Run your analysis!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJtR_A6iL-vUooJOeE0wfg.png" /></figure><h3>Real-World Applications</h3><p>Let’s explore three compelling use cases that demonstrate the power of integrating ArcGIS Pro with (large) language models:</p><h3>1. Address Standardization with GPT-4</h3><p>Traditionally, address standardization has been a complex task requiring intricate rule-based systems. By integrating GPT-4 with ArcGIS Pro’s text analysis tools, we can now standardize addresses with higher accuracy and flexibility.</p><pre>import requests <br><br>class GPTAddressStandardizer:<br>    def __init__(self):<br>        self.name = &quot;GPT-4 Address Standardizer&quot;<br>        self.description = &quot;Standardizes addresses using GPT-4&quot;<br>    def initialize(self, **kwargs):<br>        # Load GPT-4 model and set up API connection<br>        self.api_key = kwargs.get(&#39;api_key&#39;, &quot;xxx&quot;)<br>        self.api_base = kwargs.get(&#39;api_base&#39;, &quot;http://api.openai.com/v1/chat/completions&quot;)<br>        self.gpt_model = kwargs.get(&#39;model_name&#39;, &quot;GPT-4&quot;)<br>    <br>    def getParameterInfo(self):<br>        return [{<br>            &quot;name&quot;: &quot;api_key&quot;,<br>            &quot;dataType&quot;: &quot;string&quot;,<br>            &quot;required&quot;: True,<br>            &quot;displayName&quot;: &quot;API key of GPT-4&quot;,<br>            &quot;description&quot;: &quot;Field to supply API key.&quot;<br>        }]<br>    def getConfiguration(self, **kwargs):<br>        # Edit the batch size<br>        self.api_key = kwargs.get(&quot;api_key&quot;, &quot;&quot;)<br>        if kwargs[&quot;batch_size&quot;] &gt; 4:<br>            kwargs[&quot;batch_size&quot;] = 4<br>        return kwargs<br>    def predict(self, feature_set, **kwargs):<br>        addresses = feature_set.df[kwargs[&#39;input_field&#39;]].tolist()<br>        standardized = [{&#39;attributes&#39;: {&quot;output&quot;: self.standardize_address(addr)}} for addr in addresses]<br>        feature_dict = {&quot;fields&quot;: [{&quot;name&quot;: &quot;output&quot;, &quot;type&quot;: &quot;esriFieldTypeString&quot;}, ], &#39;geometryType&#39;: &quot;&quot;,<br>                        &#39;features&#39;: standardized}<br>        return FeatureSet.from_dict(feature_dict)<br>    def standardize_address(self, address):<br>        # Use GPT-4 to standardize the address<br>        self.header = {&quot;Authorization&quot;: f&quot;Bearer {self.api_key}&quot;}<br>        prompt = f&quot;Standardize this address: {address}&quot;<br>        payload = {<br>                    &quot;model&quot;: self.gpt_model,<br>                    &quot;messages&quot;: [<br>                    {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a helpful assistant.&quot;},<br>                    {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}<br>                    ],<br>                    &quot;stream&quot;: False<br>                  }<br>        response = requests.request(method=&quot;POST&quot;, url=self.api_base, headers=self.header, data=payload, verify=True)<br>        return response.json()[&quot;choices&quot;][0][&quot;message&quot;][&quot;content&quot;]</pre><p><a href="https://developers.arcgis.com/python/latest/guide/address-standerdization-using-model-extension/">See the full code here</a></p><p>This approach can handle a wide variety of address formats, understand context, and produce consistently formatted outputs. For example:</p><ul><li>Input: “123 Main Street, Apartment 4B, Anytown, California 90210”</li><li>Output: “123 Main St Apt 4B, Anytown, CA 90210”</li></ul><p>The GPT-4 model can understand and standardize addresses, use the appropriate abbreviations, correct minor spelling errors, and ensure consistent formatting across a large dataset of addresses. Note that the addresses are sent to GPT-4 hosted by OpenAI along with the prompt in this case. If you wish to perform all processing locally, you can use an on-premises model running on your computer.</p><h3>2. Named Entity Recognition for Catastrophic Incidents</h3><p><a href="https://github.com/urchade/GLiNER">GLiNER</a> is a Named Entity Recognition (NER) model that uses a bidirectional transformer encoder (similar to BERT) to identify entities. Using a pre-trained GLiNER model, we can extract crucial information from descriptions of catastrophic events. This application showcases how ArcGIS Pro can be integrated with powerful NLP models for specific geospatial tasks.</p><pre>class CatastrophicIncidentNER:<br>    def __init__(self, **kwargs):<br>        self.name = &quot;My Custom entity extractor&quot;<br>        self.description = &quot;GLiNER model based extension function for Named Entity Recognition&quot;<br>    <br>    def initialize(self, **kwargs):<br>        # Load model configuration<br>        with open(kwargs[&quot;model&quot;]) as f:<br>            emd = json.load(f)<br>        model_name = emd[&quot;PretrainedModel&quot;]<br>        sys.path.append(os.path.dirname(__file__))<br>        from GLiNER.gliner import GLiNER<br>        self.model = GLiNER.from_pretrained(model_name)<br>        self.considerd_class = kwargs.get(&quot;classes&quot;, considered_classes)<br>    <br>    def getParameterInfo(self):<br>        t =  [{<br>            &quot;name&quot;: &quot;classes&quot;,<br>            &quot;dataType&quot;: &quot;integer&quot;,<br>            &quot;required&quot;: False,<br>            &quot;displayName&quot;: &quot;name to classes&quot;,<br>            &quot;description&quot;: &quot;A comma separated string of class names&quot;,<br>            &quot;value&quot;: &#39;impacted location,event date,Quantity,property damage,climatic catastropic event&#39;<br><br>        }]<br>        return t<br>    <br>    def getConfiguration(self, **kwargs):<br>        # Adjust batch size and max token length<br>        if kwargs[&quot;batch_size&quot;] &gt; 4:<br>            kwargs[&quot;batch_size&quot;] = 4<br>        self.max_token = min(float(kwargs.get(&quot;max_token&quot;, 512)), 1024)<br>        kwargs[&quot;address_tag&quot;] = &quot;impacted location&quot;<br>        self.considerd_class = kwargs.get(&quot;classes&quot;, &quot;&quot;).split(&quot;,&quot;)<br>        return kwargs<br><br>    <br>    def predict(self, feature_set, **kwargs):<br>        input_field = kwargs.get(&quot;input_field&quot;, &quot;input_str&quot;)<br>        text_list = feature_set.df[input_field].to_list()   <br>        self.model = self.model.to(&#39;cuda&#39;)<br>        features_list = []<br>        for text in text_list:<br>            temp_dict = {}<br>            for i in self.considerd_class:<br>                temp_dict[i] = [] <br><br>            # Perform entity prediction<br>            entities = self.model.predict_entities(text, self.considerd_class, threshold=0.5)<br>            # Convert Extracted entities to dictionary<br>            for entity in entities:<br>                temp_dict[entity[&quot;label&quot;]] += [entity[&quot;text&quot;]]<br>            ...<br>            temp_dict[&quot;input_str&quot;] = text<br>            features_list.append({&#39;attributes&#39;:temp_dict})  <br><br>        # Create and return FeatureSet<br>        return FeatureSet.from_dict(feature_dict)</pre><p><a href="https://developers.arcgis.com/python/latest/guide/exploring-model-extensibility-for-named-entity-recognition/">See the full code here</a></p><p>Input: “Hurricane Zeta made landfall near Cocodrie, Louisiana, on October 28, 2020, with maximum sustained winds of 110 mph.”</p><p>Output:</p><ul><li>Event Type: Hurricane</li><li>Name: Zeta</li><li>Location: Cocodrie, Louisiana</li><li>Date: October 28, 2020</li><li>Magnitude: 110 mph</li></ul><p>This structured information can be crucial for emergency responders, policymakers, and researchers analyzing patterns in catastrophic events.</p><h3>3. Real-Time Disaster Response with LLMs</h3><p>When disaster strikes, every second counts. During Hurricane Harvey in 2017, the volume of tweets on social media became overwhelming, making real-time processing nearly impossible.</p><p>For this task, we can integrate an On-Prem Llama-3 model with ArcGIS Pro. This deep learning package can process tweets as they’re posted, categorizing them into health emergencies, public service failures, and general information. By mapping this classified data in real time, emergency services can quickly visualize and respond to urgent situations, allowing for faster identification of health emergencies, more effective resource allocation, and targeted assistance to affected areas.</p><pre>class HarveyTweetClassifier:  <br>    def __init__(self):  <br>        self.name = &quot;Hurricane Tweet Classifier&quot;  <br>        self.description = &quot;Classifies tweets during hurricane emergencies&quot;  <br>       <br>    def initialize(self, **kwargs):  <br>        self.llm_model = load_llama_model(kwargs[&#39;model_path&#39;])  <br>        self.system_prompt = &quot;&quot;&quot;  <br>        You are an AI assistant trained to classify tweets during hurricane emergencies.  <br>        Classify each tweet into one of the following categories:  <br>        1. Health emergency  <br>        2. Public service failures  <br>        3. Others (general information)  <br>        &quot;&quot;&quot;  <br>       <br>    def getParameterInfo(self, **kwargs):  <br>        t =  [{  <br>                &quot;name&quot;: &quot;temperature&quot;,  <br>                &quot;dataType&quot;: &quot;float&quot;,  <br>                &quot;required&quot;: False,  <br>                &quot;displayName&quot;: &quot;Generation temperature for Llama&quot;,  <br>                &quot;description&quot;: &quot;Generation temperature for Llama&quot;,  <br>                &quot;value&quot; : &#39;&#39;  <br>       <br>         },]  <br>     <br>    def getConfiguration(self, **kwargs):  <br>        # Edit the batch size  <br>        try:  <br>           self.temperature = float(kwargs.get(&quot;temperature&quot;, 0.2))  <br>        except:  <br>           self.temperature = 0.2  <br>          <br>        if kwargs[&quot;batch_size&quot;] &gt; 4:  <br>           kwargs[&quot;batch_size&quot;] = 4  <br>        return kwargs  <br>   <br>    def predict(self, feature_set, **kwargs):  <br>        tweets = feature_set.df[kwargs[&#39;input_field&#39;]].tolist()  <br>        classifications = [self.classify_tweet(tweet) for tweet in tweets]  <br>        return FeatureSet.from_dict({&#39;classification&#39;: classifications})  <br>       <br>    def classify_tweet(self, tweet):  <br>        user_prompt = f&quot;Classify the following tweet: &#39;{tweet}&#39;&quot;  <br>        response = self.llm_model.generate(self.system_prompt + user_prompt)  <br>        return self.parse_classification(response)  <br>   <br>    def parse_classification(self, response):  <br>        # Logic to parse the LLM&#39;s response and return the classification  <br>        pass</pre><p><a href="https://developers.arcgis.com/python/latest/guide/leveraging-llms-for-real-time-decision-making-in-calamities/">See the full code here</a></p><p>This uses Llama, a powerful open source LLM from Meta to process and classify the tweets using the provided prompts and a few labelled examples.</p><h3>Conclusion: The Future of ArcGIS with LLMs</h3><p>Integrating ArcGIS with large language models (LLMs) marks a significant shift in how we approach geospatial analysis. This integration brings together the power of GIS, artificial intelligence, and domain-specific knowledge to address complex challenges.</p><p>Whether you’re a GIS professional, data scientist, or domain expert, the use of LLMs in ArcGIS opens up new possibilities for more intuitive and adaptive geospatial analysis. The future of geospatial analysis is here, and it’s more intelligent, responsive, and adaptable than ever before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*WgGiadyl2XevKh43I4fIPg.png" /><figcaption>My maps will never be the same</figcaption></figure><p>— -</p><p>Remember, in the world of GIS and data science, the only limit is your imagination. And maybe your GPU’s memory. But mostly your imagination.</p><p>Happy mapping!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b72357b898e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geoai/integrating-large-language-models-with-arcgis-5b72357b898e">Integrating Large Language Models with ArcGIS</a> was originally published in <a href="https://medium.com/geoai">GeoAI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>