ποΈ Podcast
Explore the fundamental concepts of Generative AI through audio content.
Simple Summary of Transformers and LLMs
Transformers are the type of neural network used by language models such as GPT. Their main goal is to predict the next word in a text, which allows them to generate coherent responses.
Each word (or part of a word) is converted into a numerical vector called an embedding. At first, this vector represents only the word's individual meaning. As it passes through the model's layers, it is gradually refined to include contextual information.
A Transformer is built from two main blocks that are repeated many times:
1. Attention
- The attention mechanism allows each word to "pay attention" to other words in the text.
- It creates Query, Key, and Value vectors.
- It calculates how important each word is relative to others.
- These importance scores are used to combine relevant information and update each word's meaning.
- Multiple attention heads run in parallel, enabling the model to capture different types of context.
2. MLP (Multilayer Perceptron)
- The MLP adds factual and conceptual knowledge to the word representations.
- It processes each word independently.
- The embedding is expanded, passed through a non-linear function (such as ReLU), and then reduced back to its original size.
- The result is added to the original embedding, enriching its meaning.
Why does this work so well?
- Transformers are highly parallelizable, making it possible to train very large models on GPUs.
- In high-dimensional spaces, the model can store many concepts at once, allowing it to represent complex knowledge efficiently.
Model Context Protocol (MCP) β Summary
Overview
The Model Context Protocol (MCP) is a specification focused exclusively on the protocol for exchanging context between servers and Artificial Intelligence (AI) applications. It does not prescribe how applications should use Large Language Models (LLMs) nor how they internally manage the provided context.
Architecture and Participants
MCP follows a clientβserver architecture. The main participants are:
- MCP Host: The AI application (such as Claude Desktop or Visual Studio Code) that coordinates and manages one or more MCP Clients.
- MCP Client: A component instantiated by the Host that maintains a dedicated one-to-one connection with an MCP Server and retrieves context for use by the Host.
- MCP Server: A program that provides context to MCP Clients. Servers can run locally (using Stdio transport) or remotely (using Streamable HTTP).
Layers and Protocol
MCP is composed of two main layers:
1. Data Layer
Defines a JSON-RPC 2.0βbased protocol for communication, including lifecycle management and core primitives.
2. Transport Layer
Manages communication channels and authentication between clients and servers. It supports:
- Stdio Transport: Uses standard input/output streams for direct communication between local processes.
- Streamable HTTP Transport: Uses HTTP POST and optionally Server-Sent Events (SSE) for remote communication.
Core Concepts (Primitives)
Primitives define the types of contextual information and actions that can be shared.
Primitives Exposed by Servers:
- Tools: Executable functions that AI applications can invoke to perform actions (e.g., file operations, API calls, database queries).
- Resources: Passive, read-only data sources that provide contextual information.
- Prompts: Reusable templates that help structure interactions with language models.
Primitives Exposed by Clients:
- Sampling: Allows servers to request that the client's AI application generate model completions.
- Elicitation: Allows servers to request additional user information or confirmation.
- Logging: Allows servers to send log messages to clients for debugging and monitoring.
Communication Flow
A typical interaction begins with lifecycle management, where the client sends an initialize request to negotiate the protocol version and supported capabilities. The protocol also supports real-time notifications for dynamic updates, such as when a server's available tools change.
Example in AI Applications
When a Host processes a user query, it retrieves the list of available tools from connected MCP Servers. The query and tool descriptions are sent to the LLM, which decides whether a tool should be used. If the LLM chooses to invoke a tool, the client executes the request via the MCP Server, receives the result, and sends it back to the LLM for a natural-language response.
By using multiple MCP Servers, applications can combine specialized capabilities. For example, a Travel server, Weather server, and Calendar server can work together to search for flights, check weather conditions, and reserve dates in the user's calendar.
Summary of the Model Context Protocol (MCP)
The Model Context Protocol (MCP) focuses on a secure and controlled architecture for enabling AI applications to interact with external tools, data, and workflows.
1. ClientβServer Architecture
MCP follows a clientβserver model:
- MCP Host: The AI application the user interacts with (e.g., Claude Desktop or Visual Studio Code).
- MCP Client: A component created by the Host that maintains a one-to-one connection with an MCP Server and retrieves context for the Host.
- MCP Server: A program that provides context and capabilities to the Client. Servers can run locally (via stdio) or remotely (via streamable HTTP).
Servers expose three core primitives:
- Tools: Executable functions controlled by the language model.
- Resources: Passive data sources read by the AI.
- Prompts: User-invoked interaction templates that guide structured workflows.
2. Control and Workflow Management
MCP provides several mechanisms to keep users in control:
- Tool Control: Even though tools are chosen by the LLM, the Client can require explicit user approval (human-in-the-loop) or enable pre-approved safe actions.
- Elicitation: Allows servers to request additional user input or confirmation through the Client, enabling dynamic workflows.
- Sampling: Servers can request LLM completions through the Client, ensuring that all permissions, safeguards, and approvals remain under Client control.
- Prompts: Must be explicitly triggered by the user, ensuring intentional initiation of complex workflows.
3. Security and Risk Management
Security is a core design principle of MCP:
- Explicit User Approval: Required for potentially risky actions, such as file system operations.
- Directory Access Control (Roots): Hosts define which directories servers should focus on, helping prevent mistakes. These are coordination mechanisms, not hard security boundaries.
- Transport Security: Remote communication supports standard authentication methods (API keys, bearer tokens), with OAuth recommended.
- Sensitive Data Handling: Clients warn users about suspicious requests, never ask for passwords or API keys, and enforce rate limiting and content validation.
- Local Server Risks: Local MCP servers run with the user's OS permissions, so directory access must be granted carefully.
Key Takeaway
Overall, MCP acts as a secure gatewayβsimilar to airport securityβthat allows large language models to interact with external systems under strict rules, transparent permissions, and human oversight, significantly reducing the risk of unauthorized or unsafe actions.