Tuesday, June 2, 2026

LLM Pipelines

We can incoporate 3 ways of LLM through pipelines:

1) DAG workflow
a) Pre designed prompts + code paths
b) Modular components [Yes or No prompts]
2) Agents
LLM setups to make their own decision
3) Agentic workflows
Hybrid architecture


We can create a work flow through LangChain and LangGraph.

LangChain:
It is designed for LLMs. It can be useful for custom workflows, tool integration and agent collaboration. 
LangGraph:
LangGraph library used for build a stateful, multi actors with LLMs

LangGraph concepts:
State: a TypeDict that flow through graph and updated by each nodes.
Nodes : Python function used to receive update and return updates
Edges : Connection between Nodes
Reducter : control how state updates combine with over write or accumalation


Retrieval Augmented Generation (RAG)
A RAG is an interactive system (chatbot) that combined a retrieval (static content) with a dynamic conversation generator.

Components of RAG:
An index : A mechanism to convert a raw data into Vector database
A retriever: Closed tied to the index and retrieve a data from database based on query
A generator : an LLM to reason a through user query and the retrieval knowledge to provide an inline conversational response.

Sementic search:
A system has understand of context and meaning of user query and matches against the available document for retrieval. It can find relevant document without having to rely on exact words or n-gram matching. It often uses a pre-trained large language model to understand the nuance of the query and the documents.
We often use of cosine similarity to define a raw data that produce in vector database.
Cosine is bounded between 1 and -1.
smaller angle == Cosine [up]
larger angle == Cosine [down]
Perpendicular == Cosine 0


Dense Model:
A dense model uses all the parameter for every tokenized. It would be better for semantic similarity, paraphrases and conceptual queries. [Example GPT3 & GPT4 are using Dense model]
Pros:
* Easier for training the model
* Simple architecture
Cons:
* high computation cost
Sparse Model:
A sparse model is used for small set of parameter for each token. The most common Sparse architecture is Mixure of Experts.
Pros:
* Less computation cost
* Better scaling efficiency
Cons:
* Potential training
* More complex architecture


Cross Encoders:
A cross Encoder is a non-generative LLM specifically designed to take in two inputs separated by a special token and return a single output.[Ex. BERT]

Reasoning LLMs:
Reasoning models like Deepseeks R1, OpenAI are orginal "o" series and Anthropic's Claude/Opus 4 models are autoregressive LLMs that have been trained to give a discursive chain-of-thought reasoning step before giving a user response.
For example, the Claude 4 series of LLMs provide separate reasoning tokens alongside the messages to the user, as is common with most frontier reasoning LLMs.


Agents:
1) Solo Agents
2) Supervisor + specialist agent





No comments:

Post a Comment