<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Juletip #13 - LLMs and SAS Viya for named entity recognition in SAS Community Nordic</title>
    <link>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-13-LLMs-and-SAS-Viya-for-named-entity-recognition/m-p/907721#M450</link>
    <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;This Juletip explores different options for named entity recognition (NER). NER is a natural language processing (NLP) task that involves the identification and classification of entities, such as names of people, organizations, locations and other specific categories, within a body of text. The primary goal of NER is to extract useful structured information from unstructured text data or it can be used to remove that data to anonymize documents. If you want to dive deeper into the details and try these yourself, I recommend to check out this video I also made recently: &lt;A href="https://youtu.be/HC6UJDeoddw" target="_blank" rel="noopener"&gt;https://youtu.be/HC6UJDeoddw&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;NER systems typically use a combination of machine learning algorithms and rule based approaches, to analyze and understand the context of words in a given text and assign them to predefined categories.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;There are 4 typical options to combine to get best possible results. Each option has their own benefits and drawbacks so I recommend to use both machine learning and rule based approaches. From simple to more complex:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="1"&gt;&lt;SPAN&gt;Rule based methods that utilize regex: SAS PRXMATCH / PRXCHANGE functions&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN&gt;Rule based methods that utilize NLP &amp;amp; REGEX: SAS Visual Text Analytics concept rules&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN&gt;Large language models (LLMs) such as BERT (millions of parameters)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN&gt;Recent generative LLM such as Llama 2 or other generative AI models (billions of parameters)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="1"&gt;&lt;SPAN&gt;PRXMATCH / PRXCHANGE&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: Uses regex rules to find entities. It is especially useful for entity types that follow a particular pattern, such as social security numbers. It is quick and easy to implement. PRXCHANGE gives the options to anonymize the entity simultaneously so required code is minimized.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: Does not understand context or language.&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="2"&gt;&lt;SPAN&gt;Concept rules&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: Concept rules bring together language understanding and versatile rule types, including regex. These rules can take into account the context in a sentence or a paragraph. They can be used to pick up patterns, but also work well for different types of names.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: It takes time to develop rules manually. It is easy to detect entities in their base form, but in some languages inflected word forms might take additional effort.&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="3"&gt;&lt;SPAN&gt;Large Language Models, such as BERT&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: BERT models tuned for named entity recognition can be highly efficient at spotting entities and the model gives out also a probability score and entity type.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: It is much harder to modify results of a LLM compared to rule based methods. It might not be feasible to do additional training to spot entities that are missed by the model so rule based methods should be still used.&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="4"&gt;&lt;SPAN&gt;Generative Large Language Models, such as Llama 2&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: LLMs can generate answers to wide variety of queries. The new generative models have been trained on massive amounts of text and can detect entities well while understanding context and nuances of language.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: Generative models can produce false results known as hallucinations. It is also possible that the positions of the recognized entities are incorrect. They can also refuse to detect some entity types such as social security numbers because of their safeguards. It might require prompt engineering to get the desired result. The required compute is also on a different scale compared to the other options so I would recommend to first try the other options as pure named entity recognition is not necessarily generative.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;If the topic interests you further, check out the linked &lt;A href="https://youtu.be/HC6UJDeoddw" target="_blank" rel="noopener"&gt;video&lt;/A&gt; for details. It provides practical examples on how to get started with combining these options on SAS Viya.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Links to SAS documentation:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;VTA Concept rule documentation: &lt;A href="https://go.documentation.sas.com/doc/en/capcdc/v_022/ctxtcdc/ctxtug/p1kf71w7npr9ecn1gysvovfs42x2.htm" target="_blank" rel="noopener"&gt;https://go.documentation.sas.com/doc/en/capcdc/v_022/ctxtcdc/ctxtug/p1kf71w7npr9ecn1gysvovfs42x2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;PRX documentation: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_045/lefunctionsref/n0r8h2fa8djqf1n1cnenrvm573br.htm" target="_blank" rel="noopener"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_045/lefunctionsref/n0r8h2fa8djqf1n1cnenrvm573br.htm&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Happy holidays!&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jan 2024 13:07:28 GMT</pubDate>
    <dc:creator>Antti_Heino</dc:creator>
    <dc:date>2024-01-04T13:07:28Z</dc:date>
    <item>
      <title>Juletip #13 - LLMs and SAS Viya for named entity recognition</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-13-LLMs-and-SAS-Viya-for-named-entity-recognition/m-p/907721#M450</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;This Juletip explores different options for named entity recognition (NER). NER is a natural language processing (NLP) task that involves the identification and classification of entities, such as names of people, organizations, locations and other specific categories, within a body of text. The primary goal of NER is to extract useful structured information from unstructured text data or it can be used to remove that data to anonymize documents. If you want to dive deeper into the details and try these yourself, I recommend to check out this video I also made recently: &lt;A href="https://youtu.be/HC6UJDeoddw" target="_blank" rel="noopener"&gt;https://youtu.be/HC6UJDeoddw&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;NER systems typically use a combination of machine learning algorithms and rule based approaches, to analyze and understand the context of words in a given text and assign them to predefined categories.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;There are 4 typical options to combine to get best possible results. Each option has their own benefits and drawbacks so I recommend to use both machine learning and rule based approaches. From simple to more complex:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;" value="1"&gt;&lt;SPAN&gt;Rule based methods that utilize regex: SAS PRXMATCH / PRXCHANGE functions&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN&gt;Rule based methods that utilize NLP &amp;amp; REGEX: SAS Visual Text Analytics concept rules&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN&gt;Large language models (LLMs) such as BERT (millions of parameters)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle;"&gt;&lt;SPAN&gt;Recent generative LLM such as Llama 2 or other generative AI models (billions of parameters)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="1"&gt;&lt;SPAN&gt;PRXMATCH / PRXCHANGE&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: Uses regex rules to find entities. It is especially useful for entity types that follow a particular pattern, such as social security numbers. It is quick and easy to implement. PRXCHANGE gives the options to anonymize the entity simultaneously so required code is minimized.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: Does not understand context or language.&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="2"&gt;&lt;SPAN&gt;Concept rules&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: Concept rules bring together language understanding and versatile rule types, including regex. These rules can take into account the context in a sentence or a paragraph. They can be used to pick up patterns, but also work well for different types of names.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: It takes time to develop rules manually. It is easy to detect entities in their base form, but in some languages inflected word forms might take additional effort.&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="3"&gt;&lt;SPAN&gt;Large Language Models, such as BERT&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: BERT models tuned for named entity recognition can be highly efficient at spotting entities and the model gives out also a probability score and entity type.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: It is much harder to modify results of a LLM compared to rule based methods. It might not be feasible to do additional training to spot entities that are missed by the model so rule based methods should be still used.&lt;/P&gt;
&lt;OL style="direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: bold; font-style: normal;" type="1"&gt;
&lt;LI lang="en-US" style="margin-top: 0; margin-bottom: 0; vertical-align: middle; font-weight: bold;" value="4"&gt;&lt;SPAN&gt;Generative Large Language Models, such as Llama 2&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Benefits: LLMs can generate answers to wide variety of queries. The new generative models have been trained on massive amounts of text and can detect entities well while understanding context and nuances of language.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Drawbacks: Generative models can produce false results known as hallucinations. It is also possible that the positions of the recognized entities are incorrect. They can also refuse to detect some entity types such as social security numbers because of their safeguards. It might require prompt engineering to get the desired result. The required compute is also on a different scale compared to the other options so I would recommend to first try the other options as pure named entity recognition is not necessarily generative.&lt;/P&gt;
&lt;P style="margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;If the topic interests you further, check out the linked &lt;A href="https://youtu.be/HC6UJDeoddw" target="_blank" rel="noopener"&gt;video&lt;/A&gt; for details. It provides practical examples on how to get started with combining these options on SAS Viya.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Links to SAS documentation:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;VTA Concept rule documentation: &lt;A href="https://go.documentation.sas.com/doc/en/capcdc/v_022/ctxtcdc/ctxtug/p1kf71w7npr9ecn1gysvovfs42x2.htm" target="_blank" rel="noopener"&gt;https://go.documentation.sas.com/doc/en/capcdc/v_022/ctxtcdc/ctxtug/p1kf71w7npr9ecn1gysvovfs42x2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;PRX documentation: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_045/lefunctionsref/n0r8h2fa8djqf1n1cnenrvm573br.htm" target="_blank" rel="noopener"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_045/lefunctionsref/n0r8h2fa8djqf1n1cnenrvm573br.htm&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="en-US"&gt;Happy holidays!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 13:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-13-LLMs-and-SAS-Viya-for-named-entity-recognition/m-p/907721#M450</guid>
      <dc:creator>Antti_Heino</dc:creator>
      <dc:date>2024-01-04T13:07:28Z</dc:date>
    </item>
  </channel>
</rss>

