Search This Blog

Sunday, August 2, 2026

Stop Calling the LLM for Everything: Designing Smarter AI Systems

 

Stop Calling the LLM for Everything: Designing Smarter AI Systems

Large Language Models (LLMs) have transformed the way we build software. They can write code, summarize documents, reason over complex problems, and converse in natural language. With capabilities improving rapidly, it's tempting to place an LLM at the center of every AI application.

However, one of the biggest misconceptions in enterprise AI is:

If AI is involved, an LLM should handle every request.

This mindset often leads to applications that are slower, more expensive, less reliable, and harder to govern.

The best AI systems don't ask, "Can an LLM do this?" Instead, they ask:

"Is an LLM actually the best tool for this task?"

Just because a Swiss Army knife has a blade doesn't mean you should use it to tighten a screw. Likewise, an LLM is incredibly powerful, but it is not the right solution for every problem.


Understanding What an LLM Is Good At

An LLM is fundamentally a reasoning and language engine. It excels when a task involves ambiguity, interpretation, communication, or synthesis.

Examples include:

  • Summarizing lengthy reports

  • Explaining technical concepts

  • Comparing architectural options

  • Writing proposals

  • Drafting emails

  • Translating between languages

  • Generating code

  • Brainstorming ideas

  • Understanding natural language requests

These tasks have no single deterministic answer. They require interpretation and judgment, which is exactly where LLMs shine.


What an LLM Is Not Designed For

Many enterprise applications send every request to an LLM—even tasks that traditional software solves faster, cheaper, and more accurately.

Consider these examples:

Database Queries

Request:

"Show all employees in the London office."

Should an LLM search your employee database?

No.

A SQL query can return the exact answer in milliseconds.


Mathematical Calculations

Request:

"Calculate 18% GST on ₹75,000."

An LLM can usually answer correctly, but a calculator or Python will always be faster and deterministic.


Business Rules

Request:

"Approve travel if the amount is less than ₹25,000."

This belongs in a rule engine—not an LLM.

Business rules should always produce the same result.


API Orchestration

Creating a purchase order.

Updating an SAP record.

Sending an email.

Calling a REST API.

None of these require language reasoning.

They require reliable execution.


Data Validation

Checking whether:

  • an email address is valid

  • a date exists

  • a mandatory field is empty

  • an invoice number is unique

Again, no LLM required.


The Decision Framework

A useful question to ask is:

Does this task require understanding, reasoning, or language generation?

If the answer is yes, consider an LLM.

If the answer is no, use deterministic software.

TaskLLM Needed?Better Alternative
SQL lookupNoDatabase
API callsNoService layer
Mathematical calculationsNoPython
Currency conversionNoFinance API
OCRNoDocument AI
SearchNoSearch engine
RulesNoRule engine
Recommendations based on fixed criteriaNoDecision tree
SummarizationYesLLM
Proposal writingYesLLM
Architecture reasoningYesLLM
Requirement clarificationYesLLM
Executive communicationYesLLM

The Hidden Cost of Overusing LLMs

Every unnecessary LLM call introduces trade-offs:

  • Higher infrastructure costs

  • Increased response time

  • Greater operational complexity

  • Potential hallucinations

  • Larger governance burden

  • More tokens consumed

  • Higher carbon footprint

In enterprise environments handling thousands or millions of requests daily, avoiding unnecessary LLM calls can save significant infrastructure costs while improving user experience.


Agentic AI Doesn't Mean "Everything Uses an LLM"

Another common misunderstanding is:

Agent = LLM

In reality, an intelligent agent is much more than a language model.

An agent typically consists of:

  • Goals

  • Planning

  • Memory

  • Decision logic

  • Tools

  • Knowledge

  • Execution capability

  • Optional LLM reasoning

The LLM is simply one capability among many.


A Smarter Agent Workflow

Imagine an employee asks:

"Create a purchase order for Vendor A."

A naïve implementation might look like this:

  1. Ask the LLM what to do.

  2. Ask the LLM how to find the vendor.

  3. Ask the LLM how to create the purchase order.

  4. Ask the LLM to explain the result.

Four LLM calls.

A better implementation is:

  1. Detect the user's intent.

  2. Call the vendor API.

  3. Validate business rules.

  4. Create the purchase order through SAP.

  5. Only if the user requests an explanation, ask the LLM to generate one.

One LLM call.

Sometimes none.


The Right Role of an LLM in Agentic Systems

Think of an LLM as a senior consultant.

You don't ask a senior consultant to:

  • retrieve database records

  • calculate taxes

  • validate forms

  • send HTTP requests

  • update SAP tables

Instead, you involve them when you need:

  • expert judgment

  • interpretation

  • communication

  • strategy

  • reasoning under uncertainty

Your software should treat the LLM the same way.


The Best Enterprise AI Architecture

Modern AI systems are becoming hybrid systems.

Rather than placing the LLM at the center, they orchestrate multiple specialized components.

A typical request may flow like this:

  1. Understand user intent.

  2. Retrieve structured data.

  3. Apply business rules.

  4. Execute APIs.

  5. Perform calculations.

  6. Use search when appropriate.

  7. Invoke the LLM only when reasoning or natural language generation is required.

  8. Return the final response.

This architecture is:

  • Faster

  • Cheaper

  • Easier to govern

  • More reliable

  • Easier to test

  • More scalable


A Simple Rule of Thumb

Before invoking an LLM, ask three questions:

  1. Can deterministic software solve this exactly?

  2. Does this task require reasoning or language understanding?

  3. Would an LLM genuinely improve the outcome?

If the answer to the first question is yes, don't use an LLM.

If the answer to the second and third questions is yes, then an LLM is likely the right choice.


Final Thoughts

The future of AI is not about replacing every component with an LLM.

It is about combining the strengths of deterministic software, APIs, databases, machine learning models, search engines, rule engines, and language models into cohesive systems.

The smartest AI platforms don't maximize LLM usage.

They optimize it.

A well-designed AI system knows when to think, when to calculate, when to search, when to execute—and only then, when truly necessary, when to ask an LLM.

In enterprise AI, success isn't measured by how often you call an LLM. It's measured by how intelligently you decide not to.

Wednesday, July 22, 2026

Understanding Text Embeddings: The Foundation of Semantic Search and RAG

 

Understanding Text Embeddings: The Foundation of Semantic Search and RAG

Why every AI engineer should understand embeddings before building Retrieval-Augmented Generation (RAG), AI Agents, or Semantic Search systems.


Introduction

One of the biggest misconceptions about Large Language Models (LLMs) is that they "understand" language the way humans do. In reality, computers don't understand words—they understand numbers.

When you ask an AI:

"How do I deploy an Node application?"

the model cannot process this sentence directly. Before any reasoning or retrieval happens, the text must first be transformed into a mathematical representation that a computer can work with.

This representation is called a text embedding.

Text embeddings are the foundation of nearly every modern AI application, including:

  • Semantic Search

  • Retrieval-Augmented Generation (RAG)

  • AI Chatbots

  • Recommendation Engines

  • Document Classification

  • AI Agents

  • Knowledge Management Systems

If you've ever wondered how ChatGPT finds relevant information from your documents or how a vector database retrieves similar content in milliseconds, text embeddings are the answer.


What is a Text Embedding?

A text embedding is a numerical representation of text that captures its semantic meaning.

Instead of storing text as words, an embedding model converts the text into a vector—a list of floating-point numbers.

For example:

"I love dogs"

↓

[0.23, -0.18, 0.91, ..., 0.44]

Similarly,

"Dogs are my favorite pets"

↓

[0.21, -0.15, 0.89, ..., 0.41]

Although these two sentences use different words, their vectors are very close because they express nearly the same meaning.

Now consider:

"How to bake a chocolate cake"

↓

[-0.72, 0.61, -0.35, ..., 0.08]

This vector will be much farther away because its meaning is unrelated.

The key idea is simple:

Similar meanings produce similar vectors.


Why Do We Need Embeddings?

Traditional keyword-based search looks for exact word matches.

Imagine searching for:

Affordable car

But your document contains:

Cheap automobile

A keyword search may fail because none of the words match exactly.

Humans immediately understand that:

  • Affordable ≈ Cheap

  • Car ≈ Automobile

Embedding models capture this semantic relationship. Instead of comparing words, they compare meanings.

This is what makes semantic search so powerful.


The Evolution of Text Representation

Natural Language Processing has evolved significantly over the years.

1. One-Hot Encoding

Each word is represented as a unique binary vector.

Dog   → [0,0,1,0,0]
Cat   → [0,1,0,0,0]
Car   → [1,0,0,0,0]

Problems:

  • Huge vectors

  • No understanding of meaning

  • Dog and Puppy are completely unrelated


2. Word Embeddings

Models like Word2Vec and GloVe introduced dense vector representations.

Dog → [0.41, -0.21, 0.83]
Cat → [0.38, -0.17, 0.80]
Car → [-0.62, 0.91, -0.11]

Now:

  • Dog and Cat become close.

  • Dog and Car remain far apart.

A major improvement—but there was still one limitation.

Every word had only one meaning.

For example:

Apple

was always represented by the same vector.


3. Contextual Embeddings

Transformer models changed everything.

Now the meaning of a word depends on its surrounding words.

Sentence 1:

Apple released a new MacBook.

Embedding:

Apple = Technology Company

Sentence 2:

Apple tastes delicious.

Embedding:

Apple = Fruit

The embedding changes depending on the context.

This is one of the biggest breakthroughs in modern AI.


How Text Embeddings Are Generated

Let's walk through the complete process.

Step 1 — Input Text

What is Node App?

Step 2 — Tokenization

The sentence is broken into smaller pieces called tokens.

What

is

Node

App

?

Every token receives a unique identifier.


Step 3 — Initial Token Embeddings

Each token is mapped to a dense vector.

Node

↓

[0.12, 0.55, -0.81, ...]

Initially these vectors are learned during model training.


Step 4 — Transformer Processing

This is where the magic happens.

Every token interacts with every other token using self-attention.

The model learns relationships like:

  • subject

  • object

  • intent

  • context

  • domain knowledge

Instead of understanding words independently, the model understands the entire sentence.


Step 5 — Pooling

The transformer generates one vector per token.

These token vectors are combined into a single vector representing the entire sentence.

Common pooling strategies include:

  • CLS Token

  • Mean Pooling

  • Max Pooling

The result is one embedding for the whole sentence.


Measuring Similarity

Once we have vectors, how do we compare them?

The most common metric is Cosine Similarity.

Imagine two arrows.

If both arrows point in nearly the same direction,

their cosine similarity approaches 1.0.

Typical values:

1.00

Exactly identical

0.95

Extremely similar

0.85

Related

0.50

Weak similarity

0

No relation

Instead of comparing words, AI systems compare vectors mathematically.


Semantic Search

Suppose our knowledge base contains four documents.

Node App Overview

Python Programming

Pizza Recipes

Node App Development

Each document is converted into an embedding.

Now the user asks:

How do I deploy a Node application?

The query is also embedded.

The search engine compares the query vector against every document vector.

The most similar documents might be:

Node App Development

Similarity: 0.96

Node App Overview

Similarity: 0.82

Python Programming

Similarity: 0.23

The system retrieves the first two documents.

Notice that it doesn't matter whether the exact words appear—it retrieves content based on meaning.


Where Are Embeddings Stored?

Embeddings are typically stored inside a vector database.

Each record contains:

  • Original text

  • Embedding vector

  • Metadata

For example:

{
  "id": "doc001",
  "text": "Node App Development Guide",
  "embedding": [0.23, -0.41, ...],
  "metadata": {
      "product": "Node App",
      "version": "8.0"
  }
}

Popular vector databases include:

  • PostgreSQL + pgvector

  • Qdrant

  • Pinecone

  • Chroma

  • Weaviate

  • Milvus

  • FAISS

These systems are optimized to search millions—or even billions—of vectors efficiently.


Embeddings in Retrieval-Augmented Generation (RAG)

RAG combines vector search with large language models.

The workflow looks like this:

  1. Documents are split into smaller chunks.

  2. Each chunk is converted into an embedding.

  3. Embeddings are stored in a vector database.

  4. A user's question is embedded.

  5. Similar chunks are retrieved.

  6. Retrieved content is provided as context to the LLM.

  7. The LLM generates an informed response.

Without embeddings, RAG would not be able to retrieve relevant information efficiently.


Real-World Applications

Text embeddings power a wide range of AI systems:

  • Enterprise Knowledge Search

  • AI Customer Support

  • Code Search

  • Document Recommendations

  • Fraud Detection

  • Similar Case Retrieval

  • Resume Matching

  • Product Recommendations

  • Medical Record Search

  • Legal Document Analysis

Anywhere we need to compare the meaning of text rather than its exact wording, embeddings play a critical role.


Key Takeaways

  • Text embeddings convert text into numerical vectors.

  • They capture semantic meaning rather than exact words.

  • Similar texts produce vectors that are close together.

  • Modern embeddings are generated using Transformer-based language models.

  • Similarity is measured mathematically using metrics such as cosine similarity.

  • Vector databases enable fast retrieval of semantically similar content.

  • Embeddings form the foundation of semantic search, RAG, AI agents, and many modern AI-powered applications.


Conclusion

Text embeddings are one of the most important building blocks in modern Artificial Intelligence. While Large Language Models often receive the spotlight, embeddings quietly power the retrieval, search, and contextual understanding that make those models truly useful.

Whether you're building an enterprise knowledge assistant, an AI-powered search engine, or a multi-agent system, understanding how text embeddings work will help you design systems that are faster, more accurate, and capable of reasoning over vast amounts of information.

In future articles, we'll dive deeper into related topics such as vector databases, cosine similarity, embedding model selection, chunking strategies, and building a complete RAG application from scratch using Node.js.

Monday, July 6, 2026

Skills vs. Prompts: Understanding the Building Blocks of Modern AI Applications

 

Skills vs. Prompts: Understanding the Building Blocks of Modern AI Applications

Introduction

As Generative AI evolves, the terminology around it is evolving just as quickly. Two terms that are often used interchangeably—but represent very different concepts—are prompts and skills.

Many developers ask questions like:

  • Is a skill just a prompt?

  • Are skills replacing prompts?

  • How do AI agents use skills?

  • When should I create a prompt versus a skill?

The short answer is:

A prompt tells an AI model what to do for a single interaction, while a skill packages everything needed to perform a task repeatedly, reliably, and consistently.

Understanding this distinction is essential when building production-grade AI applications.


What Is a Prompt?

A prompt is the instruction given to an AI model during an interaction.

It provides context, guidance, and the expected output.

Example

Summarize this research paper in five bullet points suitable for executives.

Or

Write a professional email declining a meeting invitation.

A prompt is typically:

  • One-time

  • Task-specific

  • Text-based

  • Stateless (unless conversation history is supplied)

  • Easy to modify

Think of a prompt as asking an expert a single question.


What Is a Skill?

A skill is a reusable capability designed to accomplish a specific business or technical task.

Rather than containing only a prompt, a skill combines multiple components that work together.

A skill may include:

  • System instructions

  • Prompt templates

  • Business rules

  • Workflow logic

  • External tools

  • APIs

  • Database access

  • Validation rules

  • Output formatting

  • Security guardrails

  • Optional memory or context

Instead of simply telling the model what to do, a skill defines how the task should be completed every time.


A Better Definition

A skill is a reusable, packaged capability that combines prompts, instructions, workflows, tools, business logic, and guardrails to perform a specific task consistently.

This definition captures how modern AI platforms implement reusable functionality.


Visualizing the Difference

Prompt

"Summarize this PDF."

Skill

Contract Review Skill

├── Understand user request
├── Read uploaded PDF
├── Extract contract clauses
├── Identify risks
├── Compare with company policies
├── Highlight missing information
├── Generate executive summary
└── Export structured report

Notice that the prompt is only one component of the overall capability.


Skills Are More Than Prompts

Many people describe skills as "packaged prompts."

While this isn't entirely wrong, it is incomplete.

A better way to think about it is:

Skill
│
├── Prompt(s)
├── Instructions
├── Workflow
├── Tool Access
├── APIs
├── Knowledge Sources
├── Validation
├── Memory
├── Output Templates
└── Guardrails

The prompt is only one building block.


Prompt vs Skill Comparison

FeaturePromptSkill
PurposeOne instructionReusable capability
ScopeSingle interactionComplete workflow
ReusabilityLowHigh
Includes promptsYesYes
Includes toolsNoYes
Uses APIsNoOften
Workflow logicMinimalExtensive
Business rulesUsually absentIncluded
Output formattingManualStandardized
ValidationRareCommon
MemoryOptional conversation historyMay include persistent context
Ideal forSimple requestsEnterprise automation

Software Engineering Analogy

For software engineers, the distinction becomes much clearer with familiar concepts.

Software DevelopmentAI
Function callPrompt
LibraryCollection of prompts
ModuleSkill
ApplicationAI Agent
MicroserviceSpecialized Skill

A prompt is similar to calling a single function.

A skill resembles an entire software module that encapsulates implementation details behind a clean interface.


Real-World Example

Suppose you want AI to analyze invoices.

Using Only a Prompt

Extract invoice number, vendor name, total amount, and due date.

This works—but only for one interaction.


Using an Invoice Processing Skill

The skill might perform the following:

  1. Accept PDF or image uploads.

  2. Run OCR if needed.

  3. Detect invoice layout.

  4. Extract structured fields.

  5. Validate mandatory fields.

  6. Check against ERP records.

  7. Detect duplicate invoices.

  8. Flag anomalies.

  9. Generate JSON output.

  10. Store results in a database.

The prompt is only one step in a much larger workflow.


Why Enterprises Build Skills

Organizations rarely deploy raw prompts directly into production.

Instead, they package expertise into reusable skills because they provide:

Consistency

Every user receives standardized output.

Reusability

Multiple applications can invoke the same capability.

Maintainability

Updates are made in one place rather than across many prompts.

Governance

Business rules remain centralized.

Security

Skills can enforce authentication, authorization, and data protection.

Tool Integration

Skills can call databases, APIs, enterprise systems, and search services.


Skills Enable AI Agents

An AI agent rarely performs every task itself.

Instead, it orchestrates multiple skills.

Customer Support Agent

        │
        ├── Search Knowledge Skill
        ├── Order Lookup Skill
        ├── Refund Processing Skill
        ├── Email Drafting Skill
        ├── CRM Update Skill
        └── Escalation Skill

The agent decides which skill should execute.

Each skill internally uses prompts, tools, and workflows.


A Practical Example

Imagine asking:

"My order hasn't arrived. Can you help?"

The AI agent might:

  1. Understand the intent.

  2. Invoke the Order Lookup Skill.

  3. Retrieve shipment details.

  4. Invoke the Refund Eligibility Skill.

  5. Generate a personalized response.

  6. Update the CRM.

  7. Send a confirmation email.

The user experiences a single conversation, while multiple skills work together behind the scenes.


When Should You Use a Prompt?

A prompt is ideal when:

  • Experimenting with ideas.

  • Writing content.

  • Asking questions.

  • Summarizing documents.

  • Brainstorming.

  • Learning.

  • Rapid prototyping.

Prompts are fast, flexible, and easy to iterate.


When Should You Build a Skill?

A skill becomes valuable when:

  • The task is repeated frequently.

  • Multiple users need the same capability.

  • External systems are involved.

  • Business rules must be enforced.

  • Outputs require standardization.

  • Compliance and governance matter.

  • Reliability is critical.

Skills transform experimental AI into production-ready functionality.


The Evolution of AI Development

Many AI projects follow a natural progression:

Prompt

↓

Prompt Template

↓

Reusable Prompt Library

↓

Skill

↓

Collection of Skills

↓

AI Agent

↓

Enterprise AI Platform

Each stage adds greater structure, automation, and reliability.


Key Takeaways

  • A prompt is an instruction for a single interaction.

  • A skill is a reusable capability built around prompts.

  • Skills combine prompts, workflows, tools, APIs, business rules, and guardrails.

  • AI agents orchestrate multiple skills to complete complex tasks.

  • Prompts are excellent for experimentation, while skills are designed for production systems.

The most successful AI solutions don't eliminate prompts—they build on them. Prompts remain the foundation, but skills package that intelligence into reusable, scalable capabilities that organizations can trust and deploy across teams.

As AI continues to mature, understanding the relationship between prompts, skills, and agents will become a core competency for software engineers, architects, and AI solution designers.

Popular Posts