<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Navatech Engineering]]></title><description><![CDATA[Innovation, Thoughts and ideas.]]></description><link>http://engineering.navatech.ai/</link><image><url>http://engineering.navatech.ai/favicon.png</url><title>Navatech Engineering</title><link>http://engineering.navatech.ai/</link></image><generator>Ghost 5.58</generator><lastBuildDate>Sat, 11 Apr 2026 15:30:20 GMT</lastBuildDate><atom:link href="http://engineering.navatech.ai/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[How We Built a RAG System That Actually Works: Lessons from the Trenches at Navatech]]></title><description><![CDATA[<p><em>A 3-month sprint of building, breaking, and rebuilding an enterprise search system that doesn&apos;t hallucinate</em></p>
<hr>
<h2 id="the-problem-that-started-it-all">The Problem That Started It All</h2>
<p>LLMs hallucinate with terrifying confidence. Test one on crane operation limits, and it might tell you &quot;operate normally in winds up to 35 mph&quot; when</p>]]></description><link>http://engineering.navatech.ai/how-we-built-a-rag-system-that-actually-works-lessons-from-the-trenches-at-navatech/</link><guid isPermaLink="false">68513c56cc9ce9bc467ea3ed</guid><dc:creator><![CDATA[Lakshay Chhabra]]></dc:creator><pubDate>Thu, 03 Jul 2025 05:50:21 GMT</pubDate><content:encoded><![CDATA[<p><em>A 3-month sprint of building, breaking, and rebuilding an enterprise search system that doesn&apos;t hallucinate</em></p>
<hr>
<h2 id="the-problem-that-started-it-all">The Problem That Started It All</h2>
<p>LLMs hallucinate with terrifying confidence. Test one on crane operation limits, and it might tell you &quot;operate normally in winds up to 35 mph&quot; when your manual&apos;s actual limit is 20 mph. The LLM isn&apos;t lying, it&apos;s pattern-matching from whatever training data it saw, which could be from different equipment, different manufacturers, or pure statistical interpolation.</p>
<p>In construction, where exceeding wind limits has killed operators, these hallucinations aren&apos;t theoretical&#x2014;they&apos;re lethal. And that&apos;s exactly why we at Navatech decided to build a Retrieval-Augmented Generation (RAG) system from scratch.</p>
<p>If you&apos;re not familiar with the term, think of RAG as giving an AI assistant a library card. Instead of making things up based on what it &quot;thinks&quot; it knows, it looks up information from trusted documents before answering. Simple concept, nightmare to implement at scale.</p>
<h3 id="why-not-just-use-chatgpt-and-why-most-rag-systems-fail">Why Not Just Use ChatGPT? (And Why Most RAG Systems Fail)</h3>
<p>&quot;Why not just upload docs to ChatGPT?&quot; - Every PM ever</p>
<p>Here&apos;s why:</p>
<ol><li><strong>Source Attribution</strong>: When ChatGPT says &quot;install scaffolding at 45-degree angles,&quot; which manual is that from? Which version? Which page?</li><li><strong>Faithfulness</strong>: In construction safety, being 95% correct means 5% of your workers are at risk</li><li><strong>Document Control</strong>: Your safety manuals update quarterly. ChatGPT&apos;s knowledge doesn&apos;t</li><li><strong>Compliance</strong>: &quot;An AI told me to&quot; doesn&apos;t hold up in court. &quot;Section 3.2 of the certified safety manual says&quot; does</li></ol>
<p>&quot;Okay, then we&apos;ll just build a quick RAG system with Pinecone!&quot; - Also every PM</p>
<p>Let me save you three months of pain by sharing what doesn&apos;t work:</p>
<h3 id="the-quick-and-dirty-rag-approach-that-fails">The &quot;Quick and Dirty&quot; RAG Approach That Fails</h3>
<p><strong>What people do:</strong></p>
<pre>
The &quot;tutorial&quot; approach
pdf_text = extract_text(pdf)
chunks = split_by_tokens(pdf_text, 1000)
embeddings = get_embeddings(chunks)
pinecone.upsert(embeddings)  # Ship it!
</pre>
<p><strong>Why it fails spectacularly:</strong></p>
<p><strong>Real example from our first attempt:</strong> Query: &quot;What&apos;s the max load for Type A scaffolds?&quot;</p>
<p>What the system returned:</p>
<p><code>&quot;Type A Type B Type C 225 450 675 kg/m&#xB2; kg/m&#xB2; kg/m&#xB2; Light Medium Heavy Duty Duty Duty&quot;</code></p>
<p>The table structure was completely destroyed. The AI had no idea which number belonged to which type. This isn&apos;t just wrong&#x2014;it&apos;s dangerous.</p>
<h3 id="common-mistakes-we-see-and-made">Common Mistakes We See (And Made):</h3>
<ol><li><strong>Dumping Raw PDFs</strong>: Tables become word soup, images disappear, context vanishes</li><li><strong>Ignoring Structure</strong>: Retrieved section 4.2.1 without knowing it&apos;s under &quot;Emergency Procedures&quot;</li><li><strong>Generic Embeddings</strong>: System thinks &quot;crane&quot; is a bird, not construction equipment</li><li><strong>No Document Control</strong>: Mixes 2019 procedures with 2024 updates</li><li><strong>No Evaluation</strong>: &quot;Ship it and see what happens&quot; = lawsuits</li></ol>
<h3 id="the-just-use-pinecone-trap">The &quot;Just Use Pinecone&quot; Trap</h3>
<p>Don&apos;t get me wrong&#x2014;Pinecone is great. But it&apos;s a vector database, not a RAG system. It&apos;s like having a Ferrari engine but no car. The vector store is 10% of the solution. The other 90%:</p>
<ul><li>Document preprocessing (40%)</li><li>Chunking strategy (20%)</li><li>Retrieval logic (15%)</li><li>Generation controls (15%)</li></ul>
<p>We learned this the hard way. Week 1 looked like:</p>
<ul><li>&#x2705; Set up Pinecone (2 hours)</li><li>&#x2705; Ingested 1000 PDFs (4 hours)</li><li>&#x274C; Tested with real queries (disaster)</li><li>&#x1F631; &quot;Maybe RAG doesn&apos;t work for construction?&quot;</li></ul>
<p>Then we built it right. Which is what this blog is about.</p>
<hr>
<h2 id="what-we-were-up-against">What We Were Up Against</h2>
<p>When we started this project at Navatech, our construction clients were drowning in documents:</p>
<ul><li>100,000+ safety manuals, method statements, and RAMS (Risk Assessment Method Statements)</li><li>Building codes that changed with each jurisdiction</li><li>Mixed formats: PDFs with hand-drawn diagrams, Word docs with track changes from 15 different reviewers, Excel sheets containing critical load calculations</li></ul>
<p>Our mandate was clear: Build a system that could answer questions about these documents with 99.9% accuracy, handle thousands of queries per hour, and never, <em>never</em> make things up.</p>
<hr>
<h2 id="chapter-1-the-document-preprocessing-nightmare">Chapter 1: The Document Preprocessing Nightmare</h2>
<h3 id="the-reality-check">The Reality Check</h3>
<p>Our first wake-up call came when we tried to process a seemingly simple PDF. It was a 200-page equipment manual with:</p>
<ul><li>Tables that spanned multiple pages (with headers only on the first page)</li><li>Diagrams with text annotations scattered around them</li><li>Footnotes that referenced other footnotes</li><li>Scanned pages mixed with digital text</li></ul>
<p>Traditional PDF parsers either crashed or produced gibberish. One memorable output turned a safety warning into a recipe for disaster by merging it with an unrelated table about temperature settings.</p>
<h3 id="what-actually-worked">What Actually Worked</h3>
<p>After testing 5+ document parsing libraries, we settled on a hybrid approach:</p>
<ol><li><a href="http://unstructured.io/?ref=engineering.navatech.ai">http://Unstructured.io</a> for the heavy lifting&#x2014;it understood document structure better than anything else we tried</li><li><strong>BeautifulSoup</strong> for fine-grained control over the converted HTML/XML</li><li><strong>Custom parsers</strong> for specific document types.</li></ol>
<p>But here&apos;s the key insight: <strong>We converted everything to Markdown</strong>.</p>
<p>Why Markdown? Let me show you:</p>
<blockquote>## Scaffold Erection Procedures<br><br>### Table 3.1: Load Limits by Platform Type<br>| Platform Type | Max Load (kg/m&#xB2;) | Safety Factor |<br>|--&#x2014;&#x2014;&#x2014;&#x2014;|&#x2014;&#x2014;&#x2014;&#x2014;&#x2014;&#x2014;|&#x2014;&#x2014;&#x2014;&#x2014;&#x2014;|<br>| Light Duty   | 225             | 4:1           |<br>| Medium Duty  | 450             | 4:1           |<br>| Heavy Duty   | 675             | 4:1           |<br><br>**Critical**: Never exceed 75% of maximum rated load.<br><br>### Installation Requirements<br>- Competent person inspection required<br>- Base plates on firm foundation<br>- Cross bracing every 20 feet vertically<br></blockquote>
<p>This format preserved the relationships between elements. A load table and its safety warnings stayed together. Cross-references to inspection requirements remained intact.</p>
<h3 id="the-learning-moment">The Learning Moment</h3>
<p>One client had a critical procedure split across three pages, with a diagram in the middle. Our first parser treated each page as a separate document. An employee following the AI&apos;s advice would have skipped crucial safety steps. That near-miss taught us: <strong>Context preservation isn&apos;t optional&#x2014;it&apos;s everything</strong>.</p>
<hr>
<h2 id="chapter-2-the-art-and-science-of-chunking">Chapter 2: The Art and Science of Chunking</h2>
<h3 id="what-chunking-means-in-human-terms">What Chunking Means (In Human Terms)</h3>
<p>Imagine you&apos;re creating a set of index cards from a textbook. Each card needs to:</p>
<ul><li>Make sense on its own</li><li>Not be so long that it&apos;s unwieldy</li><li>Not be so short that it&apos;s useless</li></ul>
<p>That&apos;s chunking for RAG systems.</p>
<h3 id="our-journey-through-chunking-strategies">Our Journey Through Chunking Strategies</h3>
<p><strong>Attempt 1: The Naive Approach</strong> We started by splitting documents every 1000 characters. The results were... educational. We&apos;d get chunks like:</p>
<p>&quot;...and under no circumstances should you mix Chemical A with Chemical B as this will cause an expl&quot;<br></p>
<p>The next chunk started with &quot;osion.&quot; Not ideal for a safety manual.</p>
<p><strong>Attempt 2: The Page-Based Method</strong> &quot;Let&apos;s just use page boundaries!&quot; we thought. Then we discovered that one client&apos;s PDFs had been created by scanning double-sided documents incorrectly. Page 1 was the cover, page 2 was the back of page 50, page 3 was page 2... You get the picture.</p>
<p><strong>Attempt 3: The Breakthrough</strong> We realized documents have natural boundaries&#x2014;headings, sections, paragraphs. Our tag-based semantic chunking with BeautifulSoup was born:</p>
<p></p>
<pre><code> from bs4 import BeautifulSoup, NavigableString
def semantic_chunk(html_content):
    soup = BeautifulSoup(html_content, &apos;html.parser&apos;)
    chunks = []
    current_chunk = {
        &apos;content&apos;: &apos;&apos;,
        &apos;metadata&apos;: {}
    }
    
    for element in soup.find_all([&apos;h1&apos;, &apos;h2&apos;, &apos;h3&apos;, &apos;p&apos;, &apos;table&apos;, &apos;ul&apos;, &apos;ol&apos;]):
        if element.name in [&apos;h1&apos;, &apos;h2&apos;, &apos;h3&apos;]:
            # Save previous chunk if it exists
            if current_chunk[&apos;content&apos;]:
                chunks.append(current_chunk)
            # Start new chunk with heading
            current_chunk = {
                &apos;content&apos;: element.get_text(),
                &apos;metadata&apos;: {
                    &apos;heading_level&apos;: element.name,
                    &apos;section&apos;: element.get_text()
                }
            }
        elif element.name == &apos;table&apos;:
            # Tables stay together with their section
            table_md = convert_table_to_markdown(element)
            if len(current_chunk[&apos;content&apos;]) + len(table_md) &gt; MAX_CHUNK_SIZE:
                chunks.append(current_chunk)
                current_chunk = {&apos;content&apos;: table_md, &apos;metadata&apos;: {&apos;has_table&apos;: True}}
            else:
                current_chunk[&apos;content&apos;] += &apos;\n&apos; + table_md
        else:
            # Add to current chunk
            current_chunk[&apos;content&apos;] += &apos;\n&apos; + element.get_text()
    
    return chunks
</code></pre>

<h3 id="the-table-problem-and-our-solution">The Table Problem (And Our Solution)</h3>
<p>Tables were our nemesis. A 50-row table about chemical properties can&apos;t fit in a single chunk, but splitting it randomly loses meaning. Our solution:</p>
<ol><li><strong>Keep small tables intact</strong> (under 20 rows)</li><li><strong>For large tables</strong>, split by logical groups (e.g., chemicals A-M, N-Z)</li><li><strong>Always include headers</strong> in every chunk</li><li><strong>Add context</strong> about what was omitted (&quot;Rows 21-50 available in next chunk&quot;)</li></ol>
<h3 id="the-clever-bit-chunk-small-retrieve-big">The Clever Bit: Chunk Small, Retrieve Big</h3>
<p>Here&apos;s where we got smart. We chunk small (500 tokens) for precise retrieval, but we return the entire page to the LLM. Why?</p>
<p>In construction safety, context is everything:</p>
<ul><li>A procedure&apos;s warnings might be 3 paragraphs away</li><li>Diagrams often explain the text</li><li>Exception clauses hide in footnotes</li></ul>
<p>So our approach:</p>
<ol><li><strong>Index small chunks</strong> for accurate semantic search</li><li><strong>Store page boundaries</strong> in metadata</li><li><strong>Return full pages</strong> that contain the matching chunks</li></ol>
<p>This way, when someone asks &quot;How do I install guardrails?&quot;, they get the complete procedure, not just the paragraph mentioning guardrails.</p>
<hr>
<h2 id="chapter-3-embeddingsteaching-computers-to-understand-meaning">Chapter 3: Embeddings - Teaching Computers to Understand Meaning</h2>
<h3 id="the-non-technical-explanation">The Non-Technical Explanation</h3>
<p>Embeddings are like creating a &quot;meaning fingerprint&quot; for text. Similar meanings get similar fingerprints. It&apos;s how the system knows that &quot;fire extinguisher location&quot; and &quot;where to find emergency fire suppression equipment&quot; are asking about the same thing.</p>
<h3 id="our-embedding-model-journey">Our Embedding Model Journey</h3>
<p><strong>Month 1-2: OpenAI&apos;s text-embedding-002</strong></p>
<ul><li>Pros: Reliable, well-documented</li><li>Cons: Struggled with technical jargon</li><li>Memorable failure: Thought &quot;PCB disposal&quot; (Polychlorinated Biphenyls) was about computer circuit boards</li></ul>
<p><strong>Month 3: Google&apos;s Embedding Models</strong></p>
<ul><li>Pros: Fantastic with technical content</li><li>Cons: Rate limits hit us every hour (not just peak times!)</li><li>The breaking point: &quot;You have exceeded your quota&quot; became our most common error message</li></ul>
<p><strong>Month 2-3: OpenAI&apos;s text-embedding-003</strong></p>
<ul><li>The goldilocks solution: Good enough performance, rock-solid reliability</li><li>Only 1% worse than Google on our benchmarks, but actually available when we needed it</li></ul>
<h3 id="the-jargon-problem">The Jargon Problem</h3>
<p>Construction sites have their own language:</p>
<ul><li>&quot;RAMS&quot; (Risk Assessment Method Statements)</li><li>&quot;PTW&quot; (Permit to Work)</li><li>&quot;SWMS&quot; (Safe Work Method Statements)</li><li>&quot;SWL&quot; (Safe Working Load) vs &quot;WLL&quot; (Working Load Limit)</li></ul>
<p>Standard embedding models had never seen these terms used correctly. Our solution? We created a glossary preprocessing step:</p>
<p>User query: &quot;Where&apos;s the RAMS for working at height?&quot;<br>Expanded query: &quot;Where&apos;s the RAMS (Risk Assessment Method Statement) for working at height elevated work?&quot;<br></p>
<p>This simple trick improved retrieval accuracy by 15%.</p>
<hr>
<h2 id="chapter-4-building-the-data-pipeline-or-how-i-learned-to-stop-worrying-and-love-parallel-processing">Chapter 4: Building the Data Pipeline (Or: How I Learned to Stop Worrying and Love Parallel Processing)</h2>
<h3 id="the-scale-challenge">The Scale Challenge</h3>
<p>Processing 100,000 documents sounds abstract until you do the math:</p>
<ul><li>Average processing time per document: 3.6 seconds</li><li>Sequential processing time: 100 hours</li><li>Client&apos;s patience: 4 hours</li></ul>
<h3 id="parallel-processing-adventures">Parallel Processing Adventures</h3>
<p>Our first attempt at parallelization was... enthusiastic. We spawned 1000 threads and promptly crashed our servers. The Azure API started returning 429 errors (too many requests), and our monitoring dashboard looked like a Christmas tree.</p>
<p>Here&apos;s what actually worked:</p>
<pre><code># The sweet spot we found

WORKER_PROCESSES = 16
BATCH_SIZE = 100
RATE_LIMIT_DELAY = 0.1  # seconds between batches

# Process documents in controlled batches
with ProcessPoolExecutor(max_workers=WORKER_PROCESSES) as executor:
    for batch in document_batches:
        futures = [executor.submit(process_doc, doc) for doc in batch]
        results = [f.result() for f in futures]
        
        # Respect the API&apos;s feelings
        time.sleep(RATE_LIMIT_DELAY)
        upload_to_azure(results)
</code></pre>

<h3 id="the-metadata-bug-that-changed-everything">The Metadata Bug That Changed Everything</h3>
<p>Three months in, we noticed something odd. Our retrieval was working fine&#x2014;we were getting the right chunks back. But our relevance scores were terrible. Why?</p>
<p>After 12 hours of debugging, we found it: LlamaIndex was embedding our metadata <em>along with</em> the content. Every chunk was being embedded with 7,000 tokens of invisible text:</p>
<pre><code>chunk_id: doc_12345_chunk_67
source_document: scaffold_safety_manual_v2.pdf
page_numbers: 45-47
last_modified: 2024-03-15
document_type: safety_manual
...actual 500 tokens of content here...
</code></pre>

<p>The fix was surprisingly simple:</p>
<pre><code>def safe_get_content(self, metadata_mode=None) -&gt; str:
    return self.text  # Return ONLY the text, ignore metadata

TextNode.get_content = safe_get_content  # Monkey patch
</code></pre>

<p>The impact was massive:</p>
<ul><li>Embedding size: 7,000 tokens &#x2192; 500 tokens</li><li>Embedding cost: Down 93%</li><li>Relevance scores: Up 10%</li><li>Confidence in results: Through the roof</li></ul>
<p>By removing all that noise, our embeddings finally captured what actually mattered&#x2014;the content.</p>
<hr>
<h2 id="chapter-5-retrievalfinding-needles-in-a-digital-haystack">Chapter 5: Retrieval - Finding Needles in a Digital Haystack</h2>
<h3 id="the-hybrid-approach">The Hybrid Approach</h3>
<p>Think of retrieval like looking for a book in a library. You might:</p>
<ol><li>Remember exact words from the title (sparse retrieval)</li><li>Remember what it was about (dense retrieval)</li></ol>
<p>Best results? Use both.</p>
<h3 id="azure-search-our-unexpected-hero">Azure Search: Our Unexpected Hero</h3>
<p>We initially wanted to build our own vector database. &quot;How hard could it be?&quot; (Narrator: It was very hard.)</p>
<p>Azure AI Search saved us months of work:</p>
<ul><li>Handled both vector and keyword search</li><li>Scaled to millions of documents without breaking a sweat</li><li>Built-in security filters (crucial for enterprise use)</li></ul>
<h3 id="the-bug-that-made-us-question-reality">The Bug That Made Us Question Reality</h3>
<p>Azure&apos;s Python SDK had a subtle bug in hybrid search. It would silently fail and return only keyword results. For weeks, we thought our embeddings were broken. The fix? Direct API calls with the full payload:</p>
<pre><code class="language-python">payload = {
    &quot;search&quot;: query_text,  # Keyword search. &quot;&quot; for vector only
    &quot;vectorQueries&quot;: [
        {
            &quot;kind&quot;: &quot;vector&quot;, 
            &quot;vector&quot;: query_embeddings, 
            &quot;fields&quot;: &quot;embedding&quot;, 
            &quot;k&quot;: top_k * 6,  # Get more candidates for reranking
            &quot;exhaustive&quot;: True,
        }
    ],
    &quot;filter&quot;: filter_expression,
    &quot;queryType&quot;: &quot;semantic&quot;,
    &quot;semanticConfiguration&quot;: &quot;default-config&quot;,
    &quot;captions&quot;: &quot;extractive&quot;,
    &quot;answers&quot;: &quot;extractive|count-&quot; + str(top_k),
    &quot;top&quot;: top_k 
}

response = requests.post(
    f&quot;{endpoint}/indexes/{index}/docs/search?api-version=2023-11-01&quot;,
    headers={&quot;api-key&quot;: api_key},
    json=payload
)</code></pre>
<p>The exhaustive: True flag was crucial&#x2014;it ensured we searched the entire index, not just a sample.</p>
<h3 id="document-specific-queries">Document-Specific Queries</h3>
<p>Users often wanted answers from specific documents:</p>
<ul><li>&quot;What does the crane manual say about wind limits?&quot;</li><li>&quot;Check the 2024 building code for foundation requirements&quot;</li></ul>
<p>We added semantic document filtering:</p>
<pre><code>def handle_document_specific_query(query, documents_mentioned):
    # Use embeddings to find the most relevant document
    doc_embeddings = get_embeddings(documents_mentioned)
    
    # Semantic search for document names
    relevant_docs = semantic_search_documents(doc_embeddings)
    
    # Add filter to search
    filter_expression = f&quot;document_name eq &apos;{relevant_docs[0]}&apos;&quot;
    
    return search_with_filter(query, filter_expression)</code></pre>
<p>This let users naturally reference documents without knowing exact filenames.</p>
<hr>
<h2 id="chapter-6-generationmaking-the-ai-actually-helpful">Chapter 6: Generation - Making the AI Actually Helpful</h2>
<h3 id="the-context-window-challenge">The Context Window Challenge</h3>
<p>LLMs have a context limit&#x2014;think of it as their &quot;working memory.&quot; GPT-4o can handle about 8,000 tokens (roughly 6,000 words). Sounds like a lot until you&apos;re trying to include:</p>
<ul><li>User&apos;s question</li><li>Conversation history</li><li>10 retrieved document chunks</li><li>System instructions</li></ul>
<p>Our solution was ruthless prioritization:</p>
<pre><code>def prepare_context(query, retrieved_chunks, history):
    # Start with essentials
    context = system_prompt + query
    remaining_tokens = MAX_TOKENS - count_tokens(context)
    
    # Add chunks by relevance until we run out of space
    for chunk in sorted(retrieved_chunks, by=&apos;relevance&apos;):
        if count_tokens(chunk) &lt; remaining_tokens:
            context += chunk
            remaining_tokens -= count_tokens(chunk)
    
    # Add recent history if there&apos;s room
    # ...</code></pre>
<h3 id="query-understanding-and-rewriting">Query Understanding and Rewriting</h3>
<p>Users don&apos;t always ask clear questions. Real examples from our logs:</p>
<ul><li>&quot;That thing about the chemical spill&quot;</li><li>&quot;What John sent last week about safety&quot;</li><li>&quot;The new procedure (not the old one)&quot;</li></ul>
<p>Our query rewriting pipeline:</p>
<ol><li><strong>Intent Detection</strong>: Is this a lookup, comparison, or clarification?</li><li><strong>Entity Extraction</strong>: What documents, topics, or time periods?</li><li><strong>Expansion</strong>: Add synonyms and related terms</li><li><strong>Context Integration</strong>: Use conversation history</li></ol>
<p>Example transformation:</p>
<ul><li>Original: &quot;That thing about the chemical spill&quot;</li><li>After processing: &quot;chemical spill response procedure incident protocol hazmat&quot;</li></ul>
<h3 id="generation-tuning-the-endless-quest-for-zero-hallucinations">Generation Tuning: The Endless Quest for Zero Hallucinations</h3>
<p>Even with perfect retrieval, LLMs can still get creative. We tested endless combinations:</p>
<pre><code># Our final generation parameters (after 100+ experiments)
generation_config = {
    &quot;temperature&quot;: 0.1,  # Low for factual accuracy
    &quot;top_p&quot;: 0.9,       # Some diversity, but not too much
    &quot;frequency_penalty&quot;: 0.3,  # Reduce repetition
    &quot;presence_penalty&quot;: 0.0,   # Don&apos;t force novelty
    &quot;max_tokens&quot;: 2000,
    &quot;model&quot;: &quot;gpt-4o&quot; 
}</code></pre>
<p>Key learnings:</p>
<ul><li>Lower temperature = More consistent, less creative</li><li>Frequency penalty helped with repetitive safety warnings</li><li>GPT-4o vs GPT-4.1 vs GPT-4.1-mini vs More</li></ul>
<h3 id="multi-language-support-because-construction-is-global">Multi-Language Support (Because Construction is Global)</h3>
<p>Our sites operate worldwide. The solution:</p>
<ol><li><strong>Query Processing</strong>:</li></ol>
<pre><code># Detect language
source_lang = detect_language(user_query)

# Translate to English for retrieval
english_query = translate_to_english(user_query)

# Search in English (all docs are in English)
results = search(english_query)

# Translate response back
response = generate_response(results)
translated_response = translate_to_language(response, source_lang)</code></pre>
<ol><li><strong>Document Cleaning</strong>: During ingestion, we also removed any non-English text that accidentally made it into safety manuals (surprising how often this happened)</li></ol>
<hr>
<h2 id="chapter-7-evaluationmeasuring-what-matters">Chapter 7: Evaluation - Measuring What Matters</h2>
<h3 id="building-a-test-set-aka-the-most-painful-month-of-my-life">Building a Test Set (AKA: The Most Painful Month of My Life)</h3>
<p>We needed to know: Is this thing actually working? Our evaluation approach:</p>
<ol><li><strong>Generated 1,000 synthetic questions</strong> using GPT-4o:&quot;Based on this scaffold safety section, generate 5 questions a construction worker might realistically ask&quot;<br></li><li><strong>Manual annotation</strong> - Let me tell you about pain...</li></ol>
<p>The manual annotation process:</p>
<ul><li>Me and 10,000 mg of caffeine</li><li>Each query needed: correct document, correct section, acceptable answer</li><li>Took a week of mind-numbing work</li><li>Found errors in source documents (bonus outcome!)</li><li>Created gold standard that caught issues automated testing missed</li></ul>
<p>Example annotation:</p>
<p>{<br>  &quot;query&quot;: &quot;Maximum wind speed for crane operation?&quot;,<br>  &quot;correct_docs&quot;: [&quot;crane_safety_manual_v3.pdf&quot;, &quot;site_weather_policy.pdf&quot;],<br>  &quot;correct_sections&quot;: [&quot;Section 4.3&quot;, &quot;Appendix B&quot;],<br>}<br></p>
<h3 id="key-metrics-that-mattered">Key Metrics That Mattered</h3>
<p><strong>Recall@K</strong>: Of the top K retrieved chunks, how many contain the answer?</p>
<ul><li>Recall@3: 91% (great for focused questions)</li><li>Recall@10: 97% (catches edge cases)</li></ul>
<p><strong>Faithfulness</strong>: Is the generated answer supported by retrieved documents?</p>
<ul><li>Measured using RAGAS framework</li><li>Our score: 94% (6% needed manual review)</li></ul>
<p><strong>Response Time</strong>:</p>
<ul><li>P50: 2.1 seconds</li><li>P95: 3.8 seconds</li><li>P99: 5.2 seconds (usually complex multi-hop queries)</li></ul>
<h3 id="the-failure-analysis-that-saved-us">The Failure Analysis That Saved Us</h3>
<p>Every wrong answer taught us something:</p>
<p><strong>Failure Type 1: Temporal Confusion</strong></p>
<ul><li>Question: &quot;What&apos;s the current procedure for waste disposal?&quot;</li><li>System retrieved: Outdated 2019 procedure</li><li>Fix: Added &quot;effective date&quot; metadata and filtering</li></ul>
<p><strong>Failure Type 2: Partial Retrieval</strong></p>
<ul><li>Question: &quot;Complete checklist for equipment startup&quot;</li><li>System retrieved: Only items 1-5 of a 10-item list</li><li>Fix: Improved chunk boundary detection for lists</li></ul>
<p><strong>Failure Type 3: Acronym Confusion</strong></p>
<ul><li>Question: &quot;PPE requirements for height work&quot;</li><li>System confused: Personal Protective Equipment vs. some random engineering term</li><li>Fix: Context-aware acronym expansion with construction-specific dictionary</li></ul>
<hr>
<h2 id="chapter-8-lessons-learned-and-battle-scars">Chapter 8: Lessons Learned and Battle Scars</h2>
<h3 id="technical-lessons">Technical Lessons</h3>
<ol><li><strong>Start with data quality</strong>: Garbage in, garbage out. We spent 40% of our time on preprocessing.</li><li><strong>Monitoring is not optional</strong>: We track everything:<ul><li>Query latency by component</li><li>Retrieval relevance scores</li><li>User feedback (thumbs up/down)</li><li>API costs (those embeddings add up!)</li></ul></li><li><strong>Build for failure</strong>: Everything fails. APIs go down. Models return nonsense. Have fallbacks.</li><li><strong>Test with real data early</strong>: Our synthetic tests missed edge cases real documents exposed.</li></ol>
<h3 id="business-lessons">Business Lessons</h3>
<ol><li><strong>RAG is not a silver bullet</strong>: It solves hallucination but introduces complexity. Make sure the tradeoff is worth it.</li><li><strong>User training matters</strong>: Even the best system fails if users don&apos;t know how to query it.</li><li><strong>Incremental rollout saves lives</strong>: We started with one department, learned, adjusted, then expanded.</li><li><strong>Cost modeling is crucial</strong>:<ul><li>Document conversion: ~&#x20B9;5000/month for processing services</li><li>Embedding costs: $0.13/million tokens &#xD7; millions of chunks = real money</li><li>Storage: &#x20B9;16,000/month for our Azure index</li><li>LLM inference: ~$0.03 per query (more with conversation history)</li><li>Query expansion and caching helped control costs</li><li>At scale, this adds up quickly (but still cheaper than lawsuits)</li></ul></li></ol>
<h3 id="human-lessons">Human Lessons</h3>
<ol><li><strong>Document your decisions</strong>: Six months later, you won&apos;t remember why you chose that chunk size.</li><li><strong>Celebrate small wins</strong>: First successful retrieval. First day without crashes. These matter.</li><li><strong>Listen to users</strong>: Our best improvements came from user complaints, not our clever ideas.</li></ol>
<hr>
<h2 id="chapter-9-whats-next">Chapter 9: What&apos;s Next</h2>
<h3 id="the-immediate-roadmap">The Immediate Roadmap</h3>
<p><strong>Performance Improvements</strong> (Already Done!):</p>
<ul><li>Implemented intelligent caching for common queries</li><li>Considering dedicated vector database for sub-second responses</li><li>Smart cache invalidation when documents update</li></ul>
<p><strong>Better Understanding</strong>:</p>
<ul><li>Fine-tune embeddings on construction terminology</li><li>Implement query intent classification</li><li>Multi-language support already live (query in Arabic, get answers from English docs)</li></ul>
<p><strong>Advanced Features</strong>:</p>
<ul><li>Multi-document reasoning (&quot;Compare scaffold procedures across all our sites&quot;)</li><li>Temporal queries (&quot;What changed in crane regulations since last year?&quot;)</li><li><strong>Graph RAG</strong> for discovering relationships between safety procedures (experimental)</li></ul>
<h3 id="the-dream-features">The Dream Features</h3>
<p>What&apos;s actually in our pipeline:</p>
<ol><li><strong>Voice Interface</strong>: &quot;Hey NavBot, what&apos;s the lockout procedure for this equipment?&quot; (Q2 2025)</li><li><strong>Predictive Safety</strong>: &quot;Based on these incident reports, similar accidents likely on rainy days&quot;</li></ol>
<hr>
<h2 id="final-thoughts-was-it-worth-it">Final Thoughts: Was It Worth It?</h2>
<p>Three months. Countless late nights. More Python stack traces than I care to remember. Was building a RAG system from scratch worth it?</p>
<p>When I see a crane operator quickly verify wind speed limits before a critical lift&#x2014;yes.</p>
<p>When our system prevents someone from using outdated scaffold procedures&#x2014;absolutely.</p>
<p>When we can show an OSHA inspector exactly which manual section backs up our safety practices&#x2014;without question.</p>
<p>Building a production RAG system is hard. Really hard. But in construction, where a single wrong answer could cost lives, it&apos;s the only responsible path forward.</p>
<p>To anyone embarking on this journey: Document everything. Test ruthlessly. Listen to your users. And remember&#x2014;every bug you fix is one less 3 AM phone call about a workplace accident.</p>
<hr>
<h2 id="acknowledgments">Acknowledgments</h2>
<p>This project wouldn&apos;t have been possible without:</p>
<ul><li>The Navatech engineering team who debugged alongside me</li><li>Our beta clients who patiently reported &quot;weird results&quot;</li><li>Approximately 1,247 cups of coffee</li></ul>
<hr>
<h2 id="resources-and-code-samples">Resources and Code Samples</h2>
<p>While I can&apos;t share our proprietary code, here are the open-source tools that made this possible:</p>
<ul><li>Document Processing: <a href="https://github.com/Unstructured-IO/unstructured?ref=engineering.navatech.ai">Unstructured.io</a></li><li>Orchestration: <a href="https://github.com/jerryjliu/llama_index?ref=engineering.navatech.ai">LlamaIndex</a> (with our patches)</li><li>Evaluation: <a href="https://github.com/explodinggradients/ragas?ref=engineering.navatech.ai">RAGAS</a></li><li>Vector Store: <a href="https://azure.microsoft.com/en-us/services/search/?ref=engineering.navatech.ai">Azure AI Search</a> (or try FAISS/Chroma for open-source)</li></ul>
<p><em>Have questions about building your own RAG system? Find me on <a href="https://www.linkedin.com/in/lakshaychhabra123/?ref=engineering.navatech.ai"><em>LinkedIn</em></a>, Email (lakshay.chhabra@navatech.ai) or drop a comment below. Always happy to help fellow engineers avoid the pitfalls we discovered the hard way.</em></p>]]></content:encoded></item><item><title><![CDATA[Breaking Boundaries: Leveraging Web Assembly and Mediapipe for running SLM's offline on the Edge]]></title><description><![CDATA[Leveraging the power of WebAssembly (WASM) and Mediapipe, we are reimagining health and safety and revolutionizing the way SLM's are deployed, enabling them to run offline on mobile devices.]]></description><link>http://engineering.navatech.ai/slms-on-the-edge-web-assembly-and-mediapipe-in-action/</link><guid isPermaLink="false">661df96a49e469a789311205</guid><category><![CDATA[conversational agent]]></category><category><![CDATA[llm]]></category><category><![CDATA[ml]]></category><category><![CDATA[offline]]></category><dc:creator><![CDATA[Joinal Ahmed]]></dc:creator><pubDate>Thu, 25 Apr 2024 05:28:18 GMT</pubDate><content:encoded><![CDATA[<p>In a world where access to crucial health and safety information can mean the difference between life and death, the need for universal accessibility knows no bounds. At NavaTech, we are driven by a singular mission: to ensure that everyone, regardless of their location or internet connectivity, has access to vital health and safety resources. Our innovative approach combines cutting-edge technology with a commitment to global safety. Leveraging the power of <a href="https://webassembly.org/?ref=engineering.navatech.ai"><strong>WebAssembly (WASM)</strong></a> and <a href="https://developers.google.com/mediapipe?ref=engineering.navatech.ai"><strong>Mediapipe</strong></a>, we are reimagining health and safety and revolutionizing the way SLM&apos;s are deployed, enabling them to run offline on mobile devices. At Navatech Group, our startup is dedicated to making AI more accessible by breaking down communication barriers. Our mission centers on bridging the digital divide between urban centers and remote areas, ensuring that AI technology is available and beneficial to all, regardless of location or connectivity. By focusing on accessible AI, we are setting new global standards for ensuring safety and ease of access to advanced technologies. This commitment to accessibility not only fosters inclusivity but also enhances connectivity across diverse communities worldwide.</p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/Designer.jpeg" class="kg-image" alt loading="lazy" width="1024" height="1024" srcset="http://engineering.navatech.ai/content/images/size/w600/2024/04/Designer.jpeg 600w, http://engineering.navatech.ai/content/images/size/w1000/2024/04/Designer.jpeg 1000w, http://engineering.navatech.ai/content/images/2024/04/Designer.jpeg 1024w" sizes="(min-width: 720px) 720px"></figure>
<p>Google released Mediapipe LLM APU on March 7th 2024, and we had been trying to fast follow the innovation and make SLMs available offline for our users, In this blog, we will delve into the intricacies of our approach, exploring the challenges of ensuring health and safety information reaches every corner of the globe. We&apos;ll discuss the role of WebAssembly and Mediapipe in enabling offline SLM deployment on mobile devices and examine the technical aspects of how these technologies work together to achieve our mission. Furthermore, we&apos;ll highlight real-world scenarios where our offline edge solutions have made a tangible impact, from bustling city centers to remote sites with limited connectivity. Join us on this journey as we unlock the potential of technology to empower safety everywhere.</p>
<h3 id="how-llms-are-deployed-today">How LLM&apos;s are deployed today? </h3>
<p>In a typical Large Language Model (LLM) deployment scenario, the LLM is hosted on a public cloud infrastructure like AWS or GCP and exposed as an API endpoint. This API serves as the interface through which external applications, such as mobile apps on Android and iOS devices or Web Serices, interact with the LLM to perform natural language processing tasks. When a user initiates a request through the mobile app, the app sends a request to the API endpoint using data, specifying the desired task, such as text generation or sentiment analysis. </p>
<figure class="kg-card kg-image-card"><img src="https://miro.medium.com/v2/resize:fit:700/1*gCG3AUvvr35s4etkVQQaGA.jpeg" class="kg-image" alt="Comparing LLM serving frameworks &#x2014; LLMOps | by Thiyagarajan Palaniyappan |  Medium" loading="lazy"></figure>
<p>The API processes the request, utilizing the LLM to perform the required task, and returns the result to the mobile app. This architecture enables seamless integration of LLM capabilities into mobile applications, allowing users to leverage advanced language processing functionalities directly from their devices while offloading the computational burden to the cloud infrastructure.</p>
<p>To overcome the limitations of relying on internet connectivity and ensure users have the flexibility and ease to interact with their safety copilot even in remote locations or locations where internet isn&#x2019;t available like basements or underground facilities while safeguarding privacy, the optimal solution is to run Large Language Models (LLMs) on-device, offline. By deploying LLMs directly on users&apos; devices, such as mobile phones and tablets, we eliminate the need for continuous internet access and the associated back-and-forth communication with remote servers. This approach empowers users to access their safety copilot anytime, anywhere, without dependency on network connectivity.</p>
<p><strong>What are Small Language Models (SLMs) ?</strong></p>
<p>Small Language Models (SLMs) represent a focused subset of artificial intelligence tailored for specific enterprise needs within Natural Language Processing (NLP). Unlike their larger counterparts like GPT-4, SLMs prioritize efficiency and precision over sheer computational power. They are trained on domain-specific datasets, enabling them to navigate industry-specific terminologies and nuances with accuracy. In contrast to Large Language Models (LLMs), which may lack customization for enterprise contexts, SLMs offer targeted, actionable insights while minimizing inaccuracies and the risk of generating irrelevant information. SLMs are characterized by their compact architecture, lower computational demands, and enhanced security features, making them cost-effective and adaptable for real-time applications like chatbots. Overall, SLMs provide tailored efficiency, enhanced security, and lower latency, addressing specific business needs effectively while offering a promising alternative to the broader capabilities of LLMs.</p>
<p><strong>Why running SLM&apos;s offline at edge is a challenge?</strong></p>
<p>Running small language models (SLMs) offline on mobile phones  enhances privacy, reduces latency, and promotes access. Users can interact with llm-based applications, receive critical information, and perform tasks even in offline environments, ensuring accessibility and control over personal data. Real-time performance and independence from centralized infrastructure unlock new opportunities for innovation in mobile computing, offering a seamless and responsive user experience. However, running SLMs offline on mobile phones presents several challenges due to the constraints of mobile hardware and the complexities of running LLM tasks. Here are some key challenges:</p>
<ol><li><strong>Limited Processing Power:</strong> Mobile devices, especially smartphones, have limited computational resources compared to desktop computers or servers. SLMs often require significant processing power to execute tasks such as text generation or sentiment analysis, which can strain the capabilities of mobile CPUs and GPUs.</li><li><strong>Memory Constraints:</strong> SLMs typically require a significant amount of memory to store model parameters and intermediate computations. Mobile devices have limited RAM compared to desktops or servers, making it challenging to load and run large language models efficiently.</li><li><strong>Battery Life Concerns:</strong> Running resource-intensive tasks like NLP on mobile devices can drain battery life quickly. Optimizing SLMs for energy efficiency is crucial to ensure that offline usage remains practical without significantly impacting battery performance.</li><li><strong>Storage Limitations:</strong> Storing large language models on mobile devices can be problematic due to limited storage space. Balancing the size of the model with the available storage capacity while maintaining performance is a significant challenge.</li><li><strong>Update and Maintenance:</strong> Keeping SLMs up to date with the latest improvements and security patches presents challenges for offline deployment on mobile devices. Ensuring seamless updates while minimizing data usage and user inconvenience requires careful planning and implementation.</li><li><strong>Real-Time Performance:</strong> Users expect responsive performance from mobile applications, even when running complex NLP tasks offline. Optimizing SLMs for real-time inference on mobile devices is crucial to provide a smooth user experience.</li></ol>
<p><strong>Enabling on-device LLM&apos;s with Mediapipe and Web Assembly </strong></p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/Untitled-design.png" class="kg-image" alt loading="lazy" width="1920" height="1080" srcset="http://engineering.navatech.ai/content/images/size/w600/2024/04/Untitled-design.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2024/04/Untitled-design.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2024/04/Untitled-design.png 1600w, http://engineering.navatech.ai/content/images/2024/04/Untitled-design.png 1920w" sizes="(min-width: 720px) 720px"></figure>
<p><a href="https://www.tensorflow.org/lite?ref=engineering.navatech.ai">TensorFlow Lite</a> revolutionized on-device ML in 2017, and <a href="https://developers.google.com/mediapipe?ref=engineering.navatech.ai">MediaPipe</a> expanded its capabilities further in 2019. Now, with the release of <a href="https://developers.googleblog.com/2024/03/running-large-language-models-on-device-with-mediapipe-andtensorflow-lite.html?ref=engineering.navatech.ai">experimental MediaPipe LLM Inference API</a>, developers can <strong>run Large Language Models (LLMs) entirely on-device</strong>. This breakthrough, supporting Web, Android, and iOS, facilitates integration and testing of popular LLMs like <strong>Gemma, Phi 2, Falcon, and Stable LM</strong>. This latest release marks a paradigm shift, empowering developers to deploy Large Language Models fully on-device across various platforms. This capability is particularly groundbreaking considering the substantial memory and compute requirements of LLMs, which can be over a hundred times larger than traditional on-device models. The achievement is made possible through a series of <strong>optimizations across the on-device stack</strong>, including the integration of <strong>new operations, quantization techniques, caching mechanisms, and weight sharing strategies</strong>.  These optimizations ranging from weights sharing, XNNPack, and our GPU-accelerated runtime for efficient on-device LLM inference to custom operators, were crucial in balancing computational demands and memory constraints, ultimately enhancing performance across platforms. </p>
<p><strong>But what is WebAssembly?</strong></p>
<p><strong>WebAssembly</strong> (Wasm) emerged as a game-changer, originally designed for web browsers to <strong>enable the execution of non-JavaScript code seamlessly</strong>. Its binary format, compatible with multiple programming languages, offers significant advantages: it runs on any operating system and processor architecture and operates within a highly secure sandbox environment. Beyond browsers, Wasm finds utility in cloud computing, enabling providers like AWS to lease Wasm runtimes to customers for serverless-style workloads. In the realm of AI, Wasm offers a compelling solution for resource-intensive tasks like generative AI. By <strong>efficiently time-slicing GPU access and ensuring platform neutrality, Wasm optimizes GPU usage and facilitates seamless deployment across diverse hardware environments</strong>. Advances such as the <a href="https://github.com/WebAssembly/wasi-nn?ref=engineering.navatech.ai">WebAssembly Systems Interface &#x2013; Neural Networks (WASI-NN)</a> standard further enhance its capabilities, promising a future where Wasm plays a pivotal role in <a href="https://deislabs.io/posts/wasi-nn-onnx/?ref=engineering.navatech.ai">democratizing access to AI-grade compute power and optimizing AI workloads</a>.</p>
<figure class="kg-card kg-image-card"><img src="https://tvm.apache.org/images/webgpu/tvm-wasm-stack.png" class="kg-image" alt="image" loading="lazy"></figure>
<p>WebAssembly offers a suite of advantages that significantly augment web development, distinguishing it as a prime solution for optimizing web applications. Its foremost attribute lies in speed, facilitated by its compact binary size, which expedites downloads, particularly on slower networks. Additionally, its statically typed nature and pre-compiled optimizations markedly accelerate decoding and execution processes compared to JavaScript. Moreover, its inherent portability ensures consistent performance across diverse platforms, bolstering overall user experience. Lastly, WebAssembly&apos;s flexibility empowers developers to compile code from multiple programming languages into a unified binary format, thereby capitalizing on existing expertise and codebases while reaping the performance benefits of WebAssembly, thus streamlining and enhancing web development endeavors.</p>
<h2 id="putting-it-all-togetheroffline-llms-on-mobile-devices-and-browser"><strong>Putting it all together  - Offline LLM&apos;s on mobile devices and browser!</strong></h2>
<p>Mediapipe and WebAssembly (WASM) collaborate seamlessly to enable Large Language Models (LLMs) on both mobile devices and web browsers, revolutionizing accessibility to vital resources. </p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/Screenshot-2024-04-21-at-10.45.17-AM.png" class="kg-image" alt loading="lazy" width="2000" height="964" srcset="http://engineering.navatech.ai/content/images/size/w600/2024/04/Screenshot-2024-04-21-at-10.45.17-AM.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2024/04/Screenshot-2024-04-21-at-10.45.17-AM.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2024/04/Screenshot-2024-04-21-at-10.45.17-AM.png 1600w, http://engineering.navatech.ai/content/images/size/w2400/2024/04/Screenshot-2024-04-21-at-10.45.17-AM.png 2400w" sizes="(min-width: 720px) 720px"></figure>
<p>Leveraging Mediapipe&apos;s versatile ML pipeline support and WASM&apos;s platform-neutral execution environment, we&apos;ve developed a robust solution that empowers users with offline access to LLMs for natural language processing tasks on nAI. Mediapipe&apos;s integration further enhances our capability by providing a streamlined framework for deploying and managing ML models, optimizing performance on resource-constrained mobile devices. Together, Mediapipe and WASM set a new standard for on-device ML inference, democratizing access to advanced language processing capabilities on a global scale, regardless of internet connectivity or device specifications.</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://engineering.navatech.ai/content/images/2024/04/Working_Aeroplane_Mode_nAI_3.gif" class="kg-image" alt loading="lazy" width="622" height="350" srcset="http://engineering.navatech.ai/content/images/size/w600/2024/04/Working_Aeroplane_Mode_nAI_3.gif 600w, http://engineering.navatech.ai/content/images/2024/04/Working_Aeroplane_Mode_nAI_3.gif 622w"><figcaption><span>Animated GIF showcasing Offline / Edge Capability</span></figcaption></figure>
<p>We are thrilled with the breakthrough capability, optimizations and the performance in today&#x2019;s experimental release of the Offline LLM  inference on nAI. This is just the start. Over 2024, we will expand to more custom models, offer broader conversion capabilities,  on-device QnA, high level workflows, and much much more. Furthermore, our mobile team has pushed the boundaries of innovation by leveraging Flutter to make this groundbreaking technology to our users and make sure it is available at every hands possible . Their dedication and expertise have played a pivotal role in bringing this cutting-edge feature to our customers, ensuring a seamless and intuitive experience across mobile platforms.</p>
<hr>
<p><strong>Join Our Team of Innovators!</strong></p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png" class="kg-image" alt loading="lazy" width="1792" height="672" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1600w, http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1792w" sizes="(min-width: 720px) 720px"></figure>
<p>Are you a passionate developer seeking exciting opportunities to shape the future of technology? We&apos;re looking for talented individuals to join our dynamic engineering team at Navatech Group. If you&apos;re eager to be part of groundbreaking projects and make a real impact, we want to hear from you!</p>
<p>Send your resume to <a href="http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/">careers@navatechgroup.com</a> and take the first step toward a rewarding career with us. Join Navatech Group today and be at the forefront of innovation!</p>
<p></p>]]></content:encoded></item><item><title><![CDATA[Driving Performance: Using JMeter for Scalability and Resilience Testing]]></title><description><![CDATA[<p>In the dynamic world of construction, where safety and efficiency are paramount, Navatech emerges as a groundbreaking solution. Our innovative conversational health and safety platform empowers construction workers with instant access to vital information&#x2014;all at the palm of their hands. Through a seamlessly integrated mobile app and cloud-based</p>]]></description><link>http://engineering.navatech.ai/jmeter-a-preferred-tool-for-performance-testing/</link><guid isPermaLink="false">661e00e149e469a789311228</guid><category><![CDATA[testing]]></category><category><![CDATA[scaling]]></category><category><![CDATA[jmeter]]></category><dc:creator><![CDATA[Bhargav Kadiya]]></dc:creator><pubDate>Thu, 18 Apr 2024 05:19:22 GMT</pubDate><content:encoded><![CDATA[<p>In the dynamic world of construction, where safety and efficiency are paramount, Navatech emerges as a groundbreaking solution. Our innovative conversational health and safety platform empowers construction workers with instant access to vital information&#x2014;all at the palm of their hands. Through a seamlessly integrated mobile app and cloud-based backend systems, Navatech revolutionizes the way construction professionals engage with critical safety protocols and procedural knowledge.</p>
<p>At Navatech, ensuring optimal performance and reliability of our platform is non-negotiable. That&apos;s where JMeter steps in as our trusted ally. By employing JMeter for rigorous load testing, we validate our products&apos; scalability and resilience under real-world conditions. This strategic approach not only guarantees uninterrupted access to essential information but also underscores our commitment to safeguarding the well-being and productivity of construction workers worldwide. Join us as we delve deeper into how Navatech leverages JMeter to deliver unparalleled safety and efficiency in the construction industry.</p>
<p><strong>How we use utilizes JMeter for performance testing?</strong></p>
<p>Performance testing is a crucial aspect of our development process, and JMeter plays a central role in this endeavor. Among various types of performance testing, load testing stands out as essential. This method allows us to evaluate a system&apos;s performance under real-world conditions, assessing its ability to handle varying levels of user activity. Load testing serves a clear purpose: to determine the system&apos;s capacity under different loads. It provides valuable insights into how much stress a device or software can withstand while maintaining functionality as per user expectations. Additionally, load testing helps us identify the maximum operating capacity of our applications, ensuring that the current infrastructure is sufficient to support their intended usage. Moreover, it aids in determining the optimal number of concurrent users that our applications can effectively accommodate, contributing to an enhanced user experience and overall system efficiency.</p>
<p><strong>Let&#x2019;s understand  JMeter and how it helps :</strong></p>
<p>Apache JMeter stands tall as a Java-based open-source tool designed to meticulously analyze and gauge the performance of web applications. The essence of JMeter&apos;s functionality can be encapsulated in the following diagram.</p>
<p>Consider a live application accessed by numerous users simultaneously, each potentially generating multiple requests. This scenario underscores the critical importance of thoroughly testing applications under such conditions. With JMeter, we&apos;re empowered to craft intricate test scenarios, comprising multiple users, multiple requests, or a combination of both.</p>
<p>Let&apos;s delve into some practical examples to elucidate this concept further.</p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/A.png" class="kg-image" alt loading="lazy" width="936" height="613" srcset="http://engineering.navatech.ai/content/images/size/w600/2024/04/A.png 600w, http://engineering.navatech.ai/content/images/2024/04/A.png 936w" sizes="(min-width: 720px) 720px"></figure>
<p>Suppose we have to test the load for 100 users who can concurrently use the API /api/v1/config/language-list for getting requests to fetch the languages list, Here&apos;s a step-by-step guide to load testing the API /api/v1/config/language-list for 100 concurrent users using Apache JMeter:</p>
<ul><li>Go to the Apache JMeter folder &gt;&gt; bin folder &gt;&gt; open the batch file&gt;&gt;select the Test Plan.</li><li>Next, right click on the Test Plan and add a Thread Group.</li><li>Now Provide the number of Threads and ramp-up time, In the Provided example we have used 100 threads (users) with a ramp-up time of 1 seconds.</li></ul>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/C.png" class="kg-image" alt loading="lazy" width="549" height="168"></figure>
<ul><li>Right-click on Thread Group and select Sampler and to add HTTP Request and provide the details for IP, Request Type, and Path</li></ul>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/D.png" class="kg-image" alt loading="lazy" width="552" height="164"></figure>
<ul><li>Now Add the Listeners to View the Load Report. In the Provided Example we have used 2 Listeners named &#x2013; View Results in Table, Summary Report and View Result tree</li><li>Now Execute the API Request from The RUN button in the Toolbar</li><li>Also we have tested all the APIs with different DB connection, Increase/Decrease DB connections, Increase/Decrease Pods and with Low to High AWS servers.</li></ul>
<p><strong><u>Results</u></strong></p>
<ul><li><strong>Summary Report</strong></li></ul>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/E.png" class="kg-image" alt loading="lazy" width="486" height="258"></figure>
<ul><li><strong>View Results Tree</strong></li></ul>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/F.png" class="kg-image" alt loading="lazy" width="487" height="258"></figure>
<ul><li><strong>View Results in Table</strong></li></ul>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/04/G.png" class="kg-image" alt loading="lazy" width="487" height="259"></figure>
<p>Analyzing the Results</p>
<p>After the test is complete, you can analyze the results to identify any performance issues. JMeter provides various performance metrics such as throughput, latency, and error rate, which can be used to identify performance bottlenecks. You can also generate reports and graphs to visualize the test results.</p>
<p><strong>Why Do We Use JMeter for Load Testing?</strong></p>
<p>JMeter is a preferred choice for load testing due to several key advantages:</p>
<ol><li><strong>Cost-effective:</strong> Being an open-source tool, JMeter eliminates the need for licensing fees, making it an economical option for load testing.</li><li><strong>Versatility:</strong> JMeter is not limited to just web applications; it supports performance testing across various application types, including web services, databases, LDAP, and shell scripts.</li><li><strong>Platform independence:</strong> Its Java-based architecture ensures compatibility across different operating systems, providing flexibility in deployment.</li><li><strong>Wide-ranging support:</strong> Beyond performance testing, JMeter caters to other non-functional testing requirements such as stress testing, web service testing, and distributed testing.</li><li><strong>Efficient recording and playback:</strong> JMeter offers intuitive features for recording and playback, equipped with drag-and-drop functionality, streamlining the testing process and enhancing efficiency.</li><li><strong>Customization:</strong> As an open-source tool, JMeter allows developers to customize its functionalities to suit specific testing needs, ensuring adaptability to diverse testing scenarios.</li><li><strong>Robust community support:</strong> With an extensive library of tutorials and a vibrant community, JMeter users benefit from readily available resources and free plugins that augment analysis capabilities, fostering continuous improvement and innovation.</li></ol>
<p>These compelling features collectively make JMeter a favored solution for load testing, empowering teams to conduct thorough performance assessments with ease and precision.</p>
<hr>
<h3 id="conclusion">Conclusion </h3>
<p>In this blog, we have explored the indispensable role of Apache JMeter in the realm of performance testing, highlighting its myriad benefits and functionalities. As an open-source tool, JMeter offers a cost-effective solution for evaluating the performance of various applications, including web services and databases. With its user-friendly interface and interactive features, JMeter simplifies the testing process, making it accessible to both novice and experienced testers alike. Its versatility extends to simulating heavy loads and providing comprehensive performance metrics, enabling organizations to identify and address potential bottlenecks effectively. Moreover, JMeter&apos;s reliability ensures that applications can handle large volumes of traffic without compromising performance, thereby enhancing user satisfaction and trust. In essence, JMeter emerges as a powerful ally for ensuring the optimal performance of applications in today&apos;s dynamic digital landscape.</p>
<hr>
<p><strong>Join Our Team of Innovators!</strong></p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png" class="kg-image" alt loading="lazy" width="1792" height="672" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1600w, http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1792w" sizes="(min-width: 720px) 720px"></figure>
<p>Are you a passionate developer seeking exciting opportunities to shape the future of technology? We&apos;re looking for talented individuals to join our dynamic engineering team at Navatech Group. If you&apos;re eager to be part of groundbreaking projects and make a real impact, we want to hear from you!</p>
<p>Send your resume to <a href="http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/">careers@navatechgroup.com</a> and take the first step toward a rewarding career with us. Join Navatech Group today and be at the forefront of innovation!</p>]]></content:encoded></item><item><title><![CDATA[Data Migration Across Pinecone Indexes: A Stepwise Guide]]></title><description><![CDATA[<p>Pinecone, renowned for its vector database solutions, recently unveiled a groundbreaking serverless feature that has revolutionized workflows for many developers and data scientists. This innovative addition offers heightened flexibility and scalability, particularly when handling extensive vector datasets. However, alongside these benefits come new challenges, such as the migration of data</p>]]></description><link>http://engineering.navatech.ai/migrating-to-pinecone-serverless/</link><guid isPermaLink="false">65da3d5649e469a789311185</guid><dc:creator><![CDATA[Joinal Ahmed]]></dc:creator><pubDate>Sat, 24 Feb 2024 19:23:15 GMT</pubDate><media:content url="http://engineering.navatech.ai/content/images/2024/02/dm08162023-data-migration-best-practices.webp" medium="image"/><content:encoded><![CDATA[<img src="http://engineering.navatech.ai/content/images/2024/02/dm08162023-data-migration-best-practices.webp" alt="Data Migration Across Pinecone Indexes: A Stepwise Guide"><p>Pinecone, renowned for its vector database solutions, recently unveiled a groundbreaking serverless feature that has revolutionized workflows for many developers and data scientists. This innovative addition offers heightened flexibility and scalability, particularly when handling extensive vector datasets. However, alongside these benefits come new challenges, such as the migration of data between different Pinecone indexes. In this article, we&apos;ll delve into a Python script designed to streamline this process, ensuring efficiency and simplicity.</p>
<p>The introduction of Pinecone&apos;s serverless feature marks a significant advancement in vector data management, offering superior resource utilization and cost-effectiveness. Migrating data to a serverless index can streamline operations, particularly for projects dealing with large datasets. Pinecone serverless represents the next evolution of our vector database, boasting up to 50 times lower costs, intuitive usage (without requiring pod configuration), and enhanced vector-search performance across any scale. These advancements empower developers to deploy GenAI applications more seamlessly and rapidly.</p>
<p>The benefits of Pinecone serverless over pod-based indexes include:</p>
<ul><li><strong>Up to 50x Lower Costs:</strong> Separated pricing for reads and storage, usage-based billing, and more efficient indexing and searching contribute to significant cost savings.</li><li><strong>Effortless Setup and Scalability:</strong> No complex configurations or storage limits to contend with; simply name your index, load data, and start querying.</li><li><strong>Fast and Relevant Search Results: </strong>Pinecone serverless maintains functionality and performance comparable to pod-based indexes, supporting live updates, metadata filtering, hybrid search, and namespaces.</li></ul>
<p>Pinecone offers a focused set of functionalities through its Data Plane, primarily centered around managing and querying vector data efficiently. These functions cater to various operations involved in handling vector data within Pinecone indexes. </p>
<p>The core operations provided by Pinecone&apos;s Data Plane include:</p>
<table>
<thead>
<tr>
<th>Operation</th>
<th>Method(s)</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Upsert Vectors</td>
<td>POST</td>
<td>Add or update vectors in the index.</td>
</tr>
<tr>
<td>Query Vectors</td>
<td>POST</td>
<td>Search for vectors similar to a given query.</td>
</tr>
<tr>
<td>Fetch Vectors</td>
<td>GET</td>
<td>Retrieve vectors from the index based on their IDs.</td>
</tr>
<tr>
<td>Update a Vector</td>
<td>POST</td>
<td>Modify an existing vector in the index.</td>
</tr>
<tr>
<td>Delete Vectors</td>
<td>POST, DELETE</td>
<td>Remove vectors from the index.</td>
</tr>
<tr>
<td>List Vector IDs</td>
<td>GET</td>
<td>Retrieve a list of vector IDs present in the index.</td>
</tr>
<tr>
<td>Get Index Stats</td>
<td>POST, GET</td>
<td>Fetch statistics related to the index.</td>
</tr>
</tbody>
</table>
<p>While adopting serverless, you&#x2019;ll probably need to migrate your existing data to new indexes. Pinecone offers robust functionalities for managing vector data, however migration capabilities out of the box are not provided. </p>
<p>To resolve this and achieve the migration functionality, developers can leverage a combination of Pinecone&apos;s existing functionalities to accomplish data migration tasks effectively, extracting vector IDs using the &quot;List Vector IDs&quot; operation, fetching corresponding vectors using the &quot;Fetch Vectors&quot; operation, and then upserting these vectors into the target index using the &quot;Upsert Vectors&quot; operation. By utilizing these operations in tandem, users can effectively migrate vector data between Pinecone indexes, albeit with a manual orchestration process. </p>
<p>This approach capitalizes on Pinecone&apos;s versatile API capabilities to achieve seamless migration while maintaining data integrity and efficiency. Pinecone&apos;s Data Plane API encompasses essential functionalities tailored for seamless manipulation and management of vector data. The following operations are integral to this API:</p>
<p><strong>List vector IDs (GET):</strong><br>Retrieve vector IDs from a serverless index namespace via a GET request to https://{index_host}/vectors/list. Optionally filter with a prefix parameter. Default returns 100 IDs sorted; adjust limit parameter for custom pagination. Pagination tokens for fetching subsequent batches provided in responses.</p>
<p><strong>Fetch vectors (GET):</strong><br>GET request to https://{index_host}/vectors/fetch retrieves vectors by their IDs from a specified namespace. Response includes vector data and metadata. Critical for accessing stored vector content.</p>
<p><strong>Upsert vectors (POST):</strong><br>POST request to https://{index_host}/vectors/upsert writes vectors into a designated namespace. Previous values are overwritten for existing IDs. Request body should contain an array of vector objects, with a batch limit of 100 vectors per request. Namespace parameter specifies target namespace.</p>
<h2 id="putting-it-all-together">Putting it all together</h2>
<p>This Python script facilitates the migration of vector data from a source Pinecone index to a target Pinecone index. It utilizes the Pinecone library for managing the Pinecone indexes and performing operations such as querying and upserting vectors. The migration process is carried out in batches for efficiency.</p>
<script src="https://gist.github.com/joinalahmed/a4fd2b32281d40b42e89af08f48b22e9.js"></script>
<h3 id="key-components">Key Components:</h3>
<ol><li><strong>Pinecone Initialization:</strong> The script initializes the Pinecone client with the provided API key and sets up configurations for both the source and target Pinecone indexes.</li><li><strong>Function to Retrieve IDs from Index:</strong> The <code>get_all_ids_from_index</code> function fetches all vector IDs from the source Pinecone index. It iterates through each namespace in the index, querying for vector IDs until all vectors are collected.</li><li><strong>Function to Query IDs:</strong> The <code>get_ids_from_query</code> function queries the source index for vector IDs using an input vector and namespace.</li><li><strong>Vector Migration Function:</strong> The <code>migrate_vectors</code> function orchestrates the migration process. It first fetches all vector IDs from the source index using <code>get_all_ids_from_index</code>. Then, it iterates through each namespace and migrates vectors in batches. For each batch, it fetches vector data from the source index, prepares the data for upserting, and upserts it into the target index</li></ol>
<h3 id></h3>
<h3 id="potential-use-cases-for-the-script">Potential Use-Cases for the Script:</h3>
<ol><li><strong>Migration to Serverless Indexes</strong>: Organizations transitioning to Pinecone&apos;s serverless indexes can utilize this script to seamlessly migrate their vector data from traditional indexes to serverless ones. By doing so, they can take advantage of improved scalability and cost-effectiveness offered by serverless infrastructure.</li><li><strong>Index Optimization</strong>: Over time, as data evolves and usage patterns change, it may become necessary to optimize Pinecone indexes for better performance. This script can aid in the process of restructuring indexes, redistributing data, and optimizing storage to enhance query performance and resource utilization.</li><li><strong>Backup and Redundancy</strong>: Maintaining backups and redundant copies of vector data is crucial for ensuring data resilience and disaster recovery preparedness. With this script, organizations can automate the process of creating backups by regularly migrating data to secondary Pinecone indexes located in different regions or environments.</li><li><strong>Data Archiving</strong>: For regulatory compliance or historical analysis purposes, organizations may need to archive vector data while retaining the ability to access it when necessary. This script can facilitate the archival process by transferring data from active indexes to dedicated archival indexes, where it can be stored securely for long-term retention.</li><li><strong>Performance Testing</strong>: Prior to deploying changes or updates to production environments, it&apos;s essential to conduct performance testing using realistic data scenarios. This script enables the creation of test environments by migrating subsets of production data to dedicated testing indexes, allowing for comprehensive performance evaluation without impacting production systems.</li></ol>
<p>By leveraging this script in various scenarios, organizations can streamline their data management processes, optimize resource utilization, and ensure the reliability and availability of their vector data within the Pinecone ecosystem.</p>
<p><em>Note: Always ensure that you have the necessary permissions and backups before performing data migrations. It&#x2019;s also recommended to test the script in a development environment before using it in production.</em></p>
<p>Explore more about Pinecone and its features at <a href="https://www.pinecone.io/blog/?ref=engineering.navatech.ai">Pinecone&#x2019;s Blog</a> and our <a href="http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/">blog</a> on how we leverage pinecone to build next gen agents for construction health and safety.</p>
<hr>
<p></p>
<p><strong>Join Our Team of Innovators!</strong></p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png" class="kg-image" alt="Data Migration Across Pinecone Indexes: A Stepwise Guide" loading="lazy" width="1792" height="672" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1600w, http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1792w" sizes="(min-width: 720px) 720px"></figure>
<p><strong>Join Our Team of Innovators!</strong></p>
<p>Are you a passionate developer seeking exciting opportunities to shape the future of technology? We&apos;re looking for talented individuals to join our dynamic team at Navatech Group. If you&apos;re eager to be part of groundbreaking projects and make a real impact, we want to hear from you!</p>
<p>Send your resume to <a href="http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/">careers@navatechgroup.com</a> and take the first step toward a rewarding career with us. Join Navatech Group today and be at the forefront of innovation!</p>
<p></p>]]></content:encoded></item><item><title><![CDATA[Scaling LLM inference with Ray and vLLM]]></title><description><![CDATA[<p>Large Language Models (LLM) are becoming increasingly popular in many AI applications. These powerful language models are widely used to automate a series of tasks, improve customer service, and generate domain-specific content among many other usecases. At Navatech, LLM&apos;s are core of our conversational health and safety platform,</p>]]></description><link>http://engineering.navatech.ai/scaling-llm-inference-with-kubernetes-and-ray/</link><guid isPermaLink="false">658a63ed49e469a789311090</guid><category><![CDATA[ml]]></category><category><![CDATA[conversational agent]]></category><category><![CDATA[lambda]]></category><category><![CDATA[langchain]]></category><category><![CDATA[llm]]></category><category><![CDATA[tii]]></category><category><![CDATA[falcon]]></category><dc:creator><![CDATA[Joinal Ahmed]]></dc:creator><pubDate>Mon, 15 Jan 2024 09:37:18 GMT</pubDate><content:encoded><![CDATA[<p>Large Language Models (LLM) are becoming increasingly popular in many AI applications. These powerful language models are widely used to automate a series of tasks, improve customer service, and generate domain-specific content among many other usecases. At Navatech, LLM&apos;s are core of our conversational health and safety platform, powering various agents providing in-context health and safety information to our users and delivering the right content.</p>
<p>However, serving these fine-tuned LLMs at scale comes with challenges. Those models are computationally consuming. Their sizes are much larger than the traditional microservices, making it hard to archive high throughput serving and low cold start scaling.</p>
<figure class="kg-card kg-image-card"><img src="https://miro.medium.com/v2/resize:fit:1400/1*d7OxX8vQ5XvfToMohqQNJw.png" class="kg-image" alt loading="lazy"></figure>
<h3 id="continuous-batching-to-rescue">Continuous Batching to Rescue</h3>
<p>Due to the large GPU memory footprint and compute cost of serving LLMs, ML engineers often treat LLMs like &quot;black boxes&quot; that can only be optimized with internal changes such as quantization and custom CUDA kernels. However, this is not entirely the case. Because LLMs iteratively generate their output, and because LLM inference is often memory and not compute bound, there are <strong><em>system-level</em> </strong>batching optimizations that make 8-10x or more differences in real-world workloads.</p>
<p>One recent such proposed and widely used optimization technique is <a href="https://www.usenix.org/conference/osdi22/presentation/yu?ref=engineering.navatech.ai"><strong>continuous batching</strong></a>, also known as <strong>dynamic batching</strong>, or batching with <strong>iteration-level scheduling</strong>. We experimented to see the performance optimization it brings in at a production workload. We will get into details below, including how we simulate a production workload, but to summarize our findings:</p>
<ul><ul><li>Up to 23x throughput improvement using continuous batching and continuous batching-specific memory optimizations (using <a href="https://twitter.com/zhuohan123/status/1671234707206590464?s=20&amp;ref=engineering.navatech.ai"><u>vLLM</u></a>).</li><li>8x throughput over naive batching by using continuous batching (both on <a href="https://docs.ray.io/en/latest/serve/index.html?ref=engineering.navatech.ai"><u>Ray Serve</u></a> and <a href="https://github.com/huggingface/text-generation-inference?ref=engineering.navatech.ai"><u>Hugging Face&#x2019;s text-generation-inference</u></a>).</li><li>4x throughput over naive batching by using an optimized model implementation (<a href="https://github.com/NVIDIA/FasterTransformer?ref=engineering.navatech.ai"><u>NVIDIA&#x2019;s FasterTransformer</u></a>).</li></ul></ul>
<p>GPUs are massively-parallel compute architectures, with compute rates (measured in floating-point operations per second, or flops) in the teraflop (<a href="https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/a100/pdf/nvidia-a100-datasheet.pdf?ref=engineering.navatech.ai"><u>A100</u></a>) or even petaflop (<a href="https://resources.nvidia.com/en-us-tensor-core/nvidia-tensor-core-gpu-datasheet?ref=engineering.navatech.ai"><u>H100</u></a>) range. Despite these staggering amounts of compute, LLMs struggle to achieve saturation because so much of the chip&#x2019;s memory bandwidth is spent loading model parameters. Batching is one way to improve the situation; instead of loading new model parameters each time you have an input sequence, you can load the model parameters once and then use them to process many input sequences. This more efficiently uses the chip&#x2019;s memory bandwidth, leading to higher compute utilization, higher throughput, and cheaper LLM inference.</p>
<p>The industry recognized the inefficiency and came up with a better approach. <a href="https://www.usenix.org/conference/osdi22/presentation/yu?ref=engineering.navatech.ai"><em><u>Orca: A Distributed Serving System for Transformer-Based Generative Models</u></em></a> is a paper presented in OSDI &#x2018;22  tackles this problem. Instead of waiting until every sequence in a batch has completed generation, Orca implements <em>iteration-level</em> scheduling where the batch size is determined per iteration. The result is that once a sequence in a batch has completed generation, a new sequence can be inserted in its place, yielding <strong>higher GPU utilization than static batching</strong>.</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://images.ctfassets.net/xjan103pcp94/744TAv4dJIQqeHcEaz5lko/b823cc2d92bbb0d82eb252901e1dce6d/cb_03_diagram-continuous-batching.png" class="kg-image" alt="cb 03 diagram-continuous-batching" loading="lazy" title="cb 03 diagram-continuous-batching" width="3842" height="874"><figcaption><span>Completing seven sequences using continuous batching. Left shows the batch after a single iteration, right shows the batch after several iterations. Once a sequence emits an end-of-sequence token, we insert a new sequence in its place (i.e. sequences S5, S6, and S7). This achieves higher GPU utilization since the GPU does not wait for all sequences to complete before starting a new one.</span></figcaption></figure>
<p>Reality is a bit more complicated than this simplified model: since the prefill phase takes compute and has a different computational pattern than generation, it cannot be easily batched with the generation of tokens. Continuous batching frameworks currently manage this via hyperparameter: <a href="https://github.com/huggingface/text-generation-inference/blob/f59fb8b630844c2ad2cd80e689202de89d45c37e/launcher/src/main.rs?ref=engineering.navatech.ai#L124-L135"><u>waiting_served_ratio</u></a>, or the ratio of requests waiting for prefill to those waiting end-of-sequence tokens.</p>
<h2 id="pagedattention-and-vllm">PagedAttention and vLLM</h2>
<p>PagedAttention is a new attention mechanism implemented in <a href="https://vllm.ai/?ref=engineering.navatech.ai"><u>vLLM</u></a> (<a href="https://github.com/vllm-project/vllm/tree/main?ref=engineering.navatech.ai#easy-fast-and-cheap-llm-serving-for-everyone"><u>GitHub</u></a>). It takes inspiration from traditional OS concepts such as <a href="https://en.wikipedia.org/wiki/Memory_paging?ref=engineering.navatech.ai"><u>paging</u></a> and <a href="https://en.wikipedia.org/wiki/Virtual_memory?ref=engineering.navatech.ai"><u>virtual memory</u></a>. They allow the KV cache (what is computed in the &#x201C;prefill&#x201D; phase, discussed above) to be non-contiguous by allocating memory in fixed-size &#x201C;pages&#x201D;, or blocks. The attention mechanism can then be rewritten to operate on block-aligned inputs, allowing attention to be performed on non-contiguous memory ranges.</p>
<p>This means that buffer allocation can happen just-in-time instead of ahead-of-time: when starting a new generation, the framework does not need to allocate a contiguous buffer of size <em>maximum_context_length</em>. Each iteration, the scheduler can decide if it needs more room for a particular generation, and allocate on the fly without any degradation to PagedAttention&#x2019;s performance. This doesn&#x2019;t guarantee perfect utilization of memory ( limited to under 4%, only in the last block), but it significantly improves upon wastage from ahead-of-time allocation schemes used widely by the industry today.</p>
<p>Altogether, <strong>PagedAttention + vLLM</strong> enable massive memory savings as most sequences will not consume the entire context window. These memory savings translate directly into a higher batch size, which means higher throughput and cheaper serving.</p>
<hr>
<h3 id="production-environment">Production Environment - </h3>
<p>We scaled the production setup we mentioned in our previous <a href="http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/">blog</a>, and deployed the Falcon LLM in a EKS cluster running ray-serve and vLLM moving away from a managed SageMaker Endpoint,</p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2024/01/image.png" class="kg-image" alt loading="lazy" width="2000" height="963" srcset="http://engineering.navatech.ai/content/images/size/w600/2024/01/image.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2024/01/image.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2024/01/image.png 1600w, http://engineering.navatech.ai/content/images/size/w2400/2024/01/image.png 2400w" sizes="(min-width: 720px) 720px"></figure>
<h3 id="benchmarking-results-throughput">Benchmarking results: Throughput</h3>
<p>Based on our understanding of static batching, we expect continuous batching to perform significantly better when there is higher <em>variance</em> in sequence lengths in each batch. To test this, we run a throughput benchmark four times for static and continious batching, configured our model to always emit a per-sequence generation length by ignoring the end-of-sequence token and configuring <em>max_tokens</em>. We then use a simple asyncio Python benchmarking script to submit HTTP requests to our model server. The benchmarking script submits all requests in burst fashion, so that the compute is saturated.</p>
<p>The results are as follows:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://images.ctfassets.net/xjan103pcp94/1Os82uuLDUkqP90Nlhp3vh/1e783aff1edb97cd25b5139d26083c1c/cb_07_throughput_table.png" class="kg-image" alt="cb 07 throughput table" loading="lazy" title="cb 07 throughput table" width="2655" height="791"><figcaption><span>Throughput in tokens per second of each framework as variance in sequence length increases.</span></figcaption></figure>
<p>What is most impressive here is vLLM. For each dataset, vLLM more than doubles performance compared to naive continuous batching. We have not analyzed what optimization contributes the most to vLLM performance the most, but we suspect vLLM&#x2019;s ability to reserve space dynamically instead of ahead-of-time allows vLLM to dramatically increase the batch size.</p>
<p>We plot these performance results relative to naive static batching:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://images.ctfassets.net/xjan103pcp94/46OIG2WmA2j0SBfcG5fdq7/3bcdebf8014730a1a592a18f023cfdcc/cb_08_throughput_graph.png" class="kg-image" alt="cb 08 throughput graph" loading="lazy" title="cb 08 throughput graph" width="2868" height="1418"><figcaption><span>Our throughput benchmark results presented as improvement multiples over naive static batching, log scale.</span></figcaption></figure>
<h3 id="benchmarking-results-latency">Benchmarking results: Latency</h3>
<p>Live-inference endpoints often face latency-throughput tradeoffs that must be optimized based on user needs. We benchmark latency on a realistic workload and measure how the CDF of latencies changes with each framework.</p>
<p>Similar to the throughput benchmark, we configure the model to always emit a specified amount of tokens specified per-request. We measure latencies at both QPS=1 and QPS=4 to see how the latency distribution changes as load changes.</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://images.ctfassets.net/xjan103pcp94/4ElanYNZRv3sUBL0459zWV/ce78b3daf7e05f1bb84dad61906f1663/cb_09_latency_table.png" class="kg-image" alt="cb 09 latency table" loading="lazy" title="cb 09 latency table" width="2821" height="793"><figcaption><span>Median generation request latency for each framework, under average load of 1 QPS and 4 QPS. Continuous batching systems improve median latency.</span></figcaption></figure>
<p>We see that while improving throughput, continuous batching systems also <em>improve</em> median latency. This is because continuous batching systems allow for new requests to be added to an existing batch if there is room, each iteration. But how about other percentiles? In fact, we find that they improve latency across all percentiles:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://images.ctfassets.net/xjan103pcp94/6zynLiX4AJVO23tRfQ1rnV/763589eb4a6418157f21a51e6e36abaf/cb_10_latency_cdf_qps_1.png" class="kg-image" alt="cb 10 latency cdf qps=1" loading="lazy" title="cb 10 latency cdf qps=1" width="4780" height="2287"><figcaption><span>Cumulative distribution function of generation request latencies for each framework with QPS=1. Static batchers and continuous batchers have distinct curve shapes caused by the presence of iteration-level batch scheduling in continuous batchers. All continuous batchers perform approximately equally under this load; FasterTransformers performs noticeably better than static batching on a naive model implementation.</span></figcaption></figure>
<p>The reason why continuous batching improves latency at all percentiles is the same as why it improves latency at p50: new requests can be added regardless of how far into generation other sequences in the batch are. However, like static batching, continuous batching is still limited by how much space is available on the GPU. As your serving system becomes saturated with requests, meaning a higher on-average batch size, there are less opportunities to inject new requests immediately when they are received. We can see this as we increase the average QPS to 4:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://images.ctfassets.net/xjan103pcp94/2az2DSpj3IujUOOu2i5WPp/5f7457205acae98fcd7fb3170e93b773/cb_11_latency_cdf_qps_4.png" class="kg-image" alt="cb 11 latency cdf qps=4" loading="lazy" title="cb 11 latency cdf qps=4" width="4785" height="2287"><figcaption><span>Cumulative distribution function of generation request latencies for each framework with QPS=4. Compared to QPS=1, FasterTransformer&#x2019;s distribution of latencies becomes more similar to static batching on a naive model. Both Ray Serve and text-generation-inference&#x2019;s continuous batching implementations perform similarly, but noticeably worse than vLLM.</span></figcaption></figure>
<p>Anecdotally, we observe that vLLM becomes saturated around QPS=8 with a throughput near 1900 token/s. To compare these numbers apples-to-apples to the other serving systems requires more experimentation; however we have shown that continuous batching significantly improves over static batching by 1) reducing latency by injecting new requests immediately when possible, and 2) enable advanced memory optimizations (in vLLM&#x2019;s case) that increase the QPS that the serving system can handle before becoming saturated.</p>
<h2 id="conclusion">Conclusion</h2>
<p>LLMs present some amazing capabilities, and we believe their impact is still mostly undiscovered. We have shared how a new serving technique, continuous batching, works and how it outperforms static batching. It improves throughput by wasting fewer opportunities to schedule new requests, and improves latency by being capable of immediately injecting new requests into the compute stream. We are excited to see what people can do with continuous batching, and where the industry goes from here.</p>
<hr>
<p><strong>Join Our Team of Innovators!</strong></p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png" class="kg-image" alt loading="lazy" width="1792" height="672" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1600w, http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1792w" sizes="(min-width: 720px) 720px"></figure>
<p>Are you a passionate developer seeking exciting opportunities to shape the future of technology? We&apos;re looking for talented individuals to join our dynamic ML/DS team at Navatech Group. If you&apos;re eager to be part of groundbreaking projects and make a real impact, we want to hear from you!</p>
<p>Send your resume to <a href="http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/">careers@navatechgroup.com</a> and take the first step toward a rewarding career with us. Join Navatech Group today and be at the forefront of innovation!</p>]]></content:encoded></item><item><title><![CDATA[Enhancing Health & Safety with TII Falcon and Pinecone powered conversational agents]]></title><description><![CDATA[Navatech uses Falcon LLM & Pinecone DB for real-time information, monitoring, training, and incident reporting across multiple industries and transforming health and safety. ]]></description><link>http://engineering.navatech.ai/building-conversational-bots-for-health-safety-with-pinecone-and-tii-falcon/</link><guid isPermaLink="false">64fee1f02dc67c0bbd91b62b</guid><category><![CDATA[ml]]></category><category><![CDATA[llm]]></category><category><![CDATA[falcon]]></category><category><![CDATA[tii]]></category><category><![CDATA[langchain]]></category><category><![CDATA[lambda]]></category><category><![CDATA[pinecone]]></category><category><![CDATA[conversational agent]]></category><dc:creator><![CDATA[Joinal Ahmed]]></dc:creator><pubDate>Mon, 11 Sep 2023 11:35:26 GMT</pubDate><media:content url="http://engineering.navatech.ai/content/images/2023/09/joy_banner_image_Building_Conversational_bots_for_Health__Safet_17e10224-797e-47e8-ab91-2a74bd35f6e2.png" medium="image"/><content:encoded><![CDATA[<img src="http://engineering.navatech.ai/content/images/2023/09/joy_banner_image_Building_Conversational_bots_for_Health__Safet_17e10224-797e-47e8-ab91-2a74bd35f6e2.png" alt="Enhancing Health &amp; Safety with TII Falcon and Pinecone powered conversational agents"><p>In our fast-paced world, technology continues to play an increasingly vital role in elevating health and safety standards across diverse industries. One of the most promising advancements in this arena is the emergence of conversational agents driven by artificial intelligence (AI). These agents offer real-time information, guidance, and support, making them indispensable tools for safeguarding health and safety in a wide array of environments. This blog post will delve into our approach to harnessing the power of TII&apos;s Falcon Large Language Model (LLM) and Pinecone Vector Database  to craft tailored conversational agents for health and safety applications.</p>
<p>Conversational agents, often known as chatbots or virtual assistants, have evolved significantly from their humble text-matching based origins to sophisticated AI-driven solutions capable of comprehending natural language and context and semantics. This evolution has unlocked a plethora of possibilities for enhancing health and safety measures in various sectors, including manufacturing, healthcare, and construction.</p>
<figure class="kg-card kg-image-card"><img src="http://engineering.navatech.ai/content/images/2023/09/joy_workers_using_ai_driven_applications_in_day_to_day_works_en_0b9d346d-6feb-42d3-8dd2-ede026c66d29.png" class="kg-image" alt="Enhancing Health &amp; Safety with TII Falcon and Pinecone powered conversational agents" loading="lazy" width="1024" height="1024" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/joy_workers_using_ai_driven_applications_in_day_to_day_works_en_0b9d346d-6feb-42d3-8dd2-ede026c66d29.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/joy_workers_using_ai_driven_applications_in_day_to_day_works_en_0b9d346d-6feb-42d3-8dd2-ede026c66d29.png 1000w, http://engineering.navatech.ai/content/images/2023/09/joy_workers_using_ai_driven_applications_in_day_to_day_works_en_0b9d346d-6feb-42d3-8dd2-ede026c66d29.png 1024w" sizes="(min-width: 720px) 720px"></figure>
<p>Let&apos;s explore the capabilities of TII Falcon and Pinecone before diving into the conversational agent development process.</p>
<p>The <a href="https://falconllm.tii.ae/?ref=engineering.navatech.ai">Technology Innovation Institute in Abu Dhabi</a> has introduced Falcon, a groundbreaking series of language models. The Falcon family comprises three base models: <strong>Falcon-180B, Falcon-40B and Falcon-7B</strong>. <a href="https://huggingface.co/blog/falcon-180b?ref=engineering.navatech.ai">Falcon-180B</a> sets a new state-of-the-art for open models. It is the largest openly available language model, with 180 billion parameters, and was trained on a massive 3.5 trillion tokens using TII&apos;s <a href="https://huggingface.co/datasets/tiiuae/falcon-refinedweb?ref=engineering.navatech.ai">RefinedWeb</a> dataset. <strong>The 180b parameter model currently leads the Open LLM Leaderboard</strong>, while the 7B model excels in its weight class. </p>
<p>Notably, Falcon-180B is an exceptional open source model, surpassing many closed-source counterparts in capabilities. This development presents significant opportunities for professionals, enthusiasts, and industries alike, paving the way for exciting applications. At Navatech, we&apos;ve chosen to harness this locally developed Large Language Model (LLM) to construct conversational agents that deliver health and safety information to our users via mobile devices. We&apos;ve deployed the 7B model on our AWS tenant as an operational SageMaker Endpoint, serving as the backbone for our conversational agents.</p>
<p>Considering that the Falcon model isn&apos;t initially tailored to the Health and Safety domain, we&apos;ve taken the approach of creating an external knowledge base using <a href="https://www.pinecone.io/?ref=engineering.navatech.ai">Pinecone Vector DB</a>. Vector databases are uniquely designed to manage the intricate structure of vector embeddings&#x2014;dense numerical vectors representing text. These embeddings capture word meanings and semantic relationships, which are pivotal for machine learning applications. Pinecone indexes these vectors for efficient search and retrieval, making it an ideal tool for natural language processing and AI-driven applications.</p>
<p><strong>Why use Pinecone with Falcon LLM?</strong> : Pinecone can quickly search for similar data points in a database by representing data as vectors.This makes it ideal for a range of use cases, including semantic search, similarity search for images and audio, recommendation systems, record matching, anomaly detection, and more. We use Pinecone to build NLP systems that can understand the meaning of words and suggest similar text (documents) based on semantic similarity, and then the Falcon model uses these documents to give the relevant information to the user and sometimes rewrite the answer to suit the query.</p>
<hr>
<p><strong>Building an Conversational agent with LLMs and Vector Database :</strong></p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://engineering.navatech.ai/content/images/2023/09/Untitled-presentation.png" class="kg-image" alt="Enhancing Health &amp; Safety with TII Falcon and Pinecone powered conversational agents" loading="lazy" width="960" height="540" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/Untitled-presentation.png 600w, http://engineering.navatech.ai/content/images/2023/09/Untitled-presentation.png 960w" sizes="(min-width: 720px) 720px"><figcaption><span>LLM+Vector DB for building conversational agents</span></figcaption></figure>
<p><strong>In Stage 1</strong> of our process, we begin by <strong>ingesting knowledge base sources into the vector store</strong>. This involves a series of steps, starting with the meticulous reading of documents, which may be in the form of PDF files within the notebook. Subsequently, we break down these documents into smaller, more manageable chunks, ensuring that we include relevant sections that provide context to the prompts. The next crucial step is the generation of embeddings for each of these chunked documents. These embeddings, which are vector representations, capture the semantic meaning of the text and are essential for our system&apos;s understanding. Finally, we add these document embeddings to the vector store, ensuring accessibility for similarity searches and retrievals.</p>
<p><strong>In Stage 2,</strong> we pivot to <strong>user interaction with our model</strong>. This stage begins with the user providing a prompt or asking a question. We then generate a user prompt embedding, which helps in capturing the semantic essence of the user&apos;s input. Subsequently, our system searches the vector store, seeking the nearest embeddings representing documents closely related to the user&apos;s prompt. Upon retrieval, we extract the actual text from these embeddings, which serve as valuable contextual information and seamlessly integrate it with the user&apos;s prompt, enriching it. This enhanced user prompt is then dispatched to our Large Language Model (LLM). Lastly, the <strong>LLM processes the augmented prompt and furnishes a summarized response to the user, complete with references to the sources from our knowledge base, facilitating a comprehensive and informative interaction.</strong></p>
<p>Now that we&apos;ve got the hang of the two main pieces of our conversational agent, let&apos;s dive into how we put them together in the agent&apos;s architecture and see what they can really do in tandem.</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://engineering.navatech.ai/content/images/2023/09/Untitled-Diagram.drawio.png" class="kg-image" alt="Enhancing Health &amp; Safety with TII Falcon and Pinecone powered conversational agents" loading="lazy" width="1602" height="764" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/Untitled-Diagram.drawio.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/Untitled-Diagram.drawio.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2023/09/Untitled-Diagram.drawio.png 1600w, http://engineering.navatech.ai/content/images/2023/09/Untitled-Diagram.drawio.png 1602w" sizes="(min-width: 720px) 720px"><figcaption><span>HSE Conversational Agent architecture</span></figcaption></figure>
<p>In the diagram above, we&apos;ve encapsulated the conversational agent, constructed using <a href="https://www.langchain.com/?ref=engineering.navatech.ai">Langchain</a>, within a Lambda function. When a user submits a query, the Langchain component initiates a call to the Pinecone vector index to retrieve relevant documents. These documents are passed to the Falcon model hosted as a SageMaker endpoint to obtain an accurate response. Subsequently, the response is formatted according to the user&apos;s query and returned to the user. To facilitate seamless integration with our web and mobile applications, we&apos;ve exposed this Lambda function through an API Gateway.</p>
<h2 id="whats-next"><strong>Whats next ?</strong></h2>
<p>Our  roadmap includes a significant effort to refine and adapt Falcon, our conversational AI model, to excel in the domain of health and safety (HSE). This involves a comprehensive process of fine-tuning, where we meticulously train Falcon to provide not just information but highly accurate and contextually relevant guidance to our users. To achieve this, we&apos;re committed to encompassing a broad spectrum of Health, Safety, and Environment (HSE) guidelines sourced from regulatory and compliance agencies worldwide. These agencies represent diverse regions and industries with unique HSE standards and regulations. Our ultimate aim is to transform Falcon into a global repository of HSE knowledge, making it an invaluable resource for users regardless of their geographical location or industry focus. By doing so, we&apos;re not only ensuring precision but also promoting compliance with HSE regulations on a global scale. Our commitment is driven by a passion for enhancing safety and well-being across industries and borders.</p>
<hr>
<p><strong>Join Our Team of Innovators!</strong></p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png" class="kg-image" alt="Enhancing Health &amp; Safety with TII Falcon and Pinecone powered conversational agents" loading="lazy" width="1792" height="672" srcset="http://engineering.navatech.ai/content/images/size/w600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 600w, http://engineering.navatech.ai/content/images/size/w1000/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1000w, http://engineering.navatech.ai/content/images/size/w1600/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1600w, http://engineering.navatech.ai/content/images/2023/09/joy_developers_working_on_exciting_ai_projects_making_ground_br_ac23b477-e2ab-4b1c-87a7-9dc6c12d55f2.png 1792w" sizes="(min-width: 720px) 720px"><figcaption><b><strong>Join Our Team of Innovators!</strong></b></figcaption></figure>
<p>Are you a passionate developer seeking exciting opportunities to shape the future of technology? We&apos;re looking for talented individuals to join our dynamic team at Navatech Group. If you&apos;re eager to be part of groundbreaking projects and make a real impact, we want to hear from you!</p>
<p>Send your resume to <a href>careers@navatechgroup.com</a> and take the first step toward a rewarding career with us. Join Navatech Group today and be at the forefront of innovation!</p>]]></content:encoded></item></channel></rss>