Demystifying LLMs: From Transformers to Agents, Prompts, and Function Calling
This article explains the fundamentals of large language models, covering transformer self‑attention, prompt engineering, API usage with temperature and tool parameters, function calling, agent architectures, the Model Context Protocol (MCP), Agent‑to‑Agent (A2A) communication, and future AI programming roles.
LLM (Large Language Model)
LLMs are essentially text‑completion engines: the user’s question is treated as input, the model acts like a function, and the generated answer is the output.
Transformer (Self‑Attention)
Self‑attention dynamically relates each token to all previous tokens. Every token is represented by three vectors — Q (query), K (key), and V (value). The attention weight for a token is computed by the dot‑product of its Q vector with the K vectors of preceding tokens, followed by a Softmax normalization. The context vector is the weighted sum of the V vectors, which is then used to predict the next token.
For example, the sentence “Xiao Ming ate ice cream, result ⇒ stomach ache” can be broken down into tokens with associated Q, K, V vectors, dot‑product scores, Softmax weights, and the final context vector that leads to the prediction “stomach ache”.
Prompt
Prompts are the initial instructions given to the model. In chat‑style APIs the system role defines the true prompt, while user messages contain the actual query.
Understanding the API
LLM APIs accept several important parameters:
temperature : controls randomness; lower values make output deterministic, higher values increase creativity.
tools : declares external functions the model may call (function calling).
messages : a list of role‑based entries (system, user, assistant, tool) that form the conversation context.
Function Calling
Function calling enables the model to request execution of external tools, receive the tool’s result, and continue the dialogue with that result, making the output more reliable and programmable.
Agent
An agent combines a LLM with task planning, memory, and tool invocation. Simple agents can be built by providing a descriptive system prompt and listing required tools. More sophisticated agents use protocols like MCP to modularize tool integration.
MCP (Model Context Protocol)
MCP standardizes tool integration with two core operations: ListTools: the server advertises the capabilities it provides. CallTool: the agent invokes a specific tool and receives the result.
This decouples agents from hard‑coded tool implementations.
A2A (Agent‑to‑Agent Protocol)
A2A extends MCP to allow agents to communicate with each other, making capabilities composable across different agents.
Future Outlook
AI is poised to become a transformative technology comparable to electricity. New professional roles such as “AI programming engineer” will emerge to manage AI‑driven development, integrate tools via protocols like MCP, and handle the inherent uncertainty of generative models.
"The current temperature in Paris is 14°C (57.2°F)."Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
