<?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 Peter Zhang on Medium]]></title>
        <description><![CDATA[Stories by Peter Zhang on Medium]]></description>
        <link>https://medium.com/@zhangineer?source=rss-50b00f3ca687------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ERMvYig8Vsh63qVWy6vq6A.jpeg</url>
            <title>Stories by Peter Zhang on Medium</title>
            <link>https://medium.com/@zhangineer?source=rss-50b00f3ca687------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:31:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zhangineer/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[Networking and LLM — Supercharge LLM With Domain Expert Knowledge]]></title>
            <link>https://medium.com/@zhangineer/networking-and-llm-supercharge-llm-with-domain-expert-knowledge-997006ca938b?source=rss-50b00f3ca687------2</link>
            <guid isPermaLink="false">https://medium.com/p/997006ca938b</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[cisco]]></category>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Peter Zhang]]></dc:creator>
            <pubDate>Mon, 06 May 2024 01:31:04 GMT</pubDate>
            <atom:updated>2024-05-08T01:40:56.853Z</atom:updated>
            <content:encoded><![CDATA[<h3>Networking and LLM — Supercharge LLM With Domain Expert Knowledge</h3><h4>System Instructions are more potent than you might realize</h4><p>I have seen many posts from Network Engineers and Architects dismissing LLM’s ability to perform domain-specific tasks. While it is true that a generic LLM software like ChatGPT does not possess the same level of domain knowledge, it has a high potential to outperform humans if given proper guidance and some teaching.</p><p>In this post, I will cut through the noise and examine how to “teach” chatGP to answer domain-specific questions like an expert.</p><blockquote>Note that this article uses Cisco ACI as an example. The code used in this article can be found here — <a href="https://github.com/zhangineer/networking_llm_instruction">https://github.com/zhangineer/networking_llm_instruction</a></blockquote><p>This article will guide you through the following key points:</p><ol><li>ChatGPT’s ability to answer domain-specific questions skyrocketed when provided with quality data in small quantities.</li><li>Human expert knowledge in domain-specific areas is not just necessary but integral. This article will demonstrate its significance and how it can be leveraged to enhance LLM&#39;s performance.</li><li>Making a helpful model requires something other than expert programming or AI/ML knowledge. The instruction-tuned approach demonstrates great potential in improving LLM’s ability to become an invaluable assistant in domain-specific technology.</li></ol><h3>Summary</h3><p>Instruction-tuning greatly enhanced ChatGPT’s domain knowledge. On average, instruction-tuned ChatGPT scored 77.52%, which is <strong>8x</strong> higher than zero-shot learning (9.53%) and <strong>~2x</strong> higher than few-shot learning (39.72%).</p><h4>TL;DR</h4><p>As usual, here is a high-level TL;DR for the busy folks:</p><ul><li>This research experiment explored instruction-based tuning to enhance ChatGPT’s ability to answer domain-specific questions, specifically Cisco ACI query commands.</li><li>The goal was to test ChatGPT’s ability to provide accurate ACI CLI commands after being tuned with detailed instructions.</li><li>The Q&amp;A tests contain 72 questions with three levels of difficulty. <br>Q1–Q10 are low, Q11 — Q52 are medium, and Q53 — Q72 are high.</li><li>The instructions provided are similar to how we would teach a junior engineer.</li><li>Each test was run 100 times for all 72 questions.</li><li>If we only account for questions answered correctly 100% of the time, the instruction-tuned model scored 56.16%, which is <strong>~7x higher </strong>than zero-shot learning (8.22%) and few-shot learning (8.22%).</li><li>Here is the comparison chart</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zk_ABNZ5T6GEgVv02j0j9w.png" /><figcaption>Overall Total Score Results</figcaption></figure><ul><li>Few-shot learning results dropped sharply for questions answered correctly 100% of the time.</li><li>I also noticed the latest Claude Opus 3 model outperforms ChatGPT4 at following instructions. However, more research and investigation are needed.</li></ul><h4>Lessons Learned</h4><ul><li>Build a validation pipeline as early as possible before diving into data gathering and refining.</li><li>Consistency is paramount. The model can answer the same question differently, but the result should always remain the same. Even getting the answer <strong>incorrectly</strong> every time, with the same answer, is better than getting the answer correctly 80% of the time.</li><li>Use syntax highlighting if describing a syntax. It will draw attention to the model.</li><li>Collect the error rate on every question and visualize distribution and frequency.</li><li>Keep instructions simple. It is tempting to add as many detailed instructions as possible, but if there are overlapping languages and contexts, you risk confusing the LLM.</li><li>Add logic to validate both the input data and the outcome of the CLI commands. Make sure to account for dynamic output, such as timestamps.</li><li>Avoid unnatural and tailored question prompts. These prompts may be suitable for benchmarking, but they will fail in the real world. The hardest part is accounting for different human expression styles.</li></ul><h4><strong>Now, let’s dive into the details.</strong></h4><h3>Problem Statement</h3><p>During my years building ACI data centers for customers, the most common question I received was, <strong><em>How do I get XYZ information from ACI?</em></strong></p><p>This is because ACI SDN differs from traditional networking, requiring an understanding of its API to retrieve information efficiently.</p><p>Example: <em>How do I get a list of IP addresses and MAC?</em></p><ul><li>Traditional Networking: show ip arp on core router</li><li>In ACI: moquery -c fvIp from one of the APICs.</li></ul><p><strong>Note</strong>: In ACI there are also show commands available through the CLI. However, it can only retrieve the most commonly used objects. In this article, we’ll cover only the API query command -moquery</p><blockquote>‘moquery’ is an ACI-style CLI command that performs API calls against the APIC Managed Object (mo) database. It is a combination of a Database query and an API call. Results are returned as a Class/Object relationship, similar to Python objects.</blockquote><p><strong>My goal is to provide users with a domain-knowledge-tuned LLM that can accurately construct API commands.</strong></p><p>In this article, I performed some research and experiments to see how close we can get by tuning ChatGPT with only instructions.</p><h3>Basic Terminologies</h3><ul><li><strong>instruction —</strong> In ChatGPT, instructions guide how ChatGPT should respond to prompts.</li><li><strong>zero-shot learning — </strong>The model has never seen the data during training and could still infer.</li><li><strong>few-shot learning — </strong>Some examples are provided to the model and usually improve the model performance compared to zero-shot learning.</li><li><strong>instruction-tuned</strong> (or <strong>tuned</strong> for short) — means that the model was provided detailed instructions to respond to various prompts.</li></ul><h3>Methodology and Requirements</h3><ol><li>Build QA datasets with domain knowledge.</li><li>Build instructions to answer the questions from the QA dataset.</li><li>Ensure data diversity to represent different real-world situations.</li><li>Data must be of high quality with no errors.</li><li>Implement a rigorous validation process to ensure no mistakes in score calculation.</li><li>Compare the results among zero-shot learning, few-shot learning, and instruction-tuned models across various scenarios.</li><li>Model used: gpt-4–1106-preview</li></ol><h3>QA Questions and Tuned Instructions</h3><h4>QA Test Questions — <a href="https://github.com/zhangineer/networking_llm_instruction/blob/main/dataset/qa_data.json">Link</a></h4><p>These are carefully crafted questions to test the model’s response accuracy.</p><ul><li>The QA test questions are split into easy, medium, and hard difficulties based on my personal experience.</li><li>There are a total of 72 questions. Q1 — Q10 (10) are easy, Q11 — Q52 (42) are medium level, and Q53 — Q72 (20) are hard.</li><li>All questions are configuration-related since I only have a digital simulation of the Cisco APIC.</li></ul><h4>Tuned Instruction — <a href="https://github.com/zhangineer/networking_llm_instruction/blob/main/instructions/tuned.md">Link</a></h4><p>The instructions were 100% written by a human (me; last I checked, I was still human). It has four main components: basic guidelines, syntax explanations, examples, and class descriptions.</p><p>The system instruction is provided to ChatGPT as the first prompt for each conversation context. (as long as the context stays the same, we do not need to provide system instruction over and over)</p><p><strong>Basic guidelines</strong> — To instruct chatGPT on the answer format, style, limit the scope…etc. For example, <br>Only provide an explanation if the user requests <br> or <br>Do not use any classes not listed in this guide</p><p><strong>API syntax explanation</strong> — Explains how the API query syntax works. For example, we start by explaining the high-level syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*fwSHhrsZP3OQ6laqWhB87g.png" /><figcaption>Snapshot of Syntax Explanation</figcaption></figure><p><strong>Individual Class Descriptions</strong> — Each class and associated attributes provide certain information. ChatGPT must understand them and choose the correct class to answer related questions. For example, below is the description for the Bridge Domain class. (For non-ACI users/programmers, this is essentially a Python class with attributes)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10TWwMw9ZRD-ngN5d1R2kQ.png" /><figcaption>Bridge Domain Class Description</figcaption></figure><p>I also referenced the Cisco DevNet API class descriptions: <a href="https://developer.cisco.com/site/apic-mim-ref-api/">https://developer.cisco.com/site/apic-mim-ref-api/</a>.</p><p>Unfortunately, we can’t pass on the entire API reference because it’s not well-written for LLM.</p><p><strong>Few-shot Examples</strong> — Provide ChatGPT with direct examples. These are extremely valuable and efficient but can hit diminishing returns quickly.</p><p>For example, the few-shot examples are provided in a Q&amp;A format as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*iuorK5prVUFplrovnbBcWA.png" /><figcaption>Few-shot Examples</figcaption></figure><h4>Additional Instructions</h4><p>You can also find a <a href="https://github.com/zhangineer/networking_llm_instruction/blob/main/instructions/zero_shot.md">zero-shot</a> and a <a href="https://github.com/zhangineer/networking_llm_instruction/blob/main/instructions/few_shot.md">few-shot</a> version of the System Instructions. They are used to compare the difference between tuned and non-tuned instructions. In the end, the results show that:</p><blockquote><strong>Tuned instruction &gt; Few-Shot &gt;&gt; Zero-Shot</strong></blockquote><h3>Evaluation Process</h3><p>To properly evaluate the answers, we perform the following:</p><ul><li>Compare ChatGPT’s response to the correct answer.</li><li>Send ChatGPT’s response to the APIC simulator and evaluate.</li></ul><p>I’ve configured the simulator to ensure a meaningful response is always returned for each question.</p><p>The flow goes as follows:</p><ol><li>We pass (system instructions + all 72 questions) to ChatGPT.</li><li>We ask ChatGPT to provide all answers back in a single response (cost-saving)</li><li>We send each ChatGPT’s CLI answer to the APIC simulator and collect the response.</li><li>We also send the correct CLI answer to the APIC simulator and collect the response.</li><li>We compare the responses and score each of ChatGPT’s answers.<br>* 1 point for a correct answer<br>* 0 points for an incorrect answer, but the syntax is OK<br>* -1 point for syntax error (This does not affect the total score)</li><li>Repeat the above process 100 times.</li></ol><p>Below is a diagram illustration of the process</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LRRfYILnWlT4HEOP" /><figcaption>Evaluation Process</figcaption></figure><h3>The Results</h3><p>The chart below shows that:</p><p>On average (blue bar), the instruction-tuned model scored 77.52%, which is ~8x higher than zero-shot learning (9.53%) and ~2x higher than few-shot learning (39.72%).</p><p>If we only account for questions answered correctly 100% of the time (red bar), the instruction-tuned model scored 56.16%, which is <strong>~7x higher </strong>than zero-shot learning and <strong>~7x higher</strong> than few-shot learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7fa5MSnxKfXkfFHGC76iA.png" /><figcaption>Overall Total Score Results</figcaption></figure><h4>Breakdown By Difficulty Levels</h4><p>The chart below shows that:</p><ul><li>The instruction-tuned model maintained 100% accuracy in low-difficulty questions</li><li>The instruction-tuned model showed minimal drops in performance between medium and high-difficulty</li><li>Few-shot learning shows a tremendous jump from 0% to 43.7% score compared to zero-shot learning.</li><li>The few-shot learning score drops sharply from medium to high difficulty.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cH068J7seCi-lGbaNd1yCg.png" /><figcaption>Score Breakdown by Difficulty</figcaption></figure><p>Now that we’ve reviewed the results, we’ll examine the process of building the validation pipeline, the pain points, and what can be improved.</p><h3><strong>Examples Where ChatGPT Needed Hints To Interpret</strong></h3><h4>Q16 — Prompt Engineering Required</h4><p>The question is tailored so ChatGPT can interpret it correctly.</p><ul><li><strong>Didn’t work: </strong><em>how to get a list of leafs and spines along with serial numbers and models?</em></li><li><strong>Worked: </strong><em>how to get a list of device serial numbers and models, </em><strong><em>excluding</em></strong><em> the controllers?</em></li></ul><p>Since there are only three types of devices in an ACI fabric, it’s common for engineers to ask with the first approach, as it is more natural.</p><p>Imagine asking someone what they had for lunch and dinner, like this: “What did you have for meals, excluding breakfast?”</p><p>That is not natural to me.</p><p>ChatGPT stumbles because to answer the question below,</p><blockquote>how to get a list of leafs and spines along with serial numbers and models?</blockquote><p>One must use the or operator instead of and. In the below query, when using and, it implies that the role of a node must be both “leaf” and “spine,” which is impossible since they are mutually exclusive.</p><p>moquery -c fabricNode -x ‘query-target-filter=<strong>and</strong>(eq(fabricNode.role,”leaf”),eq(fabricNode.role,”spine”))’</p><p>In this context, how humans understand the word “and” differs from API language. The easiest approach is to use the ne(not equal) operator to exclude the APIC controller as follows:</p><p>&#39;query-target-filter=<strong>ne</strong>(fabricNode.role,&quot;controller&quot;)&#39;</p><h4>Q28. Issues with interpretation</h4><p>I also had to modify the question itself</p><ul><li><strong>Didn’t work </strong>— <em>how to find a list of leafs pending for registration?</em></li><li><strong>Worked</strong> — <em>how to find a list of devices pending for registration that are also leaf switches?</em></li></ul><p>I am somewhat surprised that ChatGPT couldn’t understand the question. Without hints, ChatGPT will answer as follows:</p><p>moquery -c dhcpClient -x ‘query-target-filter=eq(dhcpClient.clientEvent,”pending”)’</p><p><strong>Correct answer:</strong></p><p>moquery -c dhcpClient -x ‘query-target-filter=and(eq(dhcpClient.clientEvent,”pending”),eq<strong>(dhcpClient.configNodeRole,”leaf”)</strong>)’</p><p>ChatGPT did not understand the question and missed out on the fact that we were only interested in the leaf devices.</p><h4>Q15. Vague class description</h4><p>This one is more of a human error. Here is the question:</p><blockquote>How to find the fabric TEP address pool?</blockquote><p>tepPool is an attribute of the class topSystem, and our goal is to find its value. Hence, we need to query for other fields of the same class. To get the value, one can query either Spine, Leaf, or Controller.</p><p>As shown below, I intended for ChatGPT to use the role attribute as a filter to find tepPool information from the same object.</p><pre>### topSystem: device state and configuration information class<br>* `role`: role of the device, available options are: `controller`, `leaf`, `spine`<br>* `tepPool`: fabric TEP address pool for the whole system, example: `10.0.0.0/16`</pre><p>Correct answer: moquery -c topSystem -x ‘query-target-filter=eq(topSystem.role,\”controller\”)</p><p>ChatGPT will get it correct sometimes, but other times, it’ll give me something like this:</p><p>moquery -c topSystem -x ‘query-target-filter=ne(topSystem.tepPool,&quot;&quot;)’</p><p>Note the empty values (&quot;&quot;) in the filter implies that ChatGPT realizes that it’s an unknown value and we need to find it, but the ACI API doesn’t support empty string matching.</p><p>The vague part is in the description of the class itself.</p><ul><li><strong>Didn’t work — </strong>topSystem: system information class</li><li><strong>Worked</strong> — topSystem: device state and configuration information class</li></ul><p>Human guidance is vital in guiding LLMs, similar to providing knowledge to another human.</p><h3>Observations</h3><p>The following observations are not inclusive; there are probably more than I can remember.</p><h4>The Good</h4><ul><li>Great potential and simplified user experience.</li><li>There is much less code to write compared to using function calls.</li><li>Instruction-tuning can cover a lot more use cases than function calls.</li><li>Even engineers with no coding skills can help contribute with their expert knowledge.</li></ul><h4>The Bad</h4><ul><li>The model is susceptible to minor adjustments, even if you set the temperature to 0. Sometimes, changing a symbol or deleting a word can impact its performance</li><li>The model never tells if you made grammatical errors; you only see them in the results, which means extensive version controls (do you really want to version control every letter or symbol change?)</li><li>Sometimes, you need to use tailored prompts/question styles so the model can better understand it.</li><li>The tuned model requires more tokens (~4x compared to zero-shot) and will continue expanding to cover more use cases. A larger context is more expensive.</li><li>Unlike programming languages that are “mostly” deterministic, LLMs aren’t. They have wild thoughts, memories, and knowledge, so they might want to be a bit creative, which is exactly what we DON’T NEED in networking !!<br>Imagine, during an SAT exam, a student crosses out one of the multiple answers and adds her own answer (creativity in exchange for a point? I don’t think so!)</li></ul><h4>The Ugly</h4><p><strong>The model result is inconsistent.</strong></p><ul><li>Occasionally, you’ll see the model answer the same question correctly 50% of the time or even 99% of the time. (Four questions were answered correctly 99/100 times.) This makes tuning extremely challenging. (RLHF can potentially help here; I provided no feedback to the model.)<br>Imagine never telling students which question they got correct on an exam and expecting them to achieve 100% by brute force, forcing them to retake exams; good luck with that!</li><li>The model still hallucinates as usual.</li></ul><p><strong>The model can be stuck with past memory.</strong></p><ul><li>During training, if one type of data appears too frequently, the model will not easily forget that, no matter how “bad” that memory was.</li></ul><h3>Scalability Considerations</h3><p>To efficiently scale this deployment, we may consider the following approaches:</p><ul><li>Incorporate RAG — However, this means another level of dependency on the retrieval process’s accuracy. Additionally, as LLMs context windows get larger and even <a href="https://arxiv.org/pdf/2404.07143.pdf">infinite context windows</a>, the use of RAG will diminish.</li><li>Multi-agent — Each agent is responsible for one area of knowledge. (hardware query vs. routing table query).</li><li>Fine-tuning — Tune the weights with new training data so the model can answer questions without extra instructions. However, be aware of catastrophic forgetting.</li><li>Hybrid — Mix instruction tuning with the function-calling feature.</li></ul><h3>Instruction Tuning Pros and Cons</h3><h4>Pros</h4><ul><li>Tuned using human natural language</li><li>Expert knowledge of LLMs is optional as long as the pipeline is built.</li><li>Easy to iterate, update, and expand as needed</li></ul><h4>Cons</h4><ul><li>Additional efforts are required to convert vendor documents if they aren’t well-written</li><li>It is costly if the software backend isn’t well designed to scale</li><li>Context window limit</li><li>It&#39;s difficult to debug because it’s all natural language based. Machines still don’t quite understand words the same way humans do.</li></ul><h3>Additional Tests To Consider</h3><p>My testing pipeline only contains questions that should always yield a command as the answer. Additional testing cases to be considered:</p><ul><li>Test the model’s ability to respond with “insufficient information” when no specific class definition is given to reduce hallucinations</li><li>Test the model’s ability to explain the result when requested by the user</li><li>Test the model’s ability to quote the object definition where it is referenced</li><li>Test the model’s ability to respond to the same question but asked in different ways</li></ul><h3>Accuracy Improvements and Alternatives</h3><ul><li>Compare against different models, such as Claude 3 Opus 3, LLaMA3, or Mistral, to see if a better model exists, or even vote among various models for the best results.</li><li>Try a model built explicitly for instruction tuning, such as the FLAN-T5 model.</li><li>Try using another model to help tune instructions iteratively and automatically based on testing results.</li><li>Expand testing datasets to include operational tasks and queries</li></ul><blockquote>From This Point On, It’s All About The Technical Details</blockquote><h3><strong>Tuned Instructions Explained in Details</strong></h3><p>In this section, we’ll review some of the details and intricacy of the <a href="https://github.com/zhangineer/networking_llm_instruction/blob/main/instructions/tuned.md">tuned instructions</a> and their effects on the outcome, for better or worse.</p><h4>Role Definition</h4><pre>You are a co-pilot to the network engineers. <br>* Your responsibilities are to provide assistance to network engineer in constructing Cisco ACI queries and execute commands<br>* Do not provide commands or information that was not provided to you in this instruction<br>* Respond with only the command, do not add any descriptions<br>* Only provide explanation if the user requested<br>* You do not ever apologize and strictly generate networking commands based on the provided examples.<br>* Do not provide any networking commands that can&#39;t be inferred from the instructions<br>* Inform the user when you can&#39;t infer the networking command due to the lack of context of the conversation and state what is the missing in the context.<br>* Do not use any classes not listed in this guide<br>* Do not include &quot;`&quot; symbols in your response<br>* Make sure to review the examples before building the final query<br>* For each question, make sure to always identify the parent class and the children class first, if applicable.<br>* If reverse lookup is needed, make sure to follow the &quot;Reverse Lookup Technique&quot; approach<br>* The following are syntax to construct ACI queries, think step by step to build the query. <br>* Before constructing a query, make sure to carefully review all details of a given class description</pre><p>The role definition helps in the following areas:</p><ul><li>Provides context to control what types of questions to answer.</li><li>Help increase accuracy in more complex queries, such as using the classic “think step by step” technique.</li><li>Control response format — LLMs, by default, are verbose and sometimes will respond with backticks as well as in a code block, which we do not want to include</li></ul><h4>Syntax Format</h4><pre>The general format of a Cisco ACI query command is structured as follows:<br>`moquery -c &lt;class1&gt;,&lt;class2&gt;,&lt;class2&gt; -x &lt;option1&gt; &lt;option2&gt; &lt;option3&gt;`...etc.<br><br>* we only need to specify `-x` once, even for multiple options. <br>* the format `&lt;class1&gt;,&lt;class2&gt;,&lt;class3&gt;` is called multi-class query. It will return all objects for the matching class name.<br><br>* query-target-filter: filter based on query class, general format: `&#39;&lt;operator&gt;(&lt;filter&gt;)&#39;`, where `filter` looks like this `&lt;class&gt;.&lt;attribute&gt;,&quot;value_to_filter&quot;`<br>  * example: `moquery -c &lt;class&gt; -x &#39;query-target-filter=eq(&lt;class&gt;.&lt;attribute&gt;,&quot;value_to_filter&quot;)&#39;`<br>  * never use multiple `query-target-filter` option<br>* available operators are:<br>  1. `eq`: equal<br>  2. `ne`: not equal<br>  3. `gt`: greater than, only applies to numerical values<br>  4. `wcard`: wild card or contains<br>  5. `bw`: between 2 numerical values or time stamps<br>  6. `ge`: greater than or equal to<br>  7. `le`: less than or equal to<br>  8. `lt`: less than, only applies to numerical values<br>  9. `or`: or<br>  10. `and`: and<br>* rsp-subtree: Specifies child object level included in the response, valid values are: `no | children | full`<br>* rsp-subtree-class: Respond only specified classes in the subtree.<br>* rsp-subtree-filter: Respond only if the subtree classes matching conditions<br>* rsp-subtree-include: Request additional objects in the subtree<br>  - `required`. If `rsp-subtree-class` option is used, we should always add the `required` option.<br>  - `no-scoped` Response includes only the requested subtree information. Useful for getting faults related to an object.<br>* query-target:  restricts the scope of the query. valid options are `self(default) | children | subtree`<br>* order-by: Sort the response based on the property values, valid values are `asc (ascending) | desc(descending)`<br>* page-size: return a limited number of results</pre><ul><li>For consistency purposes, I provided only the API syntax to ChatGPT. (there is also a format using moquery -c &lt;class&gt; -f &lt;filter&gt;, for example, moquery -c fvAEPg -f ‘fv.AEPg.pcTag==”xxxx”&#39;.)</li><li>Not all syntax formats are provided; these cover the most common usages</li></ul><h4>Reverse Lookup Technique</h4><pre>## Reverse Lookup Technique<br>If user asks to get parent object based a child object, we need to perform reverse lookup.<br>`moquery -c &lt;parent_class&gt; -x rsp-subtree-class=&lt;child_class&gt; rsp-subtree-include=required rsp-subtree=children &#39;rsp-subtree-filter=eq(&lt;child_class&gt;.&lt;attribute&gt;,&quot;value_to_match&quot;)&#39;`<br>Explanation:<br>* `rsp-subtree-class` defines what the child class we want to target<br>* `rsp-subtree-include=required` ensures that we return parent object only if the child object class exist ( this should always be used by default in most cases )<br>* `rsp-subtree=children` returns all the children objects<br>* `rsp-subtree-filter` applies the filter, note that we use child_class here.</pre><ul><li>This section is created to answer complex questions requiring a reverse lookup (i.e., given the child’s object, find the parent’s attributes).</li><li>ChatGPT cannot derive such understanding on its own if it is only provided a description of each option flag. Spelling out special instructions, if needed, is critical, highlighting the importance of human guidance.</li><li>Both zero-shot and few-shot models performed poorly in this area</li></ul><h4>Example With Explanation</h4><pre>## Example<br>Assuming that you are provided the following class information<br>```<br>### fvTenant: Tenant class<br>* `name`: name of the Tenant<br>* CHILDREN CLASSES:<br>  - `fvAp`: Application Profile class<br>    - `name`: name of the application profile<br>    - CHILDREN CLASSES:<br>      - `fvAEPg`: EPG class<br>        - `name`: name of the EPG<br>  - `fvBD`: Bridge Domain class<br>    - `name`: name of the bridge domain<br>    - CHILDREN CLASSES:      &lt;&lt;&lt;&lt; Nested children class<br>      - `fvSubnet`: Subnet class<br>        - `ip`: ip subnet, example &quot;10.0.0.1/24&quot;<br>```<br>* To get the Tenant named `example_tenant` with no additional children information: `moquery -c fvTenant -x &#39;query-target-filter=eq(fvTenant.name,&quot;example_tenant&quot;)`<br>* To get a list of AP in Tenant `example_tenant`: `moquery -c fvTenant -x &#39;query-target-filter=eq(fvTenant.name,&quot;example_tenant&quot;) rsp-subtree-class=fvAp rsp-subtree=children`<br>* To get a list of EPGs in Tenant `example_tenant`: `moquery -c fvTenant -x &#39;query-target-filter=eq(fvTenant.name,&quot;example_tenant&quot;)&#39; rsp-subtree-class=fvAEPg rsp-subtree=full rsp-subtree-include=required`<br>* To get the EPG named `my_epg` in tenant `example_tenant`, we need to perform a reverse lookup with a filter: `moquery -c fvTenant -x rsp-subtree-class=fvAEPg rsp-subtree=full rsp-subtree-include=required &#39;query-target-filter=eq(fvAEPg.name,&quot;my_epg&quot;)`<br>* To find all BD and APs of Tenant `example_tenant`, use comma to separate multiple classes query: `moquery -c fvTenant -x rsp-subtree-class=fvAp,fvBD rsp-subtree=children &#39;query-target-filter=eq(fvTenant.name,&quot;example_tenant&quot;)&#39;`<br>* To get all the faults related to Tenant `example_tenant`: `moquery -c fvTenant -x rsp-subtree-include=faults,no-scoped query-target=subtree`<br>* To get a list of Tenants and associated EPGs, excluding any Tenant named `common`: `moquery -c fvTenant -x rsp-subtree=full &#39;query-target-filter=ne(fvTenant.name,&quot;common&quot;) rsp-subtree-class=fvAEPg rsp-subtree-include=required&#39;`<br>**note** we use `rsp-subtree=full` if the children class is more than 2 layers down from the parent object</pre><p>The above helps “explain” to ChatGPT how to interpret the class object structure. The goal was to solve the problem of ChatGPT not being able to follow nested objects properly. However, this approach resulted in little improvements (ChatGPT was able to answer some of the advanced questions with nested objects correctly, but is still inconsistent)</p><h4>Q&amp;A Examples</h4><pre>## Q&amp;A Examples:<br>Here are some moquery examples:<br>* how to get a list of BDs in tenant common?  <br>`moquery -c fvBD -x &#39;query-target-filter=wcard(fvBD.dn,&quot;/tn-common/&quot;)&#39;`<br>* how to get the BD with the exact name of either &quot;customer&quot; or &quot;cust&quot;, regardless of which tenant they belong to?  <br>`moquery -c fvBD -x &#39;query-target-filter=or(eq(fvBD.name,&quot;customer&quot;),eq(fvBD.name,&quot;cust&quot;))&#39;`<br>* how to get all BDs with unicast routing disabled in Tenant common?  <br>`moquery -c fvBD -x &#39;query-target-filter=and(wcard(fvBD.dn,&quot;/tn-common/&quot;),eq(fvBD.unicastRoute,&quot;no&quot;))&#39;`  <br>* how to get all BDs that has a subnet configured?  <br>`moquery -c fvBD -x rsp-subtree-class=fvSubnet rsp-subtree=children rsp-subtree-include=required`  <br>* how to get all BDs that has a subnet configured, and the subnet must also route leak?  <br>`moquery -c fvBD -x rsp-subtree-class=fvSubnet rsp-subtree=children rsp-subtree-include=required &#39;rsp-subtree-filter=eq(fvSubnet.scope,&quot;shared&quot;)&#39;`<br>* how to get a list of static path bindings tagged with VLAN 1?  <br>`moquery -c fvRsPathAtt -x &#39;query-target-filter=and(eq(fvRsPathAtt.encap,&quot;vlan-1&quot;),eq(fvRsPathAtt.mode,&quot;regular&quot;))&#39;`<br>* how to get a list of static path bindings tagged with VLAN 10?  <br>`moquery -c fvRsPathAtt -x &#39;query-target-filter=and(eq(fvRsPathAtt.encap,&quot;vlan-10),eq(fvRsPathAtt.mode,&quot;regular&quot;))&#39;`<br>* how to get a list of path bindings tagged with VLAN 50?  <br>`moquery -c fvRsPathAtt -x &#39;query-target-filter=and(eq(fvRsPathAtt.encap,&quot;vlan-50),eq(fvRsPathAtt.mode,&quot;regular&quot;))&#39;`<br>* how to get a list of static path bindings in VLAN 5?  <br>`moquery -c fvRsPathAtt -x &#39;query-target-filter=eq(fvRsPathAtt.encap,&quot;vlan-5&quot;)&#39;`<br>* how to get a list of static path bindings for leaf 101 and leaf 102, interface 1/24 assuming that this interface is not part of vPC or PC?  <br>`moquery -c fvRsPathAtt -x &#39;query-target-filter=wcard(fvRsPathAtt.dn,&quot;paths-101/pathep-\[eth1/4\]&quot;)&#39;`<br>* how to get all the bridge domains, ordered by modification date, latest first, return only the top 1st result?  <br>`moquery -c fvBD -x page-size=1 page=0 order-by=&#39;fvBD.modTs|desc&#39;`<br>* how to get all configuration changes made to tenant &quot;demo&quot; between time 2023/12/21 5 AM and 202/12/30 9 PM?  <br>`moquery -c aaaModLR -x &#39;query-target-filter=and(bw(aaaModLR.created,&quot;2023-12-21T05:00&quot;,&quot;2023-12-30T21:00&quot;),wcard(aaaModLR.affected,&quot;tn-demo/&quot;))&#39;`<br>* how to find configurations with specifically `deleted` action by user admin between 2024-02-08 and 2024-02-10?  <br>`moquery -c aaaModLR -x &#39;query-target-filter=and(eq(aaaModLR.ind,&quot;deletion&quot;),eq(aaaModLR.user,&quot;admin&quot;),bw(aaaModLR.created,&quot;2024-02-01&quot;,&quot;2024-02-15&quot;))&#39;`<br>* how to find out how many Bridge Domain objects there are?<br>`moquery -c fvBD -x rsp-subtree-include=count`<br>* how to get a list of BDs associated with vrf &quot;demo_vrf&quot;?  <br>`moquery -c fvBD -x rsp-subtree-class=fvRsCtx rsp-subtree=children rsp-subtree-include=required &#39;rsp-subtree-filter=eq(fvRsCtx.tnFvCtxName,&quot;demo_vrf&quot;)&#39;`<br>* how to find all the consumers and providers of contract &quot;application_contract&quot;?  <br>`moquery -c fvAEPg -x rsp-subtree=children rsp-subtree-class=fvRsProv,fvRsCons rsp-subtree-include=required &#39;rsp-subtree-filter=or(eq(fvRsProv.tnVzBrCPName,&quot;application_contract&quot;),eq(fvRsCons.tnVzBrCPName,&quot;application_contract&quot;))&#39;`</pre><ul><li>LLMs typically use the above example format for fine-tuning and few-shot learnings.</li><li>ChatGPT had issues interpreting the meaning of tagged with and in for VLANs; hence, the same example was repeated.</li><li>Providing examples like these is highly effective compared to zero-shot models; however, examples alone are insufficient to achieve higher accuracy.</li></ul><h4>Individual Class Object Descriptions</h4><p>Below, I have listed only the high-level summary and the first class. The remaining class description structure repeats.</p><pre>## Frequently Used Classes and Attributes Layout<br>* The following describes the attributes for each class.<br>* Many classes have children classes as well. and each children class also has their own attributes.<br>  - Children classes can be directly queried, or it can be included when querying against a parent class using option `-x rsp-subtree=children`<br>  - For nested children class, use `-x rsp-subtree=full`<br>* `dn` is a universal attribute available to all classes, it means distinguished name<br>* Every class has an attribute of `dn`, but not all are included as they are pretty obvious.<br>* values in `( )` defines available options if not specifically called out.<br><br>### fvBD: Bridge Domain Class<br>**note**: there are default bridge domains already-exists and we typically want to exclude them from queries, their names are: `default`,`ave-ctrl`, and `inb`<br>* `name`: name of a bridge domain<br>* `dn` example: `uni/tn-demo/BD-demo_web_bd`<br>* `mac`: MAC address of the bridge domain, default = 00:22:BD:F8:19:FF<br>* `hostBasedRouting(yes/no)`: whether host based routing is enabled or not. <br>* `unicastRoute(yes/no)`: The forwarding method based on predefined forwarding criteria (IP or MAC address), default = yes<br>* `unkMacUcastAct(flood/proxy)`: The forwarding method for unknown layer 2 destinations, default = proxy<br>* `limitIpLearnToSubnets(yes/no)`: limit ip learning to subnet only or not, default = no<br>* `arpFlood(yes/no)`: whether arp flood is enabled or not, we should automatically exclude default BDs when user asks for this.<br>* `descr`: description of the bridge domain<br>* CHILDREN CLASSES:<br>  - `fvSubnet`: class for subnets under a bridge domain<br>    * `ip`: subnet<br>    * `scope(public/shared/private)`: `public` = advertised out, `shared` = route leaking, `private` = not advertised out. In addition to individual options, you can also join them with comma, available combinations are: `public,shared`, `private,shared`<br>  - `fvRsBDToOut`: class related to Bridge Domain, for L3Out<br>    * `tnL3extOutName`: name of the L3Out associated with the bridge domain<br>    * `dn` example: uni/tn-demo/BD-demo_bd/rsBDToOut-demo_l3out<br>  - `fvRsCtx`: class related to Bridge Domain, for VRF<br>    * `tnFvCtxName`: name of the vrf associated with the bridge domain<br>    * `dn` example: uni/tn-demo/BD-demo_web_bd/rsctx</pre><ul><li>A high-level summary briefly explains the structure of classes and the format that I use to suggest how to interpret them.</li><li>This line is another reminder to ChatGPT that for nested child class, use a different flag — For nested children class, use `-x rsp-subtree=full`</li><li>The header for the class name and a short description — ### fvBD: Bridge Domain Class. This information is critical for ChatGPT to know which class to use for a given query before diving into the attributes.</li><li>The **note section helps highlight important information. This worked very well with Claude, but it’s hit or miss with ChatGPT.</li><li>I manually created each object description, aligning it with my understanding. I also referenced Cisco’s official document when needed.</li><li>Not every attribute is listed for two reasons: to reduce hallucinations and control ChatGPT’s knowledge scope.</li><li>Objects descriptions could use more improvements, such as this sub-class: fvRsBDToOut`: class related to Bridge Domain, for L3Out. The reason that it’s described seemingly backward is because I noticed that ChatGPT will pick up L3out as a cue first if it’s described like this `fvRsBDToOut`: L3Out relationship class associated with Bridge Domain, which leads to ChatGPT thinking that this is for L3Out. <br>Again, the object relationship and nesting concept described here are challenges for ChatGPT to grasp. (It’s also possible that I haven’t found the perfect English words to describe it)</li><li>The values inside () are for ChatGPT to understand all available options; some are straightforward, and others aren’t. Therefore, an extra description of each option is required. For example:</li></ul><blockquote>scope(public/shared/private): `public` = advertised out, `shared` = route leaking, `private` = not advertised out. In addition to individual options, you can also join them with comma, available combinations are: `public,shared`, `private,shared`</blockquote><p>An engineer might ask something like, “What are the routes advertised out and leaked?” instead of “What are the public and shared routes?” Keep in mind that user prompts will influence ChatGPT, but from a UX/UI perspective, we should minimize such an effect.</p><h3>Individual Question Analysis</h3><p>The following chart shows chatGPT’s weaknesses with the tuned instructions. We’ll take a deeper look at some of the questions that even the instruction-tuned model failed miserably and see if we can gain some insights to understand better how we might be able to address them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Fx-2g5Jlh5we7XKbkxsFw.png" /><figcaption>Individual Question Score with Tuned Instructions</figcaption></figure><h4>Q15 (Score 51%) — Bug in the pipeline (not 100% the model’s fault)</h4><p>Below is the partial ACI response from the Q15 command for both the correct answer and ChatGPT’s answer.</p><pre>Question: Q15. how to find the fabric TEP address pool<br>2024-04-21 21:51:37,075 - __main__ - INFO - correct answer cmd: moquery -c topSystem -x &#39;query-target-filter=eq(topSystem.role,&quot;controller&quot;)&#39;<br>2024-04-21 21:51:37,075 - __main__ - INFO - gpt answer cmd: moquery -c topSystem -x &#39;query-target-filter=wcard(topSystem.dn,&quot;/pod-&quot;)&#39;<br>2024-04-21 21:51:38,963 - __main__ - INFO - correct cmd output: {<br>  &quot;totalCount&quot;: &quot;1&quot;,<br>  &quot;imdata&quot;: [<br>    {<br>      &quot;topSystem&quot;: {<br>        &quot;attributes&quot;: {<br>          &quot;address&quot;: &quot;10.0.0.1&quot;,<br>          &quot;bootstrapState&quot;: &quot;none&quot;,<br>          &quot;childAction&quot;: &quot;&quot;,<br>          &quot;clusterTimeDiff&quot;: &quot;-1&quot;,<br>          &quot;configIssues&quot;: &quot;&quot;,<br>          &quot;controlPlaneMTU&quot;: &quot;9000&quot;,<br>          &quot;currentTime&quot;: &quot;2024-04-21T21:51:30.922+00:00&quot;, &lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>&lt; SNIP &gt;<br><br>2024-04-21 21:51:38,963 - __main__ - INFO - chatGPT cmd output: {<br>  &quot;totalCount&quot;: &quot;1&quot;,<br>  &quot;imdata&quot;: [<br>    {<br>      &quot;topSystem&quot;: {<br>        &quot;attributes&quot;: {<br>          &quot;address&quot;: &quot;10.0.0.1&quot;,<br>          &quot;bootstrapState&quot;: &quot;none&quot;,<br>          &quot;childAction&quot;: &quot;&quot;,<br>          &quot;clusterTimeDiff&quot;: &quot;0&quot;,<br>          &quot;configIssues&quot;: &quot;&quot;,<br>          &quot;controlPlaneMTU&quot;: &quot;9000&quot;,<br>          &quot;currentTime&quot;: &quot;2024-04-21T21:51:31.879+00:00&quot;, &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>&lt; SNIP &gt;</pre><p>This question is <strong>sometimes </strong>marked incorrectly because there is a currentTime element that changes each time we make a query.</p><p>So, in this case, it was a bug in the validation pipeline; ChatGPT’s score probably should’ve been higher.</p><p><strong>Potential Solution</strong>: Skip comparing results/fields that will change per query. Evaluating answers based on a specific format is not a good approach. ChatGPT can sometimes surprise you with its response.</p><p>But wait, what about the other 49% of the times that it was correct? Since the time element changes each time, shouldn’t it be wrong 100% of the time?</p><p>Because we have a logic that checks for the commands first, and if it’s 100% matched, we do not need to compare the output, as shown below</p><pre>Question: Q15. how to find the fabric TEP address pool<br>2024-04-21 21:48:30,038 - __main__ - INFO - correct answer cmd: moquery -c topSystem -x &#39;query-target-filter=eq(topSystem.role,&quot;controller&quot;)&#39;<br>2024-04-21 21:48:30,038 - __main__ - INFO - gpt answer cmd: moquery -c topSystem -x &#39;query-target-filter=eq(topSystem.role,&quot;controller&quot;)&#39;<br>2024-04-21 21:48:30,038 - __main__ - INFO - command is 100% matched</pre><p>If ChatGPT had been more consistent, we wouldn’t have discussed Q15.</p><h4>Q18: Class/Attribute Confusion</h4><pre>Question: Q18. how to get a list of subnets advertised out and also route leaked<br><br>different filter used<br>2024-04-21 21:45:17,112 - __main__ - INFO - correct answer cmd: moquery -c fvSubnet -x &#39;query-target-filter=eq(fvSubnet.scope,&quot;public,shared&quot;)&#39;<br>2024-04-21 21:45:17,112 - __main__ - INFO - gpt answer cmd: moquery -c fvSubnet -x &#39;query-target-filter=wcard(fvSubnet.scope,&quot;public,shared&quot;)&#39;<br><br>incorrect syntax<br>2024-04-21 21:38:53,470 - __main__ - INFO - correct answer cmd: moquery -c fvSubnet -x &#39;query-target-filter=eq(fvSubnet.scope,&quot;public,shared&quot;)&#39;<br>2024-04-21 21:38:53,470 - __main__ - INFO - gpt answer cmd: moquery -c fvSubnet -x &#39;query-target-filter=or(eq(fvSubnet.scope,&quot;export-rtctrl&quot;),eq(fvSubnet.scope,&quot;shared-rtctrl&quot;))&#39;</pre><p>In the first response, ChatGPT’s used a wcard filter instead of eq, which is fine but not ideal. Frankly, in this specific case, eq and wcard made no difference.</p><p>In the second response, ChatGPT provided an invalid syntax.</p><p>Here is the fvSubnet class:</p><pre>### fvBD: Bridge Domain Class<br>* `name`: name of a bridge domain<br>&lt;SNIP&gt;<br>* CHILDREN CLASSES:<br>  - `fvSubnet`: class for subnets under a bridge domain<br>    * `ip`: subnet<br>    * `scope(public/shared/private)`: `public` = advertised out, `shared` = route leaking, `private` = not advertised out. In addition to individual options, you can also join them with comma, available combinations are: `public,shared`, `private,shared`</pre><p>There are no export-rtctrl or shared-rtctrl attributes, so where did ChatGPT get them from?</p><p>They are from the L3Out class description, as shown below; l3extSubnet (child class of L3Out) contains attributes with the same name, ip, and scope, but ChatGPT should’ve followed the class name first. It is also possible that ChatGPT picked up the description of scope of the subnet prefix without awareness of the context.</p><blockquote><strong>This implies that ChatGPT doesn’t always understand the class/attribute hierarchy. We’ll see more of these later.</strong></blockquote><pre>### l3extOut: layer3 out (L3out) class<br>* `name`: name of the L3Out profile<br>* CHILDREN CLASSES:<br>  - `l3extInstP`: L3out EPG<br>    - `dn` example: `uni/tn-demo/out-demo_l3out/instP-demo_l3out_epg`<br>    - `prefGrMemb(include/exclude)`: Preferred group member<br>    - CHILDREN CLASSES:<br>      - `l3extSubnet`: This class is for L3Out EPG prefixes<br>        - `ip`: prefix IP address. e.g. `0.0.0.0/0`<br>        - `scope`: scope of the subnet prefix, available options are `export-rtctrl`, `import-security`, `shared-rtctrl`, `shared-security`, can be combined. `import-security` is the default.<br>        - `aggregate`: whether aggregate options are used, available options are `export-rtctrl` and `shared-rtctrl`, can be combined.</pre><p><strong>Potential Solution: </strong>Emphasize the importance of the class, attribute, and children&#39;s class hierarchy in syntax description. Provide more distinctive descriptions when attribute names overlap across different classes.</p><h4>Q21 — Prompt Issue and Concept Confusion</h4><p><strong>Q:</strong> <strong>How to get a list of BDs excluding the default ones?</strong></p><p>Below are examples of ChatGPT’s answer in 2 different instances, which unveils two potential issues.</p><pre>Question: Q21. how to get a list of BDs excluding the default ones<br>2024-04-21 21:51:40,927 - __main__ - INFO - correct answer cmd: moquery -c fvBD -x &#39;query-target-filter=and(ne(fvBD.name,&quot;inb&quot;),ne(fvBD.name,&quot;ave-ctrl&quot;),ne(fvBD.name,&quot;default&quot;))&#39;<br>2024-04-21 21:51:40,928 - __main__ - INFO - gpt answer cmd: moquery -c fvBD -x &#39;query-target-filter=ne(fvBD.name,&quot;default&quot;) ne(fvBD.name,&quot;ave-ctrl&quot;) ne(fvBD.name,&quot;inb&quot;)&#39;<br><br>2024-04-21 21:48:31,942 - __main__ - INFO - Question: Q21. how to get a list of BDs excluding the default ones<br>2024-04-21 21:48:31,942 - __main__ - INFO - correct answer cmd: moquery -c fvBD -x &#39;query-target-filter=and(ne(fvBD.name,&quot;inb&quot;),ne(fvBD.name,&quot;ave-ctrl&quot;),ne(fvBD.name,&quot;default&quot;))&#39;<br>2024-04-21 21:48:31,942 - __main__ - INFO - gpt answer cmd: moquery -c fvBD -x &#39;query-target-filter=ne(fvBD.name,&quot;default&quot;)&#39;</pre><p><strong>Issue #1 — Prompt not specific enough or lack of comprehension</strong></p><p>The answer in the first example has invalid syntax. However, when I reviewed the answer to a similar question, ChatGPT scored higher! As shown below:</p><p>Q25: how to get a list of BDs with ARP flooding disabled, excluding default BDs</p><p>This answer required an additional filter and queried against the same class — fvBD. The overall score for this question is 87%</p><pre>2024-04-21 21:42:07,231 - __main__ - INFO - Question: Q25. how to get a list of BDs with ARP flooding disabled, excluding default BDs<br>2024-04-21 21:42:07,231 - __main__ - INFO - correct answer cmd: moquery -c fvBD -x &#39;query-target-filter=and(eq(fvBD.arpFlood,&quot;no&quot;),ne(fvBD.name,&quot;inb&quot;),ne(fvBD.name,&quot;ave-ctrl&quot;),ne(fvBD.name,&quot;default&quot;))&#39;<br>2024-04-21 21:42:07,231 - __main__ - INFO - gpt answer cmd: moquery -c fvBD -x &#39;query-target-filter=and(ne(fvBD.name,&quot;default&quot;),ne(fvBD.name,&quot;ave-ctrl&quot;),ne(fvBD.name,&quot;inb&quot;),eq(fvBD.arpFlood,&quot;no&quot;))&#39;</pre><p><strong>Issue #2 — ChatGPT is confused with the term “default” in some contexts.</strong></p><p>“setting named <strong>default</strong>” is different from “<strong>default</strong> settings.” The former refers to a specific setting that uses the name “default,” and the latter could refer to multiple settings that were never changed.</p><p>As shown below</p><p>This is correct:</p><pre>moquery -c fvBD -x &#39;query-target-filter=and(ne(fvBD.name,&quot;inb&quot;),ne(fvBD.name,&quot;ave-ctrl&quot;),ne(fvBD.name,&quot;default&quot;))&#39;</pre><p>This is incorrect</p><pre>moquery -c fvBD -x &#39;query-target-filter=ne(fvBD.name,&quot;default&quot;)&#39;</pre><p><strong>Potential Solution</strong>: Rephrase the question and differentiate these two concepts with more diversified examples.</p><p>Additionally, with some step-by-step prompts, ChatGPT knows how to answer this question. It’s frustrating that it didn’t answer correctly on the first try, resulting in a bad user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-HPVYGk9NQLRfxBhiwlaQ.png" /><figcaption>LLM can reason well if prompted step-by-step</figcaption></figure><blockquote>Side note: I tried the same in Claude Opus3, and it got the answer correctly on the first try! Maybe I’ll write a blog on Claude next to compare performance.</blockquote><h4>Q35 — Hallucination</h4><p>This question is a bit tricky because the EPG object path is tn-Tenant/ap-ANP/epg-EPG , and AP information was not given, so we need to perform a wcard match on the Tenant name and EPG name at the same time.</p><p>As shown below, ChatGPT essentially made up the AP name when the AP information was not given.</p><pre>Q35. how to get a list of path bindings in EPG epg_vlan0005 in tenant demo<br><br>correct answer cmd: moquery -c fvRsPathAtt -x &#39;query-target-filter=and(wcard(fvRsPathAtt.dn,&quot;epg-epg_vlan0005/&quot;),wcard(fvRsPathAtt.dn,&quot;tn-demo/&quot;))&#39;<br>gpt answer cmd: moquery -c fvRsPathAtt -x &#39;query-target-filter=wcard(fvRsPathAtt.dn,&quot;/tn-demo/ap-demo_anp/epg-epg_vlan0005/&quot;)&#39;</pre><p><strong>Potential Solution</strong>: Try adding more specific examples to illustrate the use of concatenating wildcard-based matches.</p><h4>Q31 &amp; Q32 — Preposition Words</h4><p>A particularly interesting issue I encountered was that ChatGPT couldn’t grasp the difference between “<strong>tagged with</strong> VLAN 5” vs. “<strong>in</strong> VLAN 5”.</p><p>Network engineers know that the former refers to VLAN tagging, and the latter is more generic regardless of the port configuration mode. This is the same in ACI.</p><p>Though both Q31 and Q32 had perfect scores, it was largely due to my extra effort to ensure that ChatGPT could distinguish between them. This is still a potential issue that will require more tuning.</p><p>As shown below, I have used several examples of the same question to emphasize the difference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JNOnfUsx74KmYA0Hm1W-pw.png" /><figcaption>Tagged VLAN vs. In VLAN Examples</figcaption></figure><h4>Q39 — Unable to Comprehend Hierarchical Nested Object Definitions</h4><p>Given the following object descriptions and questions:</p><p>Pay attention to where the action(permit/deny) is applied for a filter.</p><pre>### vzBrCP: Contract class<br>* `name`: name of the contract<br>* CHILDREN CLASSES:<br>  - `vzSubj`: Contract subject class<br>    - `name`: name of the subject<br>    - CHILDREN CLASSES:<br>      - `vzRsSubjFiltAtt`: class related to the subject, for filters<br>        - `tnVzFilterName`: name of the filter<br>        - `action(permit/deny)`: action of the filter.<br><br>### vzFilter: Filter class<br>* `name`: name of the filter<br>* CHILDREN CLASSES:<br>  - `vzEntry`: Filter entry class. Multiple filter entries can be associated with a filter<br>    - `name`: name of the filter entry<br>    - `dFromPort`: starting port number<br>    - `dToPort`: end port number<br>    - `protocol(tcp/udp/icmp)`: protocol for the filter entry.</pre><p><strong>Question: </strong><em>how to get a list of filters with permit actions?</em></p><pre>correct answer cmd: moquery -c vzRsSubjFiltAtt -x &#39;query-target-filter=eq(vzRsSubjFiltAtt.action,&quot;permit&quot;)&#39;<br>gpt answer cmd: moquery -c vzFilter -x &#39;query-target-filter=wcard(vzFilter.dn,&quot;/subj-[permit]/&quot;)&#39;</pre><p>This is one of the trickier questions.</p><ul><li>filter(vzFilter) object is where you define what the filter contains</li><li>filter entries(vzEntry) object is where you define the specific protocols. Multiple entries can be part of the same filter</li><li>subject filter(vzSubjFFiltAt is where you apply the action permit/deny; hence, this is the class we want to query for.</li></ul><p><strong>Potential Solutions: </strong>One of the things that I can try is to be more precise in the vzRsSubjFiltAtt description, and I can directly tell ChatGPT to use this class for retrieving actions. However, this is not a single instance.</p><h4>Q43 — Unable to Comprehend Well When Synonymous Words Used For Different Reasons</h4><p>Given the following object descriptions and question:</p><pre>### aaaModLR: audit log class<br>* `user`: name of the user who performed the action<br>* `ind`: used to indicate the state of an object. valid values are `creation`, `modification` or `deletion`<br>* `created`: a property indicate when the specific audit log was created. this does not imply whether a configuration is `created`, `modified` or `deleted`<br>**note** to get dates of audit log, use `created`. To get configurations made, use `ind`</pre><p><strong>Question:</strong> <em>how to find the total number of configuration changes created between 2024–03–20 and 2024–03–25?</em></p><pre>correct answer cmd: moquery -c aaaModLR -x &#39;query-target-filter=and(eq(aaaModLR.ind,&quot;creation&quot;),bw(aaaModLR.created,&quot;2024-03-20T00:00&quot;,&quot;2024-03-25T23:59&quot;))&#39; rsp-subtree-include=count<br>gpt answer cmd: moquery -c aaaModLR -x &#39;query-target-filter=bw(aaaModLR.created,&quot;2024-03-20T00:00&quot;,&quot;2024-03-25T23:59&quot;) rsp-subtree-include=count&#39;</pre><p>Here is an example output</p><pre># aaa.ModLR<br>id           : 4294967791<br>affected     : uni/backupst/snapshots-[uni/fabric/configexp-DailyAutoBackup]/snapshot-run-2024-03-25T17-00-15<br>cause        : transition<br>changeSet    : name:run-2024-03-25T17-00-15, retire:no, userdom:all<br>childAction  :<br>clientTag    :<br>code         : E4208927<br>created      : 2024-03-25T17:00:18.868+00:00<br>descr        : Snapshot run-2024-03-25T17-00-15 created<br>dn           : subj-[uni/backupst/snapshots-[uni/fabric/configexp-DailyAutoBackup]/snapshot-run-2024-03-25T17-00-15]/mod-4294967791<br>ind          : creation<br>modTs        : never<br>rn           : mod-4294967791<br>sessionId    :<br>severity     : info<br>status       :<br>trig         : config<br>txId         : 221489<br>user         : admin</pre><ul><li>The line: ind : creation implies the actual action taken. In this case, the user created a new object. Other potential values are modified and deleted.</li><li>The line: created : 2024–03–25T17:00:18.868+00:00 implies when the creation happened.</li><li>This is somewhat confusing to the model. It couldn’t understand the difference between created and creation, and ChatGPT ended up ignoring that field altogether in the example provided above.</li><li>I also intentionally added a “note” to help ChatGPT better understand the difference but without luck.</li></ul><blockquote>Again, Anthropic’s Claude Opus 3 wins—I am pretty impressed. Below is the answer on the first try. This also validates that my instruction is OK.</blockquote><blockquote><strong>To find the total number of configuration changes created between 2024–03–20 and 2024–03–25, use the following query:</strong></blockquote><blockquote><strong>moquery -c aaaModLR -x ‘query-target-filter=and(eq(aaaModLR.ind,“creation”),bw(aaaModLR.created,”2024–03–20&quot;,”2024–03–25&quot;))’ rsp-subtree-include=count</strong></blockquote><h3>The Future Of Domain-Specific LLMs</h3><p>Generative AI with transformers is a fast-paced, evolving technology that showed no signs of slowing down. One of the most promising aspects is that it lowers the bar for non-programmers to automate tasks.</p><p>Many domain experts are not exactly expert programmers. However, the need to automate tasks is increasing as data center technologies become more complex and intertwined.</p><p>I view LLM as another programming abstraction layer, similar to Python, as an abstraction layer to C/C++ for specific libraries.</p><p>For simple or even mildly complex tasks, LLMs are the perfect tools to empower data center engineers and architects to be more efficient, for example:</p><ul><li>During troubleshooting, engineers can describe a problem at a high level for LLM, executing commands across different devices to collect information. This cannot be easily automated using Ansible or Python because every situation is unique. However, Ansible/Python can become a tool for LLM to retrieve relative information. (We’ll demonstrate this in a future blog)</li><li>When performing configuration tasks, LLM can assist in configuration recommendations. This is extremely powerful, for example: <br>switch trunk allowed v &lt;vlan&gt; <br>vs. <br>switch trunk allowed v add &lt;vlan&gt; <br><strong>makes a huge difference.</strong></li></ul><p>Now, LLM has advanced to the point where we can describe intentions at the human level instead of code. The trade-off is that we lose some control of the outcome.</p><blockquote>If you were to hire an assistant to help you in your daily networking tasks, what would you trust/not trust that assistant with?</blockquote><h3>Conclusions</h3><p>Instruction tuning is one of my favorite approaches to enhance LLMs’ ability for domain-specific tasks because it is human-friendly and more approachable for non-programmers.</p><p>However, the downside is hallucinations, less control, and constant tweaking of the instruction language, which can be frustrating.</p><p>On the other hand, function calling is the opposite, where the software engineer controls 90% of the outcome but requires more engineering efforts, and not all use cases are covered.</p><p>I will explore multi-agent and multi-modality in future blogs for a more robust user experience; stay tuned!</p><blockquote>I hope you enjoyed this article; please reach out to me on <a href="https://www.linkedin.com/in/zhangineer/">LinkedIn</a> if you have any questions or want to discuss this further !!</blockquote><p>Lastly, some data didn’t get their spotlight, but they also provided good insights.</p><h3>Extra Data For Fun</h3><p><strong>Total Tokens and Cost (estimate)</strong></p><ul><li>Zero-shot: using gpt-4–1106-preview, this run costs <strong>$0.03 with 3465 tokens for 9.53% accuracy.</strong></li><li>Few-shot: using gpt-4–1106-preview, this run costs <strong>$0.05 with 4834 tokens for 39.72% accuracy.</strong></li><li>Instruction-tuned: using gpt-4–1106-preview, this run costs <strong>$0.13 with 12666 tokens for 77.52% accuracy.</strong></li></ul><p>The above clearly shows a trade-off between cost and accuracy.</p><p><strong>Invalid Syntax Stats For Tuned Instruction</strong></p><p>Below is a chart showing the number of invalid syntax for each question. This is a good measure of hallucinations. Technically speaking, if ChatGPT understood the syntax instructions, there would be fewer hallucinations. Imagine ChatGPT making up English phrases that never existed.</p><p>In my experience, we rarely see syntax errors when coding or grammatical errors when conversing, implying that the model has seen enough data to avoid making such simple mistakes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HaaO8l3YoWRSMbmGpsds_Q.png" /><figcaption>Invalid Syntax Stats for Tuned Instruction</figcaption></figure><p>As shown below, without tuning, zero-shot and few-shot learnings are far from getting even the syntax correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zt2v9cMqR3GJ0gTPYbdTfw.png" /><figcaption>Invalid Syntax Stats for Each Difficulty</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=997006ca938b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking and LLM in the Age of AI — Pt IV: Knowledge Retrieval using RAG]]></title>
            <link>https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-iv-knowledge-retrieval-using-rag-bf631b3ce558?source=rss-50b00f3ca687------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf631b3ce558</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[llmops]]></category>
            <dc:creator><![CDATA[Peter Zhang]]></dc:creator>
            <pubDate>Sun, 10 Dec 2023 16:56:56 GMT</pubDate>
            <atom:updated>2023-12-17T17:12:53.262Z</atom:updated>
            <content:encoded><![CDATA[<h3>Networking and LLM in the Age of AI — Pt IV: Knowledge Retrieval using RAG</h3><h4>Using RAG to Enforce ACI Policy Standards</h4><blockquote>Networking management can be complex and depends on accurate information to take necessary actions. Taking the wrong action can be costly.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gjL2CtbRgFCP6I84" /><figcaption>Photo by <a href="https://unsplash.com/@syinq?utm_source=medium&amp;utm_medium=referral">Susan Q Yin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article is part of a series. Here are the links to the previous articles</p><ul><li>Part I — <a href="https://medium.com/@zhangineer/network-engineers-in-the-age-of-ai-introduction-619985bbb49f?source=your_stories_page-------------------------------------">Introduction</a></li><li>Part II — <a href="https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-ii-exploring-basic-interactions-b7c7c879e31c?source=your_stories_page-------------------------------------">Exploring Basic Interactions</a></li><li>Part III — <a href="https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-iii-reviewing-the-responses-8d28b0d7fd27?source=your_stories_page-------------------------------------">In-Depth Analysis of ChatGPT’s Responses</a></li></ul><p>In this article, we’ll first briefly discuss the basics of RAG, the process, and the components that makeup RAG. Then, we’ll observe ChatGPT and review its response in each step.</p><h3>RAG (Retrieval Augmented Generation)</h3><p>Large Language Models (LLMs) like ChatGPT have a fundamental limitation: they possess a fixed knowledge cutoff date and don’t continually learn like humans. Moreover, they cannot answer queries about private, unpublished data. While function calls in LLMs can fetch real-time information via REST APIs from other applications, this approach falls short when searching proprietary documents.</p><p>RAG addresses this gap effectively. It retrieves relevant information from a document or a collection of documents, making it particularly useful in contexts where proprietary information is crucial. This article will showcase how RAG can be used to pull configuration guidelines from documents, aiding in auditing configuration changes before deployment. The retrieval process is automatic via function calls triggered by ChatGPT upon detecting a configuration change request.</p><p>RAG-enhanced responses use the information as an added layer of context to the existing instructions. The diagram below illustrates the components and their interactions; note the Pinecone vector database as a critical new element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMmYNKGIIU0SigcrBTx6-w.png" /><figcaption>RAG components</figcaption></figure><h4>Vector Database</h4><p>Vector databases are integral to RAG’s functionality. They store vectors — numerical representations of words (e.g., [0.1, 0.3, 0.123]) — essential in making text documents machine-readable. Common document formats like MS Word, PDF, Markdown, or plain text files must be converted into these vectors.</p><p>While direct retrieval from documents is possible, using a vector database is more efficient and cost-effective. Continually converting documents into vectors for each retrieval is unsustainable and expensive.</p><blockquote>The goal during retrieval is to extract only the most pertinent information in response to a user query, not the entire document.</blockquote><p>For this demonstration, we utilize Pinecone, a cloud-based vector database, to showcase the power and efficiency of this approach.</p><h3>Use Cases</h3><p>Let’s explore several practical use cases where RAG can be applied in networking:</p><ol><li><strong>Networking Configuration Autocorrect</strong>: Before implementing configuration changes, verifying adherence to specific standards is crucial. This could involve ensuring that naming conventions are followed, network interfaces are set up according to a designated template or verifying that a new firewall ACL aligns with the security posture. The goal is to either confirm the user’s compliance with these standards or to provide recommendations when deviations occur.</li><li><strong>Distributed Information Retrieval</strong>: Network engineers often need to access guidelines and policy standards quickly for configuration changes. These policies may be scattered across various documents, databases, or different sections within the same document. Utilizing RAG, we can consolidate this search into a single query, retrieving only the most pertinent information to aid the engineer in completing their task efficiently.</li><li><strong>Troubleshooting Steps Retrieval</strong>: In cases where network operators receive alerts for network events, immediate access to relevant troubleshooting documentation is vital. RAG can be used to locate and retrieve these documents quickly. Furthermore, troubleshooting steps can be carried out by machines following these documents. This not only expedites the resolution process but also ensures accuracy. (We will explore this scenario in greater depth in future blogs.)</li></ol><p>This article will focus on demonstrating use case #1 — Networking Configuration Autocorrect in a Cisco ACI environment.</p><h3>Example Document Used</h3><p>The documentation below details our ACI naming convention and configuration guidelines.</p><p>We will specifically showcase configuring a new Bridge Domain and assess how effectively ChatGPT can recommend the correct course of action to a user based on these guidelines.</p><pre># Cisco ACI Configuration Guidelines for LLM<br><br>This guideline is to help facilitate autonomous agents of LLM  <br>This document describes the policy and standards to be followed when configuring the Cisco ACI fabric.  <br>All LLM configurations must strictly follow this guideline. This is a living document and will be updated frequently.<br><br>## Glossary and Abbreviations<br>* TN = Tenant<br>* AP = Application Profile<br>* EPG = Endpoint Group<br>* BD = Bridge Domain<br><br>## Naming Conventions<br>* All new objects that the user wants to create shall be in all caps, no CamelCase or lowercase allowed.<br>* All new objects that the user wants to create shall be concatenated with underscore `_` only, `-`, or `.` shall not be used<br>* When numbers are involved, digit paddings must be used, Bridge Domains uses 4 digits padding, whereas interface numbers uses 2 digit padding.<br>* When registering new Leafs, must follow the following format `LEAF&lt;number&gt;`<br><br>## Creating new Bridge Domains<br>* BDs always follow the naming convention of `BD_VLAN&lt;vlan_id&gt;`, where `vlan_id` should be a 4 digit, with 0s as paddings if less than 4 digit<br>* Unicast routing must be enabled for all BDs, there are no layer2 BDs in the environment<br>* All BDs must be associated with the L3Out `OSPF_L3OUT` for advertising the routes out<br>* All BDs must have `ARP flooding enabled` and `L2unknown unicast set to flood` to compensate for silent hosts<br>* All BDs must have GARP detection enabled<br>* All subnets must have `public` and `primary` flags checked<br><br>## Creating new EPGs<br>* Before creating new EPGs, ensure that the Tenant, AP already exists<br>* EPGs should always follow the naming convention of `EPG_VLAN&lt;vlan_id&gt;` with paddings of 0s as well<br>* A domain must be associated first, we use `VMM_DOM` for VMWare, and `VMM_PHYS` for static paths<br>* All EPGs must have `preferred group` set as `included`</pre><h3><strong>Preparation</strong></h3><p>Before querying the document, a couple of preparatory steps are necessary:</p><ol><li><strong>Loading the Documentation:</strong> The document is first uploaded to Pinecone vector databases. We employ a “chunking” technique where a Markdown document is broken down by each section. Depending on the use case, chunking can also be done by sentence or paragraph.</li><li><strong>Defining System Instructions and Function Definitions:</strong> To use RAG dynamically, we introduce an additional function call, tailored for scenarios where a network administrator submits a configuration change request.</li></ol><p><strong>Function Call Definition</strong></p><pre>get_configuration_guideline_function = create_function_config(<br>    name=&quot;get_configuration_guideline&quot;,<br>    description=&quot;Get guidelines for ACI policy standards,&quot;,<br>    properties={<br>        &quot;query&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;query from the network admin&quot;<br>        }<br>    },<br>    required=[&quot;query&quot;]<br>)</pre><p><strong>The actual function to be called</strong></p><pre>def get_configuration_guideline(query):<br>    # create an index for query, from the database named &quot;aci-kb&quot;<br>    index = create_pinecone_index(&quot;aci-kb&quot;)<br><br>    # query the index, and return the result in plain text for us.<br>    context = query_vector_store(index, query)<br><br>    # This ensures ChatGPT does not &quot;forget&quot; other instructions.<br>    return f&quot;&quot;&quot;<br>    Think step by step when answering user query following the configuration guidelines<br>    If no guideline provided for a specific policy, do not proceed and let the user know a policy is missing<br>    <br>    <br>    Step 1. Follow system instruction<br>    Step 2. Follow additional instruction: {context}<br>    Step 3. Answer the query:\n \t{query}<br>    &quot;&quot;&quot;</pre><h3>Flow Sequence</h3><ol><li><strong>User Prompt Initiation</strong>: The user begins by entering a prompt</li><li><strong>Request Assessment and Doc Retrieval</strong>: ChatGPT evaluates if the request is configuration change related. Upon confirmation, it proceeds to fetch the relevant sections from configuration guidelines.</li><li><strong>Compliance Check and Recommendations</strong>: ChatGPT evaluates if the user’s proposed configuration complies with the guidelines. Non-compliant configurations will trigger recommendations for correction.</li><li><strong>Configuration Update and Feedback</strong>: The updated configuration is applied to Cisco ACI once the user approves. The results are then reported back to the user.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4HVhIp9ZsOH2vXkDz9Qvg.png" /><figcaption>API Call Flow</figcaption></figure><h3>ChatGPT Response Analysis</h3><h4>User Request</h4><pre>How can I assist you today? =&gt; add vlan5 to tenant demo use vrf vrf_demo, subnet 192.168.1.1/24, subnet should be shared across vrf</pre><p>To summarize the user request — add a new bridge domain with the following settings:</p><ul><li>Tenant: demo</li><li>BD: vlan5</li><li>VRF: vrf_demo</li><li>subnet: 192.168.1.1/24</li><li>subnet properties: public and shared</li></ul><p>No additional details were provided. However, based on our configuration guidelines, the following settings should also be configured:</p><ul><li>Enable Unicast Routing</li><li>Enable GARP</li><li>Subnet must have the primary flag</li><li>Associate any new Bridge Domain with OSPF_L3OUT</li><li>Adhere to strict naming conventions</li></ul><h4>Relevant Information Retrieved</h4><p>The below response is output fromget_configuration_guideline function call and sent to ChatGPT as additional context.</p><pre>==Response==<br><br>Making function call....  {<br>  &quot;name&quot;: &quot;get_configuration_guideline&quot;,<br>  &quot;arguments&quot;: &quot;{\n  \&quot;query\&quot;: \&quot;add vlan5 to tenant demo use vrf vrf_demo, subnet 192.168.1.1/24, subnet should be shared across vrf\&quot;\n}&quot;<br>}<br><br>    Think step by step when answering user query following the configuration guidelines<br>    If no guideline provided for a specific policy, do not proceed and let the user know a policy is missing<br>    <br>    <br>    Step 1. Follow system instruction<br>    Step 2. Follow additional instruction: <br>      * Before creating new EPGs, ensure that the Tenant, AP already exists<br>      * EPGs should always follow the naming convention of `EPG_VLAN&lt;vlan_id&gt;` with paddings of 0s as well<br>      * A domain must be associated first, we use `VMM_DOM` for VMWare, and `VMM_PHYS` for static paths<br>      * All EPGs must have `preferred group` set as `included`<br>      * BDs always follow the naming convention of `BD_VLAN&lt;vlan_id&gt;`, where `vlan_id` should be a 4 digit, with 0s as paddings if less than 4 digit<br>      * Unicast routing must be enabled for all BDs, there are no layer2 BDs in the environment<br>      * All BDs must be associated with the L3Out `OSPF_L3OUT` for advertising the routes out<br>      * All BDs must have `ARP flooding enabled` and `L2unknown unicast set to flood` to compensate for silent hosts<br>      * All BDs must have GARP detection enabled<br>      * All subnets must have `public` and `primary` flags checked<br>      * TN = Tenant<br>      * AP = Application Profile<br>      * EPG = Endpoint Group<br>      * BD = Bridge Domain<br>    Step 3. Answer the query:<br>        add vlan5 to tenant demo use vrf vrf_demo, subnet 192.168.1.1/24, subnet should be shared across vrf<br>    </pre><p><strong>Observations:</strong></p><ul><li>Core information about Bridge Domain was accurately retrieved.</li><li>Additional EPG-related information was also retrieved, likely due to the mention of vlan5.</li><li>The vector search accuracy could be improved, as it fetched some irrelevant sections — such as the glossary section.</li><li><strong>Important</strong>: Since the document was initially split up and stored by section, matching similar text within a section retrieves the entire section.</li></ul><p>With these guidelines retrieved, let’s examine ChatGPT’s response.</p><h4>ChatGPT’s Recommendation</h4><pre>Based on the configuration guidelines, here are the configurations to be made:<br><br>* Tenant Name: demo<br>* Bridge Domain Name: BD_VLAN0005<br>* VRF Name: vrf_demo<br>* Unicast Routing: yes<br>* GARP Mode: garp<br>* L2 Unknown Unicast: flood<br>* ARP Flood: yes<br>* L3Outs: OSPF_L3OUT<br>* Subnets: 192.168.1.1/24|yes|public+shared<br><br>Please confirm if you would like to proceed with these configurations.<br><br>==End of response==</pre><p><strong>Highlights:</strong></p><ul><li>ChatGPT did not mistakenly capitalize the Tenant name demo nor the VRF name vrf_demo. We’ll further discuss later why this was highlighted.</li><li>The Bridge Domain name was appropriately converted to uppercase with zeros padding the VLAN ID.</li><li>All additional parameters not specified by the user were adequately added according to the guideline.</li><li>ChatGPT correctly inferred that the subnet setting should be both public and shared.</li><li>Lastly, ChatGPT sought user confirmation before executing the changes.</li></ul><p><strong>Result</strong>: The configuration was successfully applied.</p><pre>How can I assist you today? =&gt; yes<br><br>==Response==<br><br>Making function call....  {<br>  &quot;name&quot;: &quot;create_bd&quot;,<br>  &quot;arguments&quot;: &quot;{\n  \&quot;tenantName\&quot;: \&quot;demo\&quot;,\n  \&quot;bdName\&quot;: \&quot;BD_VLAN0005\&quot;,\n  \&quot;vrfName\&quot;: \&quot;vrf_demo\&quot;,\n  \&quot;unicastRoute\&quot;: \&quot;yes\&quot;,\n  \&quot;garp\&quot;: \&quot;garp\&quot;,\n  \&quot;L2UnknownUnicast\&quot;: \&quot;flood\&quot;,\n  \&quot;arpFlood\&quot;: \&quot;yes\&quot;,\n  \&quot;l3outs\&quot;: \&quot;OSPF_L3OUT\&quot;,\n  \&quot;subnets\&quot;: \&quot;192.168.1.1/24|yes|public+shared\&quot;\n}&quot;<br>}<br>FUNCTION CALL RESULT:  (200, {&#39;totalCount&#39;: &#39;0&#39;, &#39;imdata&#39;: []})<br>The configuration has been successfully applied. The new bridge domain BD_VLAN0005 has been added to the tenant demo.<br><br>==End of response==</pre><h4>Information Queries and RAG</h4><p>Lastly, for information queries, no configuration guidelines should be retrieved as illustrated below:</p><pre>How can I assist you today? =&gt; what&#39;s my fabric health score<br><br>==Response==<br><br>Making function call....  {<br>  &quot;name&quot;: &quot;get_fabric_health&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br>FUNCTION CALL RESULT:  {}<br>I&#39;m sorry, but I didn&#39;t get any results for the fabric health score.<br><br>==End of response==<br><br>How can I assist you today? =&gt; can you get me all the BDs with ur enabled<br><br>==Response==<br><br>Making function call....  {<br>  &quot;name&quot;: &quot;get_bd&quot;,<br>  &quot;arguments&quot;: &quot;{\n  \&quot;unicastRoute\&quot;: \&quot;yes\&quot;\n}&quot;<br>}<br>FUNCTION CALL RESULT:  [{&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;no&#39;, &#39;bcastP&#39;: &#39;225.0.177.192&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-mgmt/BD-inb&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-11-04T17:52:40.449+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;inb&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;16386&#39;, &#39;scope&#39;: &#39;2818048&#39;, &#39;seg&#39;: &#39;16318374&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;0&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;proxy&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;all&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}, {&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;no&#39;, &#39;bcastP&#39;: &#39;225.0.39.96&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-common/BD-default&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-11-04T17:52:40.450+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;default&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;32770&#39;, &#39;scope&#39;: &#39;2654208&#39;, &#39;seg&#39;: &#39;15826914&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;0&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;proxy&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;all&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}, {&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;no&#39;, &#39;bcastP&#39;: &#39;225.1.41.144&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-infra/BD-ave-ctrl&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-11-04T17:52:40.450+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;ave-ctrl&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;32771&#39;, &#39;scope&#39;: &#39;2424832&#39;, &#39;seg&#39;: &#39;16482194&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;0&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;proxy&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;all&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}, {&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;no&#39;, &#39;bcastP&#39;: &#39;225.0.0.16&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-infra/BD-default&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-11-04T17:52:25.606+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;default&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;49154&#39;, &#39;scope&#39;: &#39;16777199&#39;, &#39;seg&#39;: &#39;16777209&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;0&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;proxy&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;all&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}, {&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;no&#39;, &#39;bcastP&#39;: &#39;225.0.45.128&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-common/BD-BD_VLAN0005&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-11-29T07:46:21.447+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;BD_VLAN0005&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;any&#39;, &#39;scope&#39;: &#39;0&#39;, &#39;seg&#39;: &#39;16187318&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;15374&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;proxy&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;:all:&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}, {&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;yes&#39;, &#39;bcastP&#39;: &#39;225.0.150.16&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-demo/BD-demo_bd&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-12-01T07:12:16.706+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;demo_bd&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;16389&#39;, &#39;scope&#39;: &#39;3047424&#39;, &#39;seg&#39;: &#39;16711542&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;15374&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;proxy&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;:all:&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}, {&#39;fvBD&#39;: {&#39;attributes&#39;: {&#39;OptimizeWanBandwidth&#39;: &#39;no&#39;, &#39;annotation&#39;: &#39;&#39;, &#39;arpFlood&#39;: &#39;yes&#39;, &#39;bcastP&#39;: &#39;225.0.192.48&#39;, &#39;childAction&#39;: &#39;&#39;, &#39;configIssues&#39;: &#39;&#39;, &#39;descr&#39;: &#39;&#39;, &#39;dn&#39;: &#39;uni/tn-demo/BD-BD_VLAN0005&#39;, &#39;enableRogueExceptMac&#39;: &#39;no&#39;, &#39;epClear&#39;: &#39;no&#39;, &#39;epMoveDetectMode&#39;: &#39;garp&#39;, &#39;extMngdBy&#39;: &#39;&#39;, &#39;hostBasedRouting&#39;: &#39;no&#39;, &#39;intersiteBumTrafficAllow&#39;: &#39;no&#39;, &#39;intersiteL2Stretch&#39;: &#39;no&#39;, &#39;ipLearning&#39;: &#39;yes&#39;, &#39;ipv6McastAllow&#39;: &#39;no&#39;, &#39;lcOwn&#39;: &#39;local&#39;, &#39;limitIpLearnToSubnets&#39;: &#39;yes&#39;, &#39;llAddr&#39;: &#39;::&#39;, &#39;mac&#39;: &#39;00:22:BD:F8:19:FF&#39;, &#39;mcastARPDrop&#39;: &#39;yes&#39;, &#39;mcastAllow&#39;: &#39;no&#39;, &#39;modTs&#39;: &#39;2023-12-01T09:24:08.731+00:00&#39;, &#39;monPolDn&#39;: &#39;uni/tn-common/monepg-default&#39;, &#39;mtu&#39;: &#39;inherit&#39;, &#39;multiDstPktAct&#39;: &#39;bd-flood&#39;, &#39;name&#39;: &#39;BD_VLAN0005&#39;, &#39;nameAlias&#39;: &#39;&#39;, &#39;ownerKey&#39;: &#39;&#39;, &#39;ownerTag&#39;: &#39;&#39;, &#39;pcTag&#39;: &#39;any&#39;, &#39;scope&#39;: &#39;0&#39;, &#39;seg&#39;: &#39;15105996&#39;, &#39;status&#39;: &#39;&#39;, &#39;type&#39;: &#39;regular&#39;, &#39;uid&#39;: &#39;15374&#39;, &#39;unicastRoute&#39;: &#39;yes&#39;, &#39;unkMacUcastAct&#39;: &#39;flood&#39;, &#39;unkMcastAct&#39;: &#39;flood&#39;, &#39;userdom&#39;: &#39;:all:&#39;, &#39;v6unkMcastAct&#39;: &#39;flood&#39;, &#39;vmac&#39;: &#39;not-applicable&#39;}}}]<br>Here are the Bridge Domains (BDs) with Unicast Routing (UR) enabled:<br><br>1. BD Name: inb, Tenant: mgmt, DN: uni/tn-mgmt/BD-inb<br>2. BD Name: default, Tenant: common, DN: uni/tn-common/BD-default<br>3. BD Name: ave-ctrl, Tenant: infra, DN: uni/tn-infra/BD-ave-ctrl<br>4. BD Name: default, Tenant: infra, DN: uni/tn-infra/BD-default<br>5. BD Name: BD_VLAN0005, Tenant: common, DN: uni/tn-common/BD-BD_VLAN0005<br>6. BD Name: demo_bd, Tenant: demo, DN: uni/tn-demo/BD-demo_bd<br>7. BD Name: BD_VLAN0005, Tenant: demo, DN: uni/tn-demo/BD-BD_VLAN0005<br><br>Please note that the DN (Distinguished Name) is the unique identifier for each BD in the ACI fabric.</pre><h3>Challenges</h3><h4>The Main Challenge</h4><p>Despite the smooth appearance of the demonstrated process, one of the most time-consuming challenges was guiding ChatGPT to correctly understand and apply exceptions in the context of configuration guidelines.</p><p>Consider the following statements from our configuration guidelines:</p><pre><br>* All new objects that the user wants to create shall be in all caps, <br>no CamelCase or lowercase allowed.<br><br>* All new objects that the user wants to create shall be in all caps, <br>no CamelCase or lowercase allowed. e.g. VRF_PROD</pre><p>The only difference between these statements is the addition of e.g. VRF_PROD in the second guideline. This seemingly minor variation led ChatGPT to capitalize both Tenant and VRF names even though they are existing objects, as shown in the following interaction:</p><pre>How can I assist you today? =&gt; add vlan5 to tenant demo use vrf vrf_demo, subnet 192.168.1.1/24, subnet should be shared across vrf<br><br>==Response==<br><br>Making function call....  {<br>  &quot;name&quot;: &quot;get_configuration_guideline&quot;,<br>  &quot;arguments&quot;: &quot;{\n\&quot;query\&quot;: \&quot;add vlan5 to tenant demo use vrf vrf_demo, subnet 192.168.1.1/24, subnet should be shared across vrf\&quot;\n}&quot;<br>}<br><br>    Think step by step when answering user query following the configuration guidelines<br>    If no guideline provided for a specific policy, do not proceed and let the user know a policy is missing<br>    <br>    <br>    Step 1. Follow system instruction<br>    Step 2. Follow additional instruction: <br>&lt;snip&gt;<br>* All new objects that the user wants to create shall be in all caps, <br>no CamelCase or lowercase allowed. e.g. VRF_PROD<br>&lt;snip&gt;<br><br>  <br>Based on the configuration guidelines, here is the configuration to add vlan5 to tenant demo using vrf vrf_demo with subnet 192.168.1.1/24:<br><br>* Tenant Name: DEMO        &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>* Bridge Domain Name: BD_VLAN0005<br>* VRF Name: VRF_DEMO       &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>* Unicast Routing: Yes<br>* GARP: Enabled<br>* L2 Unknown Unicast: Flood<br>* ARP Flooding: Yes<br>* L3Out: OSPF_L3OUT<br>* Subnets: 192.168.1.1/24|yes|public+shared</pre><p>Interestingly and frustratingly, we can guide and reason with ChatGPT to correct its mistake. As shown below:</p><p><strong>Me</strong>: Why are the Tenant&#39;s name and VRF&#39;s name capitalized?</p><p><strong><em>ChatGPT</em></strong><em>: The configuration guidelines specify that all new objects that the user wants to create should be in all caps. This includes the Tenant name and VRF name. This is a standard naming convention to maintain consistency and avoid confusion. It also helps in easily identifying and differentiating between different objects in the network.</em></p><p><strong>Me:</strong> but Tenant and VRF are existing objects, aren’t they? The configuration guideline should only apply to new objects</p><p><strong><em>ChatGPT:</em></strong><em> You’re correct, my apologies for the confusion. The configuration guidelines apply to new objects being created. If the Tenant and VRF are existing objects, we should use their existing names. Let’s correct the configuration:</em></p><pre>* Tenant Name: demo<br>* Bridge Domain Name: BD_VLAN0005<br>* VRF Name: vrf_demo<br>* Unicast Routing: Yes<br>* GARP: Enabled<br>* L2 Unknown Unicast: Flood<br>* ARP Flooding: Yes<br>* L3Out: OSPF_L3OUT<br>* Subnets: 192.168.1.1/24|yes|public+shared<br><br>Please confirm if you would like to proceed with this configuration.</pre><p>ChatGPT was quick to recognize its mistake. However, various approaches to prevent this misunderstanding initially failed. Why?</p><p>This issue likely stems from how ChatGPT has been trained and its consequent interpretation of context. During training scenarios where creating new objects might have involved more capitalization examples, it can lead the model to generalize on such a pattern.</p><p>Therefore, in our case, the inclusion of e.g. VRF_PROD might have been perceived as a reinforcement to apply capitalization broadly, leading to capitalizing existing objects incorrectly.</p><p>This highlights the critical importance of understanding how Generative AI models work and implementing technical safeguards. Such measures are vital when training examples might not adequately address specific contextual subtleties.</p><h4>Other Minor Challenges</h4><ul><li><strong>Inconsistencies when Applying Complex Configurations: </strong>ChatGPT sometimes struggles with complex configuration requests. For example, when creating a subnet shared across VRFs, ChatGPT occasionally omits the shared flag.</li><li><strong>Inconsistencies in Adhering Global Instructions</strong>: ChatGPT didn’t always follow global instructions as expected when provided with configuration guidelines. It required more explicit steps:</li></ul><pre>Step 1. Follow system instruction<br>Step 2. Follow additional instruction:</pre><ul><li><strong>Lack of Document Retrieval Accuracy</strong>: There is significant room to improve document retrieval accuracy. Various algorithms can be applied for this purpose, and strategies for chunking and embedding are also crucial.</li></ul><h3>Conclusion</h3><p>In this article we delved into RAG, vector embeddings, and vector databases, illustrating their use in extending LLM capabilities for enforcing ACI policy standards. We demonstrated how RAG can retrieve relevant information from vector databases, align user intentions with policy standards, and offer valuable recommendations. This methodology reduces hallucinations and enhances configuration accuracy while retaining user-friendliness.</p><h3>One Final Thought</h3><p>AI isn’t here to replace us but to augment and enhance our capabilities. The synergy between human input and AI is indispensable, especially in crafting solutions catering to a specific knowledge domain or enterprise environment.</p><p>I encourage all engineers to familiarize themselves with LLM prompt engineering and instruction tuning. This knowledge is vital to effectively guiding these models.</p><p>I hope you found this series informative and enlightening. Thank you for joining me on this journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf631b3ce558" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking and LLM in the Age of AI — Pt III: In-Depth Analysis of ChatGPT’s Responses]]></title>
            <link>https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-iii-reviewing-the-responses-8d28b0d7fd27?source=rss-50b00f3ca687------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d28b0d7fd27</guid>
            <dc:creator><![CDATA[Peter Zhang]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 14:52:41 GMT</pubDate>
            <atom:updated>2023-12-17T16:36:06.018Z</atom:updated>
            <content:encoded><![CDATA[<h4>Analyze LLM responses and understand hallucinations.</h4><blockquote><strong>Efficient Network Operation is about getting precise information without additional “digging in.”</strong></blockquote><p>This article is a continuation of a series following parts <a href="https://medium.com/@zhangr.cn/network-engineers-in-the-age-of-ai-introduction-619985bbb49f">I</a> and <a href="https://medium.com/@zhangr.cn/networking-and-llm-in-the-age-of-ai-pt-ii-exploring-basic-interactions-b7c7c879e31c">II</a>. We will begin by analyzing several complex conversations and conclude with examples illustrating hallucinations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_X0UoniJQ2PEKIxI" /><figcaption>Photo by <a href="https://unsplash.com/@codyengel?utm_source=medium&amp;utm_medium=referral">Cody Engel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Recap</h3><p>The previous series covered the basics of instructions, prompts, context, function calls, and how all these components integrate.</p><p>We also reviewed the responses to a fabric health query. In this article, we will delve deeper into more complex scenarios, thoroughly examining the answers provided by ChatGPT, including:</p><ul><li>Requesting ChatGPT to retrieve information via API calls.</li><li>Instructing ChatGPT to execute changes through API calls.</li><li>Analyzing and understanding hallucinations.</li></ul><p>As outlined in the previous article, here is the global instruction:</p><pre>&quot;&quot;&quot;<br>You are a co-pilot to the network engineers.<br>All tasks are executed via function calls<br>Only use the functions you have been provided with.<br>Don&#39;t make assumptions about what values to plug into functions. Always ask for clarification if a user request is ambiguous<br>when you encounter an error during a function call, pass back the exact error message, and do not interpret it<br>&quot;&quot;&quot;</pre><ul><li>We instruct ChatGPT to utilize function calls exclusively using provided functions.</li><li>Refrain from assuming input or function argument values.</li><li>Errors should be relayed directly to the user without interpretation, as interpreting errors could lead to inaccurate assumptions or hallucinations by ChatGPT.</li></ul><h3>Asking chatGPT to retrieve information</h3><blockquote><strong>Q: Can you get me a list of BDs with UR enabled?</strong></blockquote><pre>How can I assist you today? =&gt; Can you get me a list of BDs with UR enabled?</pre><h4>Function Call Definition</h4><pre>get_bd_function = create_function_config(<br>    name=&quot;get_bd&quot;,<br>    description=&quot;Get information about bridge domains (BD)&quot;,<br>    properties={<br>        &quot;unicastRoute&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;unicast routing(UR) settings&quot;,<br>            &quot;enum&quot;: [&quot;yes&quot;, &quot;no&quot;]<br>        },<br>        &quot;unkMacUcastAct&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;L2 Unknown unicast setting&quot;,<br>            &quot;enum&quot;: [&quot;flood&quot;, &quot;proxy&quot;]<br>        },<br>        &quot;operator&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;operators are used to filter and concatenate different properties&quot;,<br>            &quot;enum&quot;: [&quot;wcard&quot;, &quot;and&quot;, &quot;or&quot;, &quot;bw&quot;, &quot;lt&quot;, &quot;gt&quot;]<br>        }<br>    },<br>    required=[]<br>)</pre><h4>Response from chatGPT</h4><p>Below is a debug message showing ChatGPT correctly interpreted the user intention by returning the correct function name with the expected arguments.</p><pre>Making function call....  {<br>  &quot;name&quot;: &quot;get_bd&quot;, # correct function name returned by ChatGPT<br>  &quot;arguments&quot;: &quot;{\n  \&quot;unicastRoute\&quot;: \&quot;yes\&quot;\n}&quot; # correct argument interpreted by ChatGPT<br>}</pre><ul><li>unicastRoute is a specific ACI class, and it was provided as part of the function definition. ACI API will only accept yes/no as valid values.</li><li>ChatGPT was able to understand UR as abbreviated in the argument definition &quot;description&quot;: &quot;unicast routing (UR) settings</li><li>After making the API call to ACI, we receive the following JSON dictionaries, which we’ll pass back to ChatGPT for data extraction.</li></ul><pre>   {<br>        &quot;fvBD&quot;: {<br>            &quot;attributes&quot;: {<br>                &quot;OptimizeWanBandwidth&quot;: &quot;no&quot;,<br>                &quot;annotation&quot;: &quot;&quot;,<br>                &quot;arpFlood&quot;: &quot;no&quot;,<br>                &quot;bcastP&quot;: &quot;225.1.17.144&quot;,<br>                &quot;childAction&quot;: &quot;&quot;,<br>                &quot;configIssues&quot;: &quot;&quot;,<br>                &quot;descr&quot;: &quot;&quot;,<br>                &quot;dn&quot;: &quot;uni/tn-mgmt/BD-inb&quot;,<br>                &quot;enableRogueExceptMac&quot;: &quot;no&quot;,<br>                &quot;epClear&quot;: &quot;no&quot;,<br>                &quot;epMoveDetectMode&quot;: &quot;&quot;,<br>                &quot;extMngdBy&quot;: &quot;&quot;,<br>                &quot;hostBasedRouting&quot;: &quot;no&quot;,<br>                &quot;intersiteBumTrafficAllow&quot;: &quot;no&quot;,<br>                &quot;intersiteL2Stretch&quot;: &quot;no&quot;,<br>                &quot;ipLearning&quot;: &quot;yes&quot;,<br>                &quot;ipv6McastAllow&quot;: &quot;no&quot;,<br>                &quot;lcOwn&quot;: &quot;local&quot;,<br>                &quot;limitIpLearnToSubnets&quot;: &quot;yes&quot;,<br>                &quot;llAddr&quot;: &quot;::&quot;,<br>                &quot;mac&quot;: &quot;00:22:BD:F8:19:FF&quot;,<br>                &quot;mcastARPDrop&quot;: &quot;yes&quot;,<br>                &quot;mcastAllow&quot;: &quot;no&quot;,<br>                &quot;modTs&quot;: &quot;2023-09-09T02:09:23.883+00:00&quot;,<br>                &quot;monPolDn&quot;: &quot;uni/tn-common/monepg-default&quot;,<br>                &quot;mtu&quot;: &quot;inherit&quot;,<br>                &quot;multiDstPktAct&quot;: &quot;bd-flood&quot;,<br>                &quot;name&quot;: &quot;inb&quot;,<br>                &quot;nameAlias&quot;: &quot;&quot;,<br>                &quot;ownerKey&quot;: &quot;&quot;,<br>                &quot;ownerTag&quot;: &quot;&quot;,<br>                &quot;pcTag&quot;: &quot;16386&quot;,<br>                &quot;scope&quot;: &quot;2621440&quot;,<br>                &quot;seg&quot;: &quot;16383902&quot;,<br>                &quot;status&quot;: &quot;&quot;,<br>                &quot;type&quot;: &quot;regular&quot;,<br>                &quot;uid&quot;: &quot;0&quot;,<br>                &quot;unicastRoute&quot;: &quot;yes&quot;,<br>                &quot;unkMacUcastAct&quot;: &quot;proxy&quot;,<br>                &quot;unkMcastAct&quot;: &quot;flood&quot;,<br>                &quot;userdom&quot;: &quot;all&quot;,<br>                &quot;v6unkMcastAct&quot;: &quot;flood&quot;,<br>                &quot;vmac&quot;: &quot;not-applicable&quot;<br>            }<br>        }<br>    },<br>    {<br>        &quot;fvBD&quot;: {<br>            &quot;attributes&quot;: {<br>                &quot;OptimizeWanBandwidth&quot;: &quot;no&quot;,<br>                &quot;annotation&quot;: &quot;&quot;,<br>                &quot;arpFlood&quot;: &quot;no&quot;,<br>                &quot;bcastP&quot;: &quot;225.0.7.80&quot;,<br>                &quot;childAction&quot;: &quot;&quot;,<br>                &quot;configIssues&quot;: &quot;&quot;,<br>                &quot;descr&quot;: &quot;&quot;,<br>                &quot;dn&quot;: &quot;uni/tn-common/BD-default&quot;,<br>                &quot;enableRogueExceptMac&quot;: &quot;no&quot;,<br>                &quot;epClear&quot;: &quot;no&quot;,<br>                &quot;epMoveDetectMode&quot;: &quot;&quot;,<br>                &quot;extMngdBy&quot;: &quot;&quot;,<br>                &quot;hostBasedRouting&quot;: &quot;no&quot;,<br>                &quot;intersiteBumTrafficAllow&quot;: &quot;no&quot;,<br>                &quot;intersiteL2Stretch&quot;: &quot;no&quot;,<br>                &quot;ipLearning&quot;: &quot;yes&quot;,<br>                &quot;ipv6McastAllow&quot;: &quot;no&quot;,<br>                &quot;lcOwn&quot;: &quot;local&quot;,<br>                &quot;limitIpLearnToSubnets&quot;: &quot;yes&quot;,<br>                &quot;llAddr&quot;: &quot;::&quot;,<br>                &quot;mac&quot;: &quot;00:22:BD:F8:19:FF&quot;,<br>                &quot;mcastARPDrop&quot;: &quot;yes&quot;,<br>                &quot;mcastAllow&quot;: &quot;no&quot;,<br>                &quot;modTs&quot;: &quot;2023-09-09T02:09:24.610+00:00&quot;,<br>                &quot;monPolDn&quot;: &quot;uni/tn-common/monepg-default&quot;,<br>                &quot;mtu&quot;: &quot;inherit&quot;,<br>                &quot;multiDstPktAct&quot;: &quot;bd-flood&quot;,<br>                &quot;name&quot;: &quot;default&quot;,<br>                &quot;nameAlias&quot;: &quot;&quot;,<br>                &quot;ownerKey&quot;: &quot;&quot;,<br>                &quot;ownerTag&quot;: &quot;&quot;,<br>                &quot;pcTag&quot;: &quot;49154&quot;,<br>                &quot;scope&quot;: &quot;3014657&quot;,<br>                &quot;seg&quot;: &quot;16318374&quot;,<br>                &quot;status&quot;: &quot;&quot;,<br>                &quot;type&quot;: &quot;regular&quot;,<br>                &quot;uid&quot;: &quot;0&quot;,<br>                &quot;unicastRoute&quot;: &quot;yes&quot;,<br>                &quot;unkMacUcastAct&quot;: &quot;proxy&quot;,<br>                &quot;unkMcastAct&quot;: &quot;flood&quot;,<br>                &quot;userdom&quot;: &quot;all&quot;,<br>                &quot;v6unkMcastAct&quot;: &quot;flood&quot;,<br>                &quot;vmac&quot;: &quot;not-applicable&quot;<br>            }<br>        }<br>    },<br>    &lt;SNIP&gt;</pre><p>Below is the final response from ChatGPT (displayed to the user)</p><pre>Here is a list of Bridge Domains (BDs) with Unicast Routing (UR) enabled:<br>1. BD Name: inb, Tenant: mgmt<br>2. BD Name: default, Tenant: common<br>3. BD Name: ave-ctrl, Tenant: infra<br>4. BD Name: default, Tenant: infra<br>5. BD Name: VLAN5_BD, Tenant: CustomerA<br>6. BD Name: VLAN500_BD, Tenant: CustomerA<br>7. BD Name: VLAN100_BD, Tenant: CustomerA<br>8. BD Name: VLAN5_BD, Tenant: common<br>9. BD Name: vlan5, Tenant: common<br>10. BD Name: VLAN101_BD, Tenant: CustomerA<br>Please note that the tenant name indicates the specific network segment where the BD is located.<br>==End of response==</pre><p>A few interesting observations:</p><ul><li>We did not specify an expected output format, resulting in ChatGPT “selecting” one based on its training data.</li><li>ChatGPT accurately extracted Tenant names from the Distinguished Name (DN), as seen in examples like &quot;dn&quot;: &quot;uni/tn-mgmt/BD-inb&quot;.</li><li>However, ChatGPT inaccurately claimed that “<em>the tenant name indicates the specific network segment,</em>” revealing a gap in its domain knowledge.”</li></ul><h3>Asking ChatGPT to make a change</h3><blockquote>Q: can you add a new BD named VLAN_NEW to tenant customera</blockquote><pre>How can I assist you today? =&gt; <br>can you add a new BD named VLAN_NEW to tenant customera</pre><p>I intentionally included two mistakes in the prompt:</p><ul><li>No VRF name was provided</li><li>Typo in the Tenant name customera</li></ul><h4>Function Call Definition</h4><pre>build_bd_function = create_function_config(<br>    name=&quot;create_bd&quot;,<br>    description=&quot;Create a bridge domain using inputs from user, &quot;<br>                &quot;make sure to validate that the given Tenant and VRF exist first&quot;,<br>    properties={<br>        &quot;tenantName&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;name of the Tenant to deploy to&quot;<br>        },<br>        &quot;bdName&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;name of the bridge domain&quot;<br>        },<br>        &quot;vrfName&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;description&quot;: &quot;name of the VRF, required from user&quot;,<br>        },<br>    },<br>    required=[&quot;tenantName&quot;, &quot;bdName&quot;, &quot;vrfName&quot;]<br>)</pre><blockquote>Since there were two mistakes, it took a bit of back and forth between ChatGPT and me.</blockquote><h4>First Response</h4><pre>==Response==<br>Sure, I can help with that. However, I need the name of the VRF to proceed. <br>Could you please provide the VRF name?<br>==End of response==</pre><p>ChatGPT detected mistake#1 — the absence of a VRF name, which will lead ACI to fall back to&quot;default&quot;, which is often undesired. ChatGPT understood this requirement because of several were put in place to ensure the expected behavior:</p><ul><li>In the global instruction</li><li>In the function description</li><li>In the argument description</li><li>In the required enumeration (Ideally, this should have sufficed, but it didn’t during my initial tests, hence the additional instructions )</li></ul><h4>Second Response</h4><p>We provided ChatGPT prodVRF name, and it successfully executed the function call but encountered an error. The error is then relayed back to the user as instructed.</p><pre>How can I assist you today? =&gt; use prod # This is a reply to the question from ChatGPT<br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;create_bd&quot;,<br>  &quot;arguments&quot;: &quot;{\n  \&quot;tenantName\&quot;: \&quot;customera\&quot;,\n  \&quot;bdName\&quot;: \&quot;VLAN_NEW\&quot;,\n  \&quot;vrfName\&quot;: \&quot;prod\&quot;\n}&quot;<br>}<br>FUNCTION CALL RESULT:  {&#39;totalCount&#39;: &#39;1&#39;, &#39;imdata&#39;: [{&#39;error&#39;: {&#39;attributes&#39;: {&#39;code&#39;: &#39;102&#39;, &#39;text&#39;: &#39;configured object ((Dn0)) not found Dn0=uni/tn-customera/BD-VLAN_NEW, &#39;}}}]}<br><br><br>I&#39;m sorry, but there was an error while creating the bridge domain. <br>The error message is: &quot;configured object ((Dn0)) not found Dn0=uni/tn-customera/BD-VLAN_NEW&quot;. <br>It seems like the tenant or the VRF might not exist. <br>Would you like to check the existing tenants and VRFs?<br><br>==End of response==</pre><ul><li>ChatGPT accurately identified the function name and all required arguments.</li><li>Since ACI utilizes DNs for each object, the existence of a parent object is a prerequisite in this case. This is why we received the error: <br>object ((Dn0)) not found Dn0=uni/tn-customera/BD-VLAN_NEW implying that the Tenant customera does not exist</li><li>We intentionally directed ChatGPT not to interpret errors. Instead, as outlined in ructions, it is instructed to relay all errors to users for further analysis.</li><li>ChatGPT offered a follow-up suggestion: Would you like to check the existing tenants and VRFs? However, that was not the root cause. So, instead, I asked what the available Tenants are (as shown below). This example underscores the importance of human intervention, as there can be various options with different implications. ChatGPT may not fully grasp the user’s intent without additional guidance.</li></ul><h4>Third Response</h4><p>We prompted ChatGPT to identify the available Tenants to reassure the Tenant names, and it executed the correct function call, subsequently returning the results.</p><pre>How can I assist you today? =&gt; what are available tenants ?<br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_tenant&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br>Here are the available tenants:<br>1. Tenant Name: infra<br>2. Tenant Name: common<br>3. Tenant Name: mgmt<br>4. Tenant Name: CustomerA<br>Please note that the tenant names are case sensitive. <br>It seems like there was a typo in the tenant name you provided earlier. <br>The correct tenant name should be &quot;CustomerA&quot; instead of &quot;customera&quot;.<br>==End of response==<br></pre><ul><li>Again, ChatGPT precisely identified the necessary function call to execute — get_tenant</li><li>ChatGPT successfully read and interpreted the results from the function call (recall that ACI API will only return JSON)</li><li>Notably, ChatGPT caught the typo and suggested a correction.</li></ul><h4>Final Response</h4><p>With all the necessary information, we can let ChatGPT resolve the problem automatically by simply instructing it to act on our behalf. We also requested the updated BD list after receiving a success message.</p><pre>How can I assist you today? =&gt; okay, fix it for me         <br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;create_bd&quot;,<br>  &quot;arguments&quot;: &quot;{\n  \&quot;tenantName\&quot;: \&quot;CustomerA\&quot;,\n  \&quot;bdName\&quot;: \&quot;VLAN_NEW\&quot;,\n  \&quot;vrfName\&quot;: \&quot;prod\&quot;\n}&quot;<br>}<br>FUNCTION CALL RESULT:  {&#39;totalCount&#39;: &#39;0&#39;, &#39;imdata&#39;: []}<br>The bridge domain &quot;VLAN_NEW&quot; has been successfully created in the tenant &quot;CustomerA&quot; with the VRF &quot;prod&quot;.<br>==End of response==<br><br>How can I assist you today? =&gt; show me the new list of BDs<br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_bd&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br>Here is the updated list of Bridge Domains (BDs):<br>1. BD Name: inb, Tenant: mgmt<br>2. BD Name: default, Tenant: common<br>3. BD Name: ave-ctrl, Tenant: infra<br>4. BD Name: default, Tenant: infra<br>5. BD Name: VLAN5_BD, Tenant: CustomerA<br>6. BD Name: VLAN500_BD, Tenant: CustomerA<br>7. BD Name: VLAN100_BD, Tenant: CustomerA<br>8. BD Name: VLAN5_BD, Tenant: common<br>9. BD Name: vlan5, Tenant: common<br>10. BD Name: VLAN101_BD, Tenant: CustomerA<br>11. BD Name: VLAN_NEW, Tenant: CustomerA<br>The new BD &quot;VLAN_NEW&quot; has been successfully added to the tenant &quot;CustomerA&quot;.<br>==End of response==</pre><h3>Asking chatGPT to retrieve BD count</h3><blockquote>Q: How many BDs are there?</blockquote><pre>How can I assist you today? =&gt; how many BDs are there ?<br>==Response==<br>There are 11 Bridge Domains (BDs) in total.<br>==End of response==</pre><ul><li>ChatGPT directly retrieved the information from previous conversations (note the absence of Making function call debug message).</li></ul><p>If I exit the program and begin a new conversation, it’s apparent that ChatGPT needs to query for all Bridge Domains (BDs) again to retrieve the answer</p><pre>chattynetworks git:(main) ✗ python chattynetworks/aci/chat.py<br><br>Hi, I&#39;m an ACI GPT agent, I can provide information for your ACI fabric<br><br>How can I assist you today? =&gt; how many BDs are there ?<br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_bd&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br>There are 11 Bridge Domains (BDs).<br>==End of response==</pre><p>The main difference here is that generating a response from context is much faster but also cheaper $</p><h3>Hallucinations or Imaginations?</h3><p>Hallucinations in LLMs occur when the model generates text that is erroneous, nonsensical, or disconnected from reality. Interestingly, hallucinations can also spur AI creativity and sometimes better grasp human intentions, a topic worthy of separate discussion.</p><p>Let’s examine the following examples to understand how hallucinations might manifest in networking operations.</p><h4>First Example</h4><p>Here is a snippet of my interaction with ChatGPT regarding fabric health scores:</p><pre><em>Q: what&#39;s my fabric healthscore ?</em><br><strong>A: The health score of your fabric is 81.</strong><br><em>Q: how is my fabric doing?<br></em><strong>A: The overall health of your fabric is currently at 81%.</strong><br><em>Q: Is my fabric good ?<br></em><strong>A: Yes, your fabric is in good condition. The health score is 81, which indicates a healthy state.</strong><br><em>Q: can you raise the threshold to 90 to be considered good ?<br></em><strong>A: I&#39;m sorry, but as an AI, I don&#39;t have the capability to change the threshold for what is considered a good health score. This is typically a decision made by network administrators based on their specific requirements and standards.</strong></pre><ul><li>While identical in intent, the first two questions received slightly different responses from ChatGPT (an inconsistency in format, but not inherently negative).</li><li>The third question, a straightforward yes/no query, received not just an answer but an explanation from ChatGPT, demonstrating some reasoning capability. However, I had not provided ChatGPT with any criteria for ‘good’ or ‘bad.’ This is an area where custom instructions could refine the response, similar to thresholds used in other networking solutions.</li><li>The fourth question tested ChatGPT’s response to on-the-fly threshold adjustments. Its response was somewhat lacking, considering I am the administrator and that it should have followed my directives.</li></ul><h4>Second Example</h4><p><strong>Background</strong>: I had just set up a fresh ACI simulator instance with no devices registered, so no healthscore was available.</p><pre>How can I assist you today? =&gt; how&#39;s my fabric<br><br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_fabric_health&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br><br># ACI Returned empty results<br>FUNCTION CALL RESULT:  {} <br><br>The fabric health is in good condition.   <br>==End of response==</pre><p>This is a clear case of hallucination. Ideally, when ACI returns an empty result, ChatGPT should report it as is. Instead, it incorrectly informed me that the fabric was in good condition, which is misleading.</p><p>I managed to rectify the hallucination issue by introducing a new directive:</p><p><strong>Addition to the global instruction</strong>: If no results are returned after a function call, let the user know; with this additional instruction in place, ChatGPT provided the anticipated response:</p><pre>How can I assist you today? =&gt; How&#39;s my fabric<br><br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_fabric_health&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br><br><br>FUNCTION CALL RESULT:  {}     <br>I&#39;m sorry, but there were no results returned after the function call. <br>==End of response==</pre><p>This solution, while straightforward, underscores how prone LLMs are to hallucinations, even in situations that might seem obvious to humans.</p><h3>Observations</h3><ul><li>ChatGPT might assume values when not provided by the user, a side effect of training on generic internet data. Instead of grasping the fundamental concept, ChatGPT often applies these trained examples to answer user queries. Therefore, additional instructions are necessary to minimize hallucinations.</li><li>With adequate context and instructions, ChatGPT can assist in correcting configuration mistakes. We’ll further explore this in the next article.</li><li>When ChatGPT is used for data parsing, the output format can vary, which is often undesired for networking operations.</li><li>Hallucinations present a significant challenge, but there are ways to minimize them.</li></ul><h3>Conclusion</h3><p>In this article, we delved into ChatGPT’s responses to a variety of networking requests, assessing its reasoning capabilities and basic troubleshooting skills in the typo example.</p><p>We also observed an instance of hallucination and implemented a straightforward solution. In our next article, we will explore RAG (Retrieval Augmented Generation) and examine how it can be utilized to uphold configuration standards — <a href="https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-iv-knowledge-retrieval-using-rag-bf631b3ce558">Networking and LLM in the Age of AI — Pt IV: Knowledge Retrieval using RAG</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d28b0d7fd27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking and LLM in the Age of AI — Pt II: Exploring Basic Interactions]]></title>
            <link>https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-ii-exploring-basic-interactions-b7c7c879e31c?source=rss-50b00f3ca687------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7c7c879e31c</guid>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Peter Zhang]]></dc:creator>
            <pubDate>Mon, 30 Oct 2023 01:57:30 GMT</pubDate>
            <atom:updated>2023-12-14T13:08:01.671Z</atom:updated>
            <content:encoded><![CDATA[<h3>Networking and LLM in the Age of AI — Pt II: Exploring Basic Interactions</h3><h4>Instructions, Context, Function Calling and Prompts</h4><blockquote><strong>The most crucial information we must provide to any LLM chat model are the context, detailed instructions, and precise prompts.</strong></blockquote><p>This article is part of a series — You can find Part I <a href="https://medium.com/@zhangr.cn/network-engineers-in-the-age-of-ai-introduction-619985bbb49f">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4SrkwfABUzbbG9-T" /><figcaption>Photo by <a href="https://unsplash.com/@neom?utm_source=medium&amp;utm_medium=referral">NEOM</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Instructions</h3><p>Instructions play a crucial role in shaping an LLM into a valuable assistant. Their purpose is to set clear expectations and guide narratives and context, thereby reducing inaccuracies and ensuring more precise responses.</p><p>Creating practical instructions often involves trial and error and is an iterative process. This is akin to conveying domain expert knowledge to others who aren’t familiar with the same domain. Experts familiar with their field might overlook mentioning basic facts or best practices that have become second nature to them.</p><p>When it comes to network management, we should establish some fundamental expectations for the LLM:</p><ul><li>Insist on factual responses, avoiding any fabricated or imaginary configurations.</li><li>Require precise API calls for acquiring specific information or implementing the correct configurations.</li><li>Avoid making assumptions about input parameters when making API calls. If a prompt is ambiguous, the model should always seek clarification from the user. For instance, we should not assume the use of default values when deploying ACI policies.</li><li>Adhere strictly to user-defined output formats.</li></ul><p>Here’s an illustrative example of global instructions:</p><pre>&quot;&quot;&quot;<br>You are a co-pilot to the network engineers.<br>All tasks are executed via function calls<br>Only use the functions you have been provided with.<br>Don&#39;t make assumptions about what values to plug into functions. Always ask for clarification if a user request is ambiguous<br>when you encounter an error during a function call, pass back the exact error message, and do not interpret it<br>&quot;&quot;&quot;</pre><ul><li>It sets the context for networking administration and specifies the exclusive use of provided function calls.</li><li>It also instructs ChatGPT not to interpret any error messages, leaving the diagnosis to the network admin.</li><li>We can also define more granular instructions at the function call level.</li></ul><blockquote><strong>This seemingly small set of instructions was created via trial and error over several iterations.</strong></blockquote><h3>Context</h3><p>Context is similar to memory for LLM. An LLM has to be mindful of the conversation’s context to respond appropriately. Initial contexts are defined as part of the global instructions as shown above.</p><p>As we engage in a dialogue with ChatGPT, each new piece of information enriches the context. The entirety of the conversation history is repeatedly passed to ChatGPT as the conversation continues, enabling it to generate informed and relevant responses based on this accumulated context.</p><p>With that said, it’s important to note that the context in LLMs is confined to a single conversation and is restricted by the size of its memory, often referred to as the ‘Context Window. This implies that the volume of text an LLM can process at a time is limited. Therefore, “reading a book” is a challenging task for most LLMs. Don’t try sending “TCP/IP Volume 1 and 2” to ChatGPT and expect some in-depth Q&amp;A sessions.</p><h3>Function Calling</h3><p>While our usual interactions with ChatGPT are conversational, yielding responses in human-readable plain text, we can also use APIs to request that ChatGPT provides a specific function with arguments. This process involves two main components:</p><h4>A pre-defined data structure</h4><pre>get_fabric_health_function = create_function_config(<br>    name=&quot;get_fabric_health&quot;,<br>    description=&quot;Get the latest fabric health, provide user min, max and average for the past 5 minutes&quot;,<br>    properties={},<br>    required=[]<br>)</pre><ul><li><strong>name</strong>: The name of the function to be called.</li><li><strong>description</strong>: This serves as an instruction. For instance, in the above example, we specify that the function should get the minimum, maximum, and average values for the past 5 minutes. ChatGPT may default to providing a single value without this explicit instruction.</li><li><strong>properties</strong>: Here, we detail the specifics of the arguments. This includes providing a function description akin to an instruction but at the <strong>argument level</strong>. Additionally, we can define an <strong>enumeration parameter </strong>— a list of acceptable values for an argument. (This will be discussed in more detail in the following article.)</li><li><strong>required: </strong>This field informs ChatGPT which argument(s) are essential. If a user fails to provide sufficient information, ChatGPT may hallucinate from training data.</li></ul><p><strong>Note</strong>: ChatGPT utilizes a dictionary structure to define functions. The code mentioned above is designed for abstraction purposes, which accounts for the slight differences in formatting.</p><h4>Include defined functions in the API call</h4><pre>res = openai.ChatCompletion.create(<br>    model=self.model,<br>    messages=self.messages,<br>    functions=self.functions,<br>    function_call=self.function_call,<br>    temperature=0<br>)</pre><p>In the process of invoking the ChatCompletion Python API, we specifically incorporate two fields in addition to the common ones: functions and function_call</p><ul><li>The functions field is a list of function definitions, as previously defined. In our demonstrations, we will include all the specified functions.</li><li>The function_call field enables us to force the model to use a specific function. By default, this value is set to auto</li><li>temperature=0 field is not particular to the function call. Setting to 0helps control hallucination</li></ul><p>You can find a more detailed example with explanations on OpenAI’s Github page — <a href="https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb">How_to_call_functions_with_chat_models</a></p><h3>Prompts</h3><p>Prompts are the means through which we frame our intentions. In interactions with an LLM model, it is crucial to articulate our intentions clearly and include all relevant information within the prompt.</p><blockquote>Emphasizing simplicity and precision, and with a well-structured context, prompts in this scenario are analogous to CLI commands expressed in human language (Human Language Interface).</blockquote><p>While numerous strategies exist for effective prompt engineering, we aim to engage in straightforward English dialogue without relying on advanced prompt engineering yet still execute precise API calls to the APIC.</p><p>Consequently, a basic understanding of networking is necessary to provide ChatGPT with the required parameters during the prompting process</p><p>Below are some example prompts. Note that here, we used ACI-specific terminology such as “fabric,” “UR (unicast routing),” and “BD (Bridge Domain)” to assess ChatGPT’s awareness of context.</p><pre># This question intends to get the fabric health score<br>- How is my fabric doing?<br><br># The intention is to get a list of routed BDs, including the default ones.<br># Excluding default BDs requires further instruction tuning, though<br>- Can you get me a list of BDs with UR enabled?<br><br># We&#39;ll further analyze this one in the following article<br># Can you spot any potential issues in this prompt, though?<br>- Can you add a new BD named VLAN5_BD to Tenant customera?<br><br># A simple question to count BDs. <br># We&#39;ll further analyze ChatGPT&#39;s response in the following article<br>- How many BDs are there?</pre><h3>Chain Everything Together</h3><p>Now that we’ve covered all the fundamentals, let’s see how to integrate these elements sequentially to create a streamlined process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*djstHIm30Y_9jwQx" /><figcaption>Sequence Flow — By Author</figcaption></figure><p>Once we receive a prompt from the user, the first step involves sending the following information to the ChatGPT API.</p><ul><li>Global instructions</li><li>List of functions</li><li>User prompts</li></ul><p>This results in the API returning the name of the function we should call and the necessary arguments. We then use this information to execute the appropriate API call to ACI, which yields a JSON response.</p><p>At this juncture, we have two options:</p><ol><li>We can send the JSON response back to ChatGPT for parsing, as illustrated above. We’ll use this approach for all future demonstrations.</li><li>Alternatively, we can parse the JSON using another function. This approach is less token-intensive but requires more significant software engineering effort.</li></ol><p>Finally, we present the output to the user.</p><h3>A Simple Demonstration</h3><p>Now that we understand the entire process flow let’s walk through the first query as a simple demonstration. (we’ll go into depth in the next article)</p><blockquote>Q: How is my fabric doing?</blockquote><p>Recall that the intention is to simply get the health score (as defined in the function definition).</p><pre>How can I assist you today? =&gt; how&#39;s my fabric doing<br><br>Making function call....  {<br>  &quot;name&quot;: &quot;get_fabric_health&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}</pre><ul><li>In this instance, specifying the entire “Cisco ACI Fabric” context wasn’t necessary.</li><li>The function nameget_fabric_health is correctly returned from ChatGPT with no arguments.</li></ul><p>We received the below output after sending the above API call to ACI.</p><pre>{<br>    &quot;fabricOverallHealthHist5min&quot;: {<br>        &quot;attributes&quot;: {<br>            &quot;childAction&quot;: &quot;&quot;,<br>            &quot;cnt&quot;: &quot;30&quot;,<br>            &quot;dn&quot;: &quot;topology/HDfabricOverallHealth5min-0&quot;,<br>            &quot;healthAvg&quot;: &quot;81&quot;,<br>            &quot;healthMax&quot;: &quot;81&quot;,<br>            &quot;healthMin&quot;: &quot;81&quot;,<br>            &quot;healthSpct&quot;: &quot;0&quot;,<br>            &quot;healthThr&quot;: &quot;&quot;,<br>            &quot;healthTr&quot;: &quot;0&quot;,<br>            &quot;index&quot;: &quot;0&quot;,<br>            &quot;lastCollOffset&quot;: &quot;300&quot;,<br>            &quot;repIntvEnd&quot;: &quot;2023-10-17T19:43:56.439+00:00&quot;,<br>            &quot;repIntvStart&quot;: &quot;2023-10-17T19:38:55.934+00:00&quot;,<br>            &quot;status&quot;: &quot;&quot;<br>        }<br>    }<br>}</pre><p>The JSON output is subsequently sent to ChatGPT for additional data extraction. Following this, ChatGPT provided a response that precisely captured the requested average, minimum, and maximum values despite them being identical</p><pre>The fabric health for the past 5 minutes has been consistent with an average, <br>minimum, and maximum health score of 81.</pre><h4>Variations in Prompts</h4><p>Let’s examine how ChatGPT responds to slight variations in phrasing the exact prompt.</p><p>Example Prompt: what&#39;s my health score? and give me the hs</p><pre>How can I assist you today? =&gt; what&#39;s my health score ?<br><br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_fabric_health&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br>Your health score for the past 5 minutes is as follows:<br>- Minimum: 84<br>- Maximum: 84<br>- Average: 84<br>==End of response==<br><br><br>How can I assist you today? =&gt; give me the hs<br>==Response==<br>Making function call....  {<br>  &quot;name&quot;: &quot;get_fabric_health&quot;,<br>  &quot;arguments&quot;: &quot;{}&quot;<br>}<br>Your health score for the past 5 minutes is as follows:<br>- Minimum: 84<br>- Maximum: 84<br>- Average: 84<br>==End of response==</pre><ul><li>In both cases, the response outputs differed from the previous instance. This is a common scenario where asking ChatGPT the same question multiple times can result in slightly different outputs, though they convey the same meaning. In this context, the variation isn’t a significant issue. With some additional fine-tuning of the instructions, we can address this.</li><li>Remarkably, ChatGPT correctly interpreted hs as “health score.” <strong>A cautionary note</strong>: only four functions were provided in this example, which probably helped control hallucinations.</li></ul><h3>Conclusion</h3><p>ChatGPT demonstrates proficiency in executing API actions when provided with the correct context, clear guidance, and precise function definitions.</p><p>However, achieving output consistency comparable to tools like Ansible requires further refinement of instructions and consideration of user experience.</p><p>In the following article, we’ll analyze ChatGPT’s responses to the remaining questions in depth, examining its capability to handle more complex scenarios.</p><p>See you in the next one! <a href="https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-iii-reviewing-the-responses-8d28b0d7fd27">Networking and LLM in the Age of AI — Pt III: In-Depth Analysis of ChatGPT’s Responses</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7c7c879e31c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Network Engineers in the Age of AI — Introduction]]></title>
            <link>https://medium.com/@zhangineer/network-engineers-in-the-age-of-ai-introduction-619985bbb49f?source=rss-50b00f3ca687------2</link>
            <guid isPermaLink="false">https://medium.com/p/619985bbb49f</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[llmops]]></category>
            <dc:creator><![CDATA[Peter Zhang]]></dc:creator>
            <pubDate>Sun, 08 Oct 2023 02:40:07 GMT</pubDate>
            <atom:updated>2023-12-17T16:02:28.496Z</atom:updated>
            <content:encoded><![CDATA[<h3>Networking and LLM in the Age of AI — Pt. I: The Exploration Begins</h3><h4><em>A series to explore how to leverage LLM for networking tasks</em></h4><p>The rise of ChatGPT and large language models (LLM) has opened up the possibility of transforming various domains. However, networking remains largely unexplored.</p><p>In this series, we’ll explore the potential of LLMs to empower Networking Operations. No AI/ML knowledge is required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k3reo7tIKEfKD_FN" /><figcaption>Photo by <a href="https://unsplash.com/@kalenemsley?utm_source=medium&amp;utm_medium=referral">Kalen Emsley</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>For the Busy People — TL;DR For the Series</h3><ul><li>LLM demonstrated significant promise in assisting with IT and networking configuration management troubleshooting tasks.</li><li>Human engineers are irreplaceable in the AI-driven landscape, as their technical expertise is essential for accurately conveying intentions to and guiding ChatGPT.</li><li>A conversational approach to configuration management offers a more intuitive and user-friendly alternative than traditional automation tools.</li><li>The integration of Function Calls and RAG plays a crucial role in minimizing hallucinations and enhancing the accuracy of configurations.</li><li>Developing a robust validation pipeline for models is essential, given the potential for hallucinations and the inherent inconsistencies in LLMs.</li><li>Treating LLMs as software development tools rather than chatbots is crucial. Understanding how to integrate them with external software will enhance the user experience and unlock a broader range of use cases.</li><li>The rise of domain-specific LLMs, such as Large Vision Models, is anticipated to be a significant trend. While not everyone will be involved in their development, their application will become widespread across various fields.</li></ul><h3>Introduction</h3><p>In this opening chapter, we’ll outline our mission the topics we intend to cover, and provide a high-level overview. Additionally, we’ll address some frequently asked questions.</p><p>Given my background in Cisco ACI, it will be the focus of our demonstrations. We will utilize the ChatGPT model, specifically “GPT-4”, for all demonstrations.</p><h3>Mission</h3><p>The primary objective of this exploration series is to assess the effectiveness of LLMs in managing networks without generating inaccurate or misleading information (commonly referred to as ‘hallucinations’).</p><p>We’ll begin with basic use cases, gradually increasing in complexity. All interactions with the network will be conversational in plain English. ChatGPT will act as an assistant for all actions.</p><h3>Topics</h3><ul><li>Explore the fundamentals of instruction formulation, function invocation, context understanding, and prompt crafting in ChatGPT.</li><li>Investigating ChatGPT’s ability to execute function calls for API interactions within an ACI environment.</li><li>Analyzing ChatGPT’s responses to diverse queries and examining ways to refine them.</li><li>Explore RAG (Retrieval Augmented Generation) for real-time knowledge retrieval to assist with network configurations.</li></ul><p>In future blogs, we will further look into more advanced LLM topics, such as fine-tuning LLMs and pre-training a model from scratch.</p><h3>Environment Setup and High-Level Flow</h3><p>We’ll have an ACI Simulator in the environment to interact with. We’ll create a small agent as the middleware that handles user input, communicates with ChatGPT, and makes API calls to the APIC simulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s5PhdTNqTeO2tR0V" /><figcaption>created by author</figcaption></figure><h3>Frequently Asked Questions</h3><blockquote><strong>Will network engineers become obsolete due to the evolution of LLMs?</strong></blockquote><p><em>No, network engineers will not become obsolete with the advent of LLMs. Our expert-level knowledge will become increasingly vital. The critical shift will be robust communication and expression skills, essential for effectively training, guiding, and educating LLMs using precise language.</em></p><p><em>Networking is a unique domain populated with proprietary information. This contrasts with the more open nature of general programming languages (Python, C, JS…etc).</em></p><p><em>Additionally, networking alone encompasses a variety of technologies (such as Firewalls, Routers, and Load Balancers), each with its specific hardware, capabilities, and firmware features. This complexity presents a significant challenge for any LLM to navigate successfully.</em></p><p><em>Therefore, for LLMs to be truly effective and beneficial in networking, they require substantial knowledge input from human experts. By infusing LLMs with this expertise, they, in turn, can become powerful tools that augment and enhance our capabilities in network management.</em></p><blockquote><strong>How will LLMs impact network engineers?</strong></blockquote><p><em>LLMs will be a powerful aid to network engineers, similar to their impact in other domains. While the intricacies of network design and intention remain too complex for LLMs to replace, they will significantly streamline tasks like routine network configuration changes. These tasks will become simpler, safer, more transparent, and eventually human language-driven. This advancement will likely enhance today’s Infrastructure as Code (IaC) practices. LLM can also act as an abstraction layer on top of IaC and interface directly with humans.</em></p><p><em>Additionally, network operations, troubleshooting, information gathering, and real-time action-taking will become more efficient as LLMs are user-friendly and can process complex requests. Over time, the role of the network engineer will gradually evolve from being technically oriented to being more aligned with business objectives, allowing for a greater focus on designing robust, resilient, extensible, and flexible networks.</em></p><p><em>Design to automate — The more a network adheres to a design pattern, the easier it will be for AI and LLMs to manage and maintain.</em></p><blockquote><strong>How is this different from network automation?</strong></blockquote><p><em>AI/LLM offers several advantages over conventional automation tools like Ansible, Terraform, or Python-based scripts:</em></p><ul><li><em>A human-friendly natural language interface requires no automation skills to perform automated tasks.</em></li><li><em>LLM can access a real-time knowledge base for informed decision-making and provide relevant recommendations as necessary.</em></li><li><em>LLM can also engage in interactive dialogues, offering users insights into the implementation process of a task.d</em></li><li><em>LLM can reason and adapt to their environment when errors occur. For instance, they can correct typos in user input, unlike tools like Ansible or Terraform, which would report an error.</em></li><li><em>LLM can analyze network topologies, providing an extra safety net for assessing the impact of a configuration change.</em></li></ul><blockquote><strong>Do network engineers need to pick up AI/ML skills?</strong></blockquote><p><em>Network engineers don’t necessarily need to master AI/ML algorithms, but acquiring skills that leverage AI technology is beneficial. This includes learning LLM prompt engineering, acquiring basic Python knowledge, and understanding APIs. Viewing tools like ChatGPT as development tools rather than a product is crucial. Otherwise, you’ll always be disappointed.</em></p><p><em>The focus should be on honing skills in prompt crafting, formulating instructions, and context building. A network engineer who can provide well-structured intentions, instructions, and context for an LLM model can transform it into a highly effective assistant. This series will demonstrate how I apply ACI/Python knowledge to enhance ChatGPT’s performance.</em></p><p><em>Most importantly, understanding the nuances of networking is crucial. While LLMs can readily acquire common and generic knowledge, the subtleties that stem from real-world experience are more complex to grasp. This is similar to how we can quickly learn generic networking concepts, but it takes time to grasp how such knowledge applies to specific networking environments.</em></p><blockquote><strong>Some of the answers above might not be obvious, but hopefully, they’ll become clearer at the end of this series.</strong></blockquote><h3>One Last Thought</h3><p>As we witness the ongoing evolution of Large Language Models, the boundaries of their capabilities are largely defined by the extent of our imagination. The key lies in our ability to offer precise guidance. The potential of LLMs is vast, but it hinges on our skillful interaction and thoughtful input.</p><p>See you in the next article: <a href="https://medium.com/@zhangineer/networking-and-llm-in-the-age-of-ai-pt-ii-exploring-basic-interactions-b7c7c879e31c">Networking and LLM in the Age of AI — Pt II: Exploring Basic Interactions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=619985bbb49f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>