<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nihal NM on Medium]]></title>
        <description><![CDATA[Stories by Nihal NM on Medium]]></description>
        <link>https://medium.com/@nihalmuthu?source=rss-662e738ceb75------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eh6Bx7NBaYenWJLl</url>
            <title>Stories by Nihal NM on Medium</title>
            <link>https://medium.com/@nihalmuthu?source=rss-662e738ceb75------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:57:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nihalmuthu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Quarkus + Ollama for Local AI Development]]></title>
            <link>https://medium.com/@nihalmuthu/using-quarkus-ollama-for-local-ai-development-5c869ce5f1b1?source=rss-662e738ceb75------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c869ce5f1b1</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[quarkus]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[ollama]]></category>
            <dc:creator><![CDATA[Nihal NM]]></dc:creator>
            <pubDate>Sun, 05 Jul 2026 19:19:44 GMT</pubDate>
            <atom:updated>2026-07-05T19:19:44.815Z</atom:updated>
            <content:encoded><![CDATA[<p>For a long time, getting started with AI felt difficult for Java developers. Most AI tools and frameworks were built for Python, and many applications depended on cloud services like OpenAI or Anthropic. This also meant sending application data to external APIs, which isn’t always ideal for enterprise applications.</p><p>Things are changing now. As a Java backend developer moving into AI, I’ve been working on bringing Python-based agentic applications to the Java ecosystem. During this journey, I found that some of the most exciting AI development can be done locally.</p><p>In this article, I’ll show you how to combine Quarkus and Ollama to build AI applications on your own machine. We’ll look at what local AI is, why it matters, and how to build a streaming AI API that is ready for real-world development.</p><h3>The Case for Local AI</h3><p>When we talk about <strong>local AI</strong>, we mean running Large Language Models (LLMs) directly on your own computer or server instead of using cloud services.</p><p>Models like GPT-4o are still excellent for complex reasoning tasks, but open-weight models such as Llama 3 and Qwen have become powerful enough for many real-world applications</p><p>For enterprise Java developers, local AI offers several advantages:</p><ul><li><strong>Better Privacy and Security:</strong> If your application works with sensitive information like source code, financial data, or personal information, keeping everything on your own infrastructure helps meet security and compliance requirements.</li><li><strong>Lower Latency:</strong> Since the model runs locally, there are no network delays, API rate limits, or downtime caused by external services.</li><li><strong>Lower Cost:</strong> There are no per-token API charges. Once your hardware is set up, you can run as many requests as you need.</li><li><strong>Work Offline:</strong> You can build and test AI applications, including RAG (Retrieval-Augmented Generation) pipelines, even without an internet connection. This is especially useful when traveling or working in secure environments.</li></ul><h3><strong>The Tech Stack: Ollama and Quarkus</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7U8X75WwQWiOQ_qHIQIYg.png" /></figure><h4>Why Ollama?</h4><p>You can think of <strong>Ollama</strong> as the Docker of Large Language Models (LLMs). Just as Docker makes it easy to download, run, and manage containers, Ollama makes it simple to download, manage, and run AI models on your own machine.</p><p>With a single command, you can pull a model, start it locally, and interact with it through a REST API or command-line interface. This makes it easy for developers to build, test, and experiment with AI applications without depending on external cloud services.</p><h4>Why Quarkus?</h4><p>If you’re building AI applications in Java, Quarkus is a great choice. With the LangChain4j extension, it becomes easy to integrate Large Language Models (LLMs) into your Java applications while keeping the code clean and production-ready.</p><p>Unlike many Python frameworks that are mainly used for rapid prototyping, Quarkus is designed for building enterprise applications. It provides the performance, reliability, and developer experience that Java developers expect.</p><p>Some of the key benefits include:</p><ul><li><strong>Streaming Responses:</strong> Easily stream AI responses token by token using Mutiny (Multi&lt;String&gt;), making applications feel faster and more interactive.</li><li><strong>Dev Services:</strong> During development, Quarkus can automatically start an Ollama container using Testcontainers if it doesn’t find one already running. This reduces setup time and lets you focus on development.</li><li><strong>Lightweight and Fast:</strong> Quarkus has a small memory footprint and supports native compilation with GraalVM, making AI services faster to start and more efficient to run.</li></ul><h4>Setting Up the Local Environment</h4><p>First, install Ollama from the official website. Once it’s installed, open a terminal and download a model such as <strong>Llama 3 8B</strong>. It’s a good balance between performance and resource usage, making it suitable for most modern laptops.</p><p>Run the following command:</p><pre>ollama run llama3</pre><p>After the download is complete, Ollama is ready to serve the model locally, and you can start building AI applications without relying on external cloud services.</p><p>This command downloads the model weights and exposes a local HTTP API (usually on port 11434).</p><h4>Implementation: Building a Streaming AI API</h4><p>Let’s build a clean Quarkus REST API that communicates with our local Llama 3 model.</p><ol><li><strong>Maven Dependencies</strong></li></ol><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.quarkiverse.langchain4j&lt;/groupId&gt;<br>    &lt;artifactId&gt;quarkus-langchain4j-ollama&lt;/artifactId&gt;<br>    &lt;version&gt;1.11.2&lt;/version&gt; &lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;io.quarkus&lt;/groupId&gt;<br>    &lt;artifactId&gt;quarkus-rest-jackson&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p><strong>2. Configuration</strong></p><p>Configure the connection in your application.properties. We explicitly set the model name and lower the temperature for more deterministic, professional responses.</p><pre># Connect to our local Ollama instance<br>quarkus.langchain4j.ollama.chat-model.model-id=llama3<br>quarkus.langchain4j.ollama.chat-model.temperature=0.1<br><br># Local inference can be slow depending on hardware; configure a realistic timeout<br>quarkus.langchain4j.timeout=60s<br><br># Enable Dev Services (Optional: automatically spins up Ollama in dev mode)<br>quarkus.langchain4j.ollama.devservices.model=llama3</pre><p><strong>3. Defining the AI Service</strong></p><p>Quarkus LangChain4j uses a declarative approach. We define an interface and let the framework generate the implementation.</p><p>Notice the return type: Multi&lt;String&gt;. Traditional AI calls block until the entire response is generated. By returning a Multi, we instruct Quarkus to stream the tokens as they arrive, dramatically reducing perceived latency for the end-user.</p><pre>package com.enterprise.ai;<br><br>import dev.langchain4j.service.SystemMessage;<br>import dev.langchain4j.service.UserMessage;<br>import io.quarkiverse.langchain4j.RegisterAiService;<br>import io.smallrye.mutiny.Multi;<br><br>@RegisterAiService<br>public interface LocalDeveloperAssistant {<br><br>    @SystemMessage(&quot;You are a senior Java engineer. Provide concise, clean, and well-architected solutions.&quot;)<br>    @UserMessage(&quot;Solve the following problem: {problem}&quot;)<br>    Multi&lt;String&gt; streamSolution(String problem);<br>}</pre><p><strong>4. The REST Resource</strong></p><p>Now, we expose this service via a reactive JAX-RS endpoint using Server-Sent Events (SSE).</p><pre>package com.enterprise.ai;<br><br>import jakarta.inject.Inject;<br>import jakarta.ws.rs.POST;<br>import jakarta.ws.rs.Path;<br>import jakarta.ws.rs.Produces;<br>import jakarta.ws.rs.core.MediaType;<br>import io.smallrye.mutiny.Multi;<br><br>@Path(&quot;/api/v1/assistant&quot;)<br>public class AssistantResource {<br><br>    @Inject<br>    LocalDeveloperAssistant assistant;<br><br>    @POST<br>    @Path(&quot;/stream&quot;)<br>    @Produces(MediaType.SERVER_SENT_EVENTS)<br>    public Multi&lt;String&gt; ask(String prompt) {<br>        return assistant.streamSolution(prompt);<br>    }<br>}</pre><p><strong>5. Testing the Request/Response Flow</strong></p><p>Start your Quarkus application in development mode (./mvnw quarkus:dev). Use curl to test the streaming endpoint. The -N flag disables buffering so you can see the text stream in real time.</p><pre>curl -N -X POST http://localhost:8080/api/v1/assistant/stream \<br>  -H &quot;Content-Type: text/plain&quot; \<br>  -d &quot;Write a thread-safe Singleton in Java.&quot;</pre><p>You will see the model’s response generated token-by-token directly in your terminal, entirely powered by your local hardware.</p><h4>Engineering Challenges &amp; Realities</h4><p>Running a local LLM and exposing it through an API is only the beginning. The real challenge is building AI applications that are reliable, scalable, and useful in real-world enterprise environments.</p><p>As Java continues to evolve in the AI space, the focus shifts from simply calling an LLM to building complete AI solutions. Some of the key areas include:</p><ul><li><strong>RAG (Retrieval-Augmented Generation):</strong> Connect your local model to a vector database such as PgVector or Milvus so it can answer questions using your organization’s documents and knowledge base.</li><li><strong>AI Agents and Tool Calling:</strong> Use Quarkus @Tool annotations to let the model invoke Java methods, query databases, call external APIs, or automate tasks as part of an AI workflow.</li><li><strong>Model Context Protocol (MCP):</strong> Build MCP servers with Quarkus so your AI applications can communicate with IDEs, developer tools, and other AI agents in a standard way.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rfe4djcvYnojtiR_7VlwUg.png" /></figure><h4>Lessons Learned &amp; Outlook</h4><p>Moving into AI engineering doesn’t mean leaving Java behind. In fact, Java’s strengths — such as type safety, reactive programming, and dependency injection — make it a solid choice for building reliable AI applications.</p><p>By combining Quarkus and Ollama, you can build AI services that run locally, keep your data private, and are ready for enterprise use. You can start with a simple AI endpoint, add streaming responses, and gradually move toward more advanced use cases like AI agents and RAG applications.</p><p>The tools are becoming easier to use, and getting started with AI in Java has never been more accessible. The rest is about applying good software engineering practices to build reliable, production-ready AI solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c869ce5f1b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Java Developers Should Learn AI]]></title>
            <link>https://medium.com/@nihalmuthu/why-java-developers-should-learn-ai-4504e0114733?source=rss-662e738ceb75------2</link>
            <guid isPermaLink="false">https://medium.com/p/4504e0114733</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[quarkus]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Nihal NM]]></dc:creator>
            <pubDate>Mon, 01 Jun 2026 14:40:31 GMT</pubDate>
            <atom:updated>2026-06-01T14:51:01.439Z</atom:updated>
            <content:encoded><![CDATA[<p>The Python monopoly is ending. Enterprise AI needs robust backend engineering, and Java is stepping up to the plate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ji0nirtEzgjwFJpgGv0GCg.png" /></figure><p>For the past decade, the artificial intelligence landscape has been dominated by a single programming language: Python. If you wanted to build anything resembling machine learning, train a neural network, or deploy a foundational model, Python was the undeniable, undisputed king. Data scientists lived in Jupyter Notebooks, ML engineers relied heavily on PyTorch and TensorFlow, and the entire ecosystem was meticulously optimized around Python’s data-handling capabilities.</p><p>Because of this, a pervasive myth took root in the software engineering community: <em>AI is exclusively for Python developers</em>. As a Java backend engineer, you might have looked at the explosion of Generative AI and Large Language Models (LLMs) over the past two years and assumed you needed to pivot your entire career, abandon the JVM, and master Python to remain relevant.</p><p>That assumption is fundamentally wrong. The era of AI being purely a data science experiment is over. We have entered the era of <strong>Enterprise AI Engineering</strong>. Models are no longer isolated mathematical experiments; they are core infrastructural components of vast, highly distributed enterprise systems.</p><p>As organizations rush to integrate LLMs, vector search, and autonomous agents into their core business applications, they are discovering a critical truth: integrating AI into production is a backend engineering problem. And no one solves backend enterprise problems better than Java developers.</p><h3>The Myth of the Python Monopoly</h3><p>Let’s clarify a crucial distinction. If your goal is to design novel neural network architectures, train foundational models from scratch using petabytes of data, or write low-level CUDA kernels, you absolutely need Python. The data science and model training ecosystem is irrevocably tethered to it.</p><p>However, 99% of modern enterprises are not training foundational models. They are <em>consuming</em> them.</p><p>Enterprise AI involves taking an existing model (like GPT-4, Claude 3, or a locally hosted Llama 3) and wrapping it in business logic. It involves Retrieval-Augmented Generation (RAG), orchestrating multi-agent systems, managing conversational memory, integrating with external APIs, and executing database transactions based on AI output.</p><blockquote><em>“Integrating an LLM into an enterprise application is fundamentally just orchestrating a very slow, highly non-deterministic, third-party API.”</em></blockquote><p>When you view an LLM as a non-deterministic API, the challenges stop being mathematical and start being architectural. Python, while brilliant for data manipulation, struggles natively with the rigors of high-concurrency, strongly-typed, deeply resilient enterprise architectures. A Python script that works perfectly for a quick Proof of Concept (PoC) often crumbles when subjected to the demands of a production environment requiring strict memory management, high throughput, and seamless integration with legacy enterprise systems.</p><p>This is exactly where Java shines. The JVM was built for this.</p><h3>Why Production AI Requires Backend Engineering Skills</h3><p>Building a RAG pipeline in a notebook takes twenty lines of code. Running that same pipeline in production for ten thousand concurrent users requires serious engineering. Consider the actual challenges of modern AI systems:</p><h3>1. Distributed Systems and Resilience</h3><p>LLM APIs fail. They rate-limit you. They take 30 seconds to respond. As a backend developer, you already know how to handle this. You implement circuit breakers, bulkheads, and retry logic with exponential backoff. You understand asynchronous non-blocking I/O. When an LLM fails to generate a response, your application shouldn’t crash; it should fall back gracefully. Tools like Resilience4j are critical here.</p><h3>2. Observability and Telemetry</h3><p>When an AI agent takes five steps to answer a user’s question — querying a database, calling a weather API, searching a vector store, and finally generating text — how do you debug a failure? You need distributed tracing. Java developers are intimately familiar with OpenTelemetry, Micrometer, and structured logging. Injecting trace IDs across a complex LangChain4j agent workflow is second nature to a Spring or Quarkus developer.</p><h3>3. Security and Data Governance</h3><p>Enterprises cannot simply pipe raw user input into an LLM, nor can they blindly execute SQL queries generated by an AI. PII (Personally Identifiable Information) must be masked. Inputs must be sanitized. Rate limiting must be enforced per tenant. Java’s robust security frameworks (like Spring Security) provide the perfect scaffolding to govern AI interactions safely.</p><h3>4. Streaming and Concurrency</h3><p>Users expect text to stream into their UI instantly, character by character, just like ChatGPT. Implementing Server-Sent Events (SSE) or WebSockets to stream tokens from an LLM while simultaneously processing asynchronous database calls is complex. Java’s Project Loom (Virtual Threads) and reactive frameworks (Mutiny, Project Reactor) make handling massive amounts of concurrent, I/O-bound LLM streams highly efficient without choking the thread pool.</p><h3>The Modern Java AI Ecosystem</h3><p>The Java ecosystem hasn’t been sitting idle. Over the last eighteen months, a powerful suite of AI-native frameworks has emerged, bringing the power of modern AI engineering directly to the JVM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9EsI1LVZ9AwEok-XMAOEg.png" /></figure><h3>Quarkus</h3><p>Quarkus — the “Supersonic Subatomic Java” framework — has aggressively embraced AI. Because Quarkus can compile Java directly to native binaries using GraalVM, it solves the traditional “heavy JVM” problem. You can build AI agents that start up in milliseconds and consume minimal memory, making them perfect for serverless AI deployments or Kubernetes-native microservices.</p><h3>LangChain4j</h3><p>If you’ve heard of Python’s LangChain, LangChain4j is the Java equivalent — but arguably better designed. Because Java is strongly typed, LangChain4j forces a level of architectural discipline that prevents the sprawling “spaghetti code” often seen in Python AI scripts. It provides elegant interfaces for LLM providers (OpenAI, Anthropic, Gemini, local Ollama), embedding models, vector stores, and tool execution.</p><h3>Spring AI</h3><p>For the massive enterprise footprint already running Spring Boot, Spring AI is a game-changer. It applies the familiar Spring design principles (dependency injection, portable service abstractions, starter dependencies) to AI. You can swap out an OpenAI model for a local Ollama model simply by changing an application.properties value, completely decoupling your business logic from the underlying AI provider.</p><h3>Ollama and Local AI</h3><p>Privacy is the biggest hurdle for Enterprise AI. Companies don’t want to send proprietary data to OpenAI. Ollama allows developers to run powerful open-weights models (like Llama 3, Mistral, or Gemma) locally. The Java frameworks integrate seamlessly with Ollama via Testcontainers, allowing Java devs to spin up local LLMs during their integration tests, ensuring fully reproducible, zero-cost CI/CD pipelines.</p><h3>Vector Databases</h3><p>RAG architecture relies on semantic search, which requires Vector Databases. The Java ecosystem has robust clients for modern vector stores like Milvus, Qdrant, Weaviate, and pgvector (PostgreSQL). Integrating a vector search into an existing Hibernate/JPA application is now a streamlined process.</p><h3>A Personal Perspective: Moving from Python to Java AI</h3><p>Over the last year, my role transitioned from traditional Spring Boot microservices into AI systems engineering. My first instinct was to follow the crowd: I learned Python, spun up FastAPI, and started building AI agents using LangChain and LlamaIndex.</p><p>For a week, it felt like magic. But as the system grew into an enterprise application, the cracks began to show. Managing complex state transitions in Python became difficult. Refactoring a multi-agent system built on loosely defined dictionaries was terrifying. Integrating our existing Kafka event streams and enterprise Postgres databases felt clunky and fragile compared to what I was used to.</p><p>When I made the decision to rebuild the entire AI agent architecture in Java using Quarkus and LangChain4j, everything clicked back into place. The strong typing eliminated entire classes of runtime errors that had plagued our Python deployment. Implementing complex RAG workflows felt architectural rather than script-like. When we needed to integrate our AI agents with our legacy enterprise services, we simply used our existing, battle-tested Java clients.</p><p>The realization was profound: <strong>Building the AI agent was only 10% of the project. The other 90% was security, observability, data integration, state management, and API design.</strong> I was vastly more productive leveraging my decade of Java backend experience than trying to reinvent enterprise patterns in a new language.</p><h3>The Future: The Model Context Protocol (MCP)</h3><p>Looking forward, the integration of AI into enterprise systems is becoming standardized. The Model Context Protocol (MCP) is an emerging standard that allows AI models to securely access external data sources and tools. As MCP gains traction, Java’s role will only grow.</p><p>Enterprises will need thousands of MCP servers built to expose their internal APIs, databases, and file systems to AI assistants securely. Building a high-performance, secure, role-based MCP server that connects to a legacy Oracle database or a modern microservice mesh is exactly the kind of task Java developers excel at.</p><h3>Conclusion: Embrace the AI Era</h3><p>The narrative that AI is a walled garden reserved for Python developers and data scientists is demonstrably false. As AI transitions from research labs to mission-critical enterprise production, the industry is experiencing a massive deficit of engineers who know how to build reliable, scalable, and secure distributed systems.</p><p>As a Java developer, you possess the exact skill set required to solve the hardest problems in AI engineering today. You understand enterprise architecture. You understand how to handle API failures. You understand database transactions, message queues, and cloud-native deployments.</p><p>You don’t need to learn how to write a backpropagation algorithm to be an AI engineer. You need to learn how to orchestrate intelligent models within robust enterprise architectures. The tools are here. Quarkus, Spring AI, and LangChain4j have leveled the playing field. It is time for Java developers to step up and build the next generation of intelligent backend systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4504e0114733" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is a Vector Database? Powering Semantic Search & AI Applications]]></title>
            <link>https://medium.com/@nihalmuthu/what-is-a-vector-database-powering-semantic-search-ai-applications-964007b044b3?source=rss-662e738ceb75------2</link>
            <guid isPermaLink="false">https://medium.com/p/964007b044b3</guid>
            <category><![CDATA[embedding]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[semantic-search]]></category>
            <dc:creator><![CDATA[Nihal NM]]></dc:creator>
            <pubDate>Mon, 29 Sep 2025 07:34:09 GMT</pubDate>
            <atom:updated>2025-09-29T07:34:09.403Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Unlocking the Power of Vector Databases: Bridging Meaning &amp; Machines</strong></h4><p>Imagine wanting to find images that “feel like” a sunset, or retrieving documents that capture a concept rather than matching exact words. Traditional keyword-based search often falls short in interpreting meaning. This is where <strong>vector databases</strong> come in — they help machines understand and retrieve information by meaning, not just by matching terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zvv9fqcEtBth7cST2EFYrg.png" /></figure><p>Let’s break down the main ideas, how they work, and why they’re becoming essential for modern AI systems.</p><h3>The Problem: The Semantic Gap</h3><p>Conventional databases and search engines are excellent when data is structured (e.g. rows, columns) or when queries require exact matches. But when you deal with <strong>unstructured data</strong> — images, free-form text, audio — they struggle to interpret meaning.</p><p><strong>For instance:</strong></p><ul><li>A search for “warm evening sky” might not find an image with those keywords, but visually it <em>is</em> a sunset.</li><li>A question like <em>“Which books discuss moral ambiguity?”</em> might not match on simple keywords but do share deeper themes.</li></ul><p>This disconnect between human semantics and machine matching is called the <strong>semantic gap</strong>.</p><p>Vector databases aim to close that gap by converting data into a representation that machines can reason on — <strong>vector embeddings</strong>.</p><h3>What Are Vector Embeddings?</h3><p>A <em>vector embedding</em> is a mathematical representation of data (text, image, audio, etc.) in a high-dimensional space. Each item becomes a vector: a list of numbers such that similar items lie “close” to each other.</p><h4><strong>Key ideas:</strong></h4><ul><li>Semantically related objects (e.g. “dog” and “wolf”) result in embeddings that are near each other in vector space.</li><li>Dissimilar ones (e.g. “dog” and “car”) are farther apart.</li><li>Embedding models (like CLIP for images+text, BERT or sentence embeddings for text, etc.) create these vector representations.</li></ul><p>Because of how they’re constructed, embeddings enable <strong>similarity-based queries</strong>: you can ask <em>“find items whose embeddings are closest to this query embedding.”</em></p><h3>How a Vector Database Works</h3><p>Here’s a simplified pipeline for how vector databases operate:</p><ol><li><strong>Embedding generation</strong><br> Raw data (text, image, etc.) is passed through a model to generate an embedding vector.</li><li><strong>Storage &amp; indexing</strong><br> These embeddings are stored in the vector DB. Alongside, metadata (such as IDs, timestamps, categories) can also be stored.</li><li><strong>Querying / similarity search</strong><br> When you query (in text or any modality), you generate an embedding for the query, then ask the DB: <em>which stored embeddings are nearest to this query embedding?</em></li><li><strong>Filtering &amp; ranking</strong><br> The DB returns the closest ones (often using Approximate Nearest Neighbor algorithms). Optionally, results can be filtered using metadata (e.g. “only from category X”) or re-ranked.</li><li><strong>Produce final output</strong><br> The retrieved items are surfaced (images, documents, responses) as the result of the query.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*64b47fcovDN2xzaUEcJZYw.png" /></figure><h3>Key Enablers: Speed &amp; Scale</h3><p>To make similarity search fast and scalable (even across millions or billions of vectors), vector databases rely on specialized index structures and algorithms:</p><ul><li><strong>Approximate Nearest Neighbor (ANN)</strong> algorithms: allow fast retrieval with slight approximations.</li><li>Indexing structures like <strong>HNSW (Hierarchical Navigable Small World graphs)</strong> or <strong>IVF (Inverted File systems)</strong> help navigate vector space efficiently.</li><li><strong>Hybrid search</strong>: combining vector similarity and keyword/lexical filtering to get precision + semantic power.</li></ul><p>Because of these techniques, vector databases can support <strong>low-latency queries</strong> even at large scale — a must for real-time AI systems.</p><h3>Use Cases &amp; Applications</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiNbqCLwIc1tBco0Af9kgg.png" /></figure><p>Here are a few compelling applications for vector databases:</p><h4>1. Semantic Search</h4><p>Instead of matching exact terms, the system finds results that are conceptually similar. E.g. “healthy diet” returns articles about nutrition, balanced meals, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QVSPLSUzekXcBOVK_nylPg.png" /></figure><h4>2. Retrieval-Augmented Generation (RAG)</h4><p>In systems combining LLMs (language models) with knowledge bases, vector DBs store embeddings of documents. When the model needs factual context, it retrieves relevant docs based on semantic similarity and feeds them into generation.</p><h4>3. Recommendation &amp; Similarity Engines</h4><p>E-commerce, content platforms, image apps can recommend products, articles or visuals “like” the ones a user viewed, based on embedding proximity.</p><h4>4. Anomaly Detection &amp; Clustering</h4><p>By identifying items that lie far away from typical embedding clusters, anomalies or outliers can be flagged. Also useful for grouping related items.</p><h3>Strengths &amp; Tradeoffs</h3><h4><strong>Advantages :</strong></h4><ul><li>Understand and operate on meaning, not just keywords</li><li>Fast similarity search at scale</li><li>Flexibility to mix modalities (text, image, audio)</li><li>Supports filtering via metadata + semantic ranking</li></ul><h4><strong>Challenges / Tradeoffs :</strong></h4><ul><li>Approximate results may sacrifice perfect accuracy</li><li>Embedding models may carry biases or limitations</li><li>Freshness / updating index with new vectors can be complex</li><li>Storage &amp; compute costs for high-dimensional spaces</li><li>Choice of similarity metric (cosine, Euclidean, dot product) matters</li></ul><h3>The Future &amp; Beyond</h3><p>As AI systems grow more sophisticated, vector databases are becoming <strong>core infrastructure</strong>, not just auxiliary tools. They’re evolving to support:</p><ul><li><strong>Serverless architectures</strong> (compute/storage decoupled, scaling automatically)</li><li><strong>Hybrid search</strong> combining vector and lexical search</li><li><strong>Graph + vector integration</strong> (blending relational, graph, and embedding representations)</li><li>More efficient, domain-specific embedding models and indexing strategies</li></ul><h3>Conclusion</h3><p>Vector databases represent a powerful shift in how machines “understand” data. Instead of relying purely on string matches, they leverage embeddings to capture semantic meaning, enabling richer, more intuitive search and retrieval. As AI applications become more advanced, vector DBs are emerging as essential plumbing: fueling semantic search, grounding language models, driving recommendations, and much more.</p><h3>Key Takeaway</h3><p>A vector database lets machines “think” more like humans — retrieving information by meaning rather than by exact words.<br> That’s why they’re powering everything from smart assistants to next-gen search engines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=964007b044b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From SQL to Vectors: Transforming Traditional Databases into AI-Ready Systems with Milvus]]></title>
            <link>https://medium.com/@nihalmuthu/from-sql-to-vectors-transforming-traditional-databases-into-ai-ready-systems-with-milvus-81a54fb35a68?source=rss-662e738ceb75------2</link>
            <guid isPermaLink="false">https://medium.com/p/81a54fb35a68</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[vector-embeddings]]></category>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Nihal NM]]></dc:creator>
            <pubDate>Tue, 02 Sep 2025 16:31:51 GMT</pubDate>
            <atom:updated>2025-09-02T16:52:12.884Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_39-LgpFlIOFZykC8A8Hdw.png" /></figure><p>For decades, <strong>SQL databases</strong> like MySQL, PostgreSQL, and Oracle have been the backbone of digital systems. They’re fast, reliable, and perfect for storing structured data: customers, products, transactions, and reports.</p><p>But the way we use data has changed.</p><p>Modern applications don’t just <em>store and retrieve</em> — they need to <strong>understand</strong>.</p><ul><li>Search engines should return results that match <strong>intent</strong>, not just keywords.</li><li>E-commerce platforms should recommend items that feel <strong>relevant</strong>, not just share a category.</li><li>Media apps should retrieve <strong>images, videos, or audio</strong> that look or sound alike, even if descriptions are missing.</li></ul><p>This is where <strong>embeddings</strong> come in.</p><p>An embedding is a vector — a list of numbers — that represents the <em>meaning</em> of data. For example:</p><ul><li>&quot;red running shoes&quot; → [0.12, -0.34, 0.88, …]</li><li>&quot;wireless headphones&quot; → [0.45, 0.01, -0.22, …]</li></ul><p>And to store and query billions of these vectors efficiently, we need something beyond SQL: a <strong>vector database</strong>.</p><p>One of the most popular open-source solutions is <strong>Milvus</strong>, designed specifically for AI and similarity search.</p><p>In this article, we’ll walk step by step through how to <strong>transform a SQL-based setup into a hybrid SQL + Milvus system</strong>. By the end, you’ll see how to turn a plain old relational database into an <strong>AI-powered search engine</strong>.</p><h3>SQL vs. Vector Databases</h3><p><strong>SQL Database</strong></p><ul><li>Stores structured data in rows and columns</li><li>Great for filtering, aggregations, and transactions</li></ul><p>Example query:</p><pre>SELECT * FROM products WHERE price &gt; 500;</pre><p><strong>Vector Database (Milvus)</strong></p><ul><li>Stores embeddings (vectors of floats that represent meaning)</li><li>Optimized for <strong>similarity search</strong> — “find items most like this one”</li></ul><p>Example query:</p><pre>collection.search(query_vector, &quot;embedding&quot;, limit=3)</pre><h3><strong>Architecture difference (simplified)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxGHaV3d0PNDASOo9WJUNA.png" /></figure><p>Together, they make a powerful pair:</p><ul><li>SQL holds your structured metadata</li><li>Milvus powers semantic, AI-driven search</li></ul><h4>Step 1: Start with Your SQL Table</h4><p>Let’s imagine a simple product catalog in MySQL:</p><pre>CREATE TABLE products (<br>    id INT PRIMARY KEY,<br>    name VARCHAR(255),<br>    description TEXT,<br>    price DECIMAL(10,2)<br>);</pre><h4>Step 2: Generate Embeddings</h4><p>Next, we’ll use a pre-trained NLP model to convert product descriptions into embeddings.</p><pre>from sentence_transformers import SentenceTransformer<br><br>model = SentenceTransformer(&#39;all-MiniLM-L6-v2&#39;)<br><br>descriptions = [<br>    &quot;Red running shoes&quot;,<br>    &quot;Wireless noise-canceling headphones&quot;<br>]<br><br>embeddings = model.encode(descriptions)<br>print(embeddings.shape)  # (2, 384)</pre><h4>Step 3: Create a Milvus Collection</h4><p>We’ll create a collection in Milvus to store these embeddings, linked to product IDs.</p><pre>from pymilvus import connections, FieldSchema, CollectionSchema, DataType, Collection<br><br>connections.connect(&quot;default&quot;, host=&quot;localhost&quot;, port=&quot;19530&quot;)<br><br>fields = [<br>    FieldSchema(name=&quot;id&quot;, dtype=DataType.INT64, is_primary=True),<br>    FieldSchema(name=&quot;embedding&quot;, dtype=DataType.FLOAT_VECTOR, dim=384)<br>]<br>schema = CollectionSchema(fields, &quot;Product embeddings collection&quot;)<br><br>collection = Collection(&quot;product_embeddings&quot;, schema)</pre><h4>Step 4: Insert Data</h4><p>Now we insert both the product IDs and their embeddings:</p><pre>data = [<br>    [1, 2],                  # product IDs<br>    embeddings.tolist()      # vector embeddings<br>]<br>collection.insert(data)</pre><h4>Step 5: Query by Meaning</h4><p>Suppose a user searches for “lightweight sneakers.” Instead of keyword matching, we’ll search semantically:</p><pre>query_vector = model.encode([&quot;lightweight sneakers&quot;]).tolist()<br><br>results = collection.search(<br>    query_vector,<br>    &quot;embedding&quot;,<br>    param={&quot;nprobe&quot;: 10},<br>    limit=3<br>)<br><br>for r in results[0]:<br>    print(f&quot;Similar product ID: {r.id}, Score: {r.distance}&quot;)</pre><p>This returns <strong>the most similar products</strong> based on meaning, not exact text.<br> Then, we fetch details (name, price) from MySQL using those product IDs.</p><h4>Best Practices</h4><ul><li><strong>Don’t replace SQL entirely.</strong> Use Milvus for embeddings, SQL for transactions.</li><li><strong>Keep IDs consistent.</strong> They act as the bridge between SQL and Milvus.</li><li><strong>Choose the right index.</strong> For large datasets, explore HNSW or IVF indexes in Milvus.</li><li><strong>Plan for scale.</strong> Milvus supports distributed clusters for billions of vectors.</li></ul><h4>When to Use Milvus</h4><p>Vector search shines in:</p><ul><li><strong>Semantic search</strong> (documents, products, FAQs)</li><li><strong>Recommendations</strong> (movies, shopping, content)</li><li><strong>Image/video/audio retrieval</strong></li><li><strong>Fraud detection</strong> (pattern similarity)</li></ul><p>If your application involves <strong>finding “things like this”</strong>, it’s time to think vectors.</p><h4>Wrapping Up</h4><p>Moving from a <strong>SQL-only world</strong> to a <strong>hybrid SQL + vector database world</strong> unlocks a whole new class of intelligent applications.</p><ul><li>SQL continues to do what it does best: structured queries and transactions.</li><li>Milvus brings in <strong>AI-driven semantic search</strong>, letting your app understand <em>meaning, not just keywords</em>.</li></ul><p>By combining the two, you can transform your old product catalog, content library, or media archive into an <strong>AI-ready system</strong> — powering smarter recommendations, better search, and a richer user experience.</p><p>The future of data isn’t just about storing facts — it’s about storing <strong>understanding</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81a54fb35a68" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>