Prompt engineering: how to get the most out of AI

architecture of synthetic reasoning

This is the second article I dedicate to prompt engineering: the art of knowing how to communicate with artificial intelligence (AI) to obtain the best possible results. This time, however, we will leave the basics behind to delve into the architecture of its synthetic reasoning. The goal is for you to substantially improve your efficiency, while we explore new ways to automate tasks in both personal and business environments.

To understand how modern AI systems work, it is useful to illustrate it with examples that make it easier to understand, so the first thing we are going to do is to come up with an example in which we must first establish a frame of reference. Let’s imagine that we are a Director of Compliance and Technology Strategy in a global consulting firm.

Its main task would not be to simply “use AI”, like someone installing a new office tool, but to integrate language models into critical audit, risk analysis and document review workflows. And to do so while ensuring three things that cannot be separated: technical accuracy, financial sustainability and protection of sensitive data.

In other words, it is not about asking a machine questions and blindly trusting the answer. It is about designing a working system in which AI provides speed, analysis capacity and cognitive support, but always within a controlled, verifiable and safe environment.

Fundamentals of processing: the token ontology and its economic impact.

At the core of human-machine interaction is a fundamental unit of measurement that defines both processing capacity and operational cost: the token.

Large-scale language models, known as LLMs, do not perceive language as we humans do. They do not “read” words in the human sense of the term, but process numerical sequences that represent fragments of text.

This fragmentation process is called tokenization. It consists of decomposing information into frequent statistical units, which can be whole words, parts of words, characters or even punctuation marks.

So when we type a sentence into an AI tool, the system doesn’t read it out of the box like a person would. First, it breaks the sentence into small, manageable pieces (called tokens). Then, because computers don’t understand letters, they translate these pieces into their own language: numbers. They do this through a process called embedding, which converts each word into a vector (a long list of mathematical coordinates).

Thanks to these coordinates, the AI locates each word within a huge “meaning map”, where similar concepts (such as “dog” and “cat”) end up very close to each other. Finally, with all this structured mathematical map, the model calculates what is the most logical and probable continuation according to the context, your instructions and the patterns it learned during its training.

📊 Interactive resource: To understand this concept in a graphical way, I recommend you to visit the official OpenAI Tokenizer. On this page you can paste any text and see in real time, through a color code, how the AI fragments your sentence and exactly how many tokens each word is equivalent to.

The strategic importance of tokens lies in the fact that they are, in practice, the currency of generative AI (genAI). AI companies bill you based on the volume of tokens processed on input and generated on output. That’s why understanding the mechanics of tokenization is essential to any serious cost reduction strategy.

Moreover, not all languages are equally efficient from a tokenization point of view. This difference is not anecdotal. It can affect price, speed of response and the amount of information the model can handle within a single conversation or task.

Linguistic inequality in tokenization

Most foundational models have been trained with a very high predominance of English data. As a consequence, many tokenization algorithms, such as Byte-Pair Encoding (BPE), are often specially optimized for the structure of that language.

In English, a common word may be equivalent to one or a few tokens. In other languages, especially those with more complex morphologies or less representation in the training data, the same idea may require more processing units.

This is the case, for example, with languages such as Spanish, Portuguese, Hindi or Greek. It does not mean that the AI “understands these languages worse” by definition, but it does mean that, in many cases, it needs more tokens to process an equivalent amount of information.

Language

Approximate ratio of tokens per word

Estimated cost impact vs. English

English

1,3 - 1,5

1.0x (Baseline)

Spanish

1,6 - 1,8

1.3x - 1.5x

Portuguese

1,7 - 1,9

1.3x - 1.6x

Simplified Chinese

Variable, with high semantic density

Variable according to tokenizer

Hindi

3,5 - 4,2

Up to 5.0x in some analyses

Greek

4,0 - 5,0

Up to 6.0x in some analyses

These values should be understood as approximations, not as universal figures. Efficiency depends on the model, the specific tokenizer and the type of text being analyzed.

Still, the general trend is well documented: English tends to be more efficient and cheaper than many other languages in several current tokenizers. Some recent studies on multilingual tokenization have shown significant differences between languages, with a clear advantage for English in many cases. So you know, if you know English, you’d better talk to them in English because you’ll save more.

This inefficiency is not only an economic problem. It also affects performance

The models have a finite context window, i.e., a maximum limit of tokens they can process at a time. If a language consumes more tokens to express the same amount of information, that window fills up sooner. As a consequence, the model may retain less conversation history, fewer reference documents, or less technical context in a single session.

For a Compliance Manager, this has a very practical consequence: an audit conducted entirely in Spanish may cost more and have less contextual margin than an equivalent audit conducted in English, unless optimization techniques are applied.

The hierarchy of instructions: System prompt vs. User prompt

For a model to process information consistently, the prompt architecture must be divided into two levels of command: the system prompt and the user prompt.

The system prompt: the constitutional framework

The system prompt acts as the configuration base of the model. It is a set of high-level instructions that defines the role, the tone, the security constraints and the expected output format.

In our example of the Chief Compliance Officer, the system prompt could state that the model must act in a meticulous, unbiased manner, oriented to the detection of legal risks and able to cite regulatory sources accurately.

Correct use of the system prompt is vital to maintain operational consistency. If these instructions are omitted or vaguely worded, the model tends to provide generic responses or ignore critical privacy, compliance or formatting constraints.

In addition, a well-designed system prompt can reduce token consumption in subsequent messages by avoiding repeating the same behavioral rules for each user query.

The user prompt: the dynamic action

The user prompt is the specific query from the end user. It is the specific task that the model is asked to perform at a specific time.

While the system prompt defines who the AI should be in that environment, the user prompt defines what it should do next.

The synergy between the two allows a much deeper specialization. The system knows to behave like a legal expert (thanks to the system prompt), and analyzes a specific contract for termination clauses (thanks to the user prompt).

When both levels are well designed, the AI stops behaving as a generic assistant and starts acting as a specialized tool within a professional workflow.

Generation-augmented retrieval (GAR): narrowing the search field

When working with information that is not part of the model’s public training - such as proprietary books, internal company documents or private databases - relying solely on general AI knowledge involves several risks.

The first is obsolescence. The model may not be aware of recent changes. The second is the invention of data. If it doesn´t have a clear source, it can fill in the gaps it doesn´t know with a plausible, but false, answer.

**RAG **(Retrieval-Augmented Generation) technology is used to reduce this problem. RAG is an architecture that connects the model with external knowledge bases to offer more relevant, updated and anchored answers to specific documents of your choice.

The RAG does not retrain the model. Instead, it provides it with something akin to an open source book during the conversation. This makes it possible to limit the AI’s search field to the information contained in the supplied documents.

If properly designed, the system can be instructed not to go to the Internet or its general memory, but to respond only with information retrieved from authorized sources. Very useful when working locally with confidential documents.

Processing flow and order of operations

It is important to understand what happens when a user submits a query in a RAG system. The model does not simply receive an isolated query. It receives a packet of information carefully ordered to maximize relevance and reduce ambiguity.

Although the exact order may vary, the logical structure is usually as follows:

  1. System prompt: It is placed at the beginning to establish the rules for processing the data that will follow.
  2. Information cached by prompt caching: Modern systems can detect if part of the instructions or documents have already been processed in previous turns. When this happens, some tokens can be reused to reduce latency and cost.
  3. Context retrieved from the RAG: The semantic search system identifies the most relevant fragments of the user’s documents and injects them into the prompt. This data acts as the main source of truth.
  4. Conversation history: Previous messages are added so that the model maintains the consistency of the dialog (and its memory of the conversation).
  5. User prompt: The current user prompt is usually placed at the end. This is due, among other reasons, to the so-called recency bias: models tend to pay special attention to the most recent instructions before generating the response.

High-precision prompts engineering: the art of detailing

To avoid mediocre results, a well-known maxim in technology applies: rubbish in, rubbish out. If the input is poor, confusing or incomplete, the output will probably be as well. It is not enough to ask: “Analyze this contract”.

An expert Compliance Director would draft much more precise instructions, including several elements:

  • Detailed context: Explain the regulatory situation, type of contract, applicable jurisdiction and industry-specific risks.
  • Explicit restrictions: For example, “do not make assumptions about the laws of jurisdictions outside the European Union” or “do not use overly technical language if the recipient is a non-legal client”.
  • Structured reasoning: Ask the model to decompose the problem into logical steps before reaching a conclusion. This does not mean that it must show all of its internal reasoning, but it must organize the answer in a verifiable way.
  • Cognitive pauses and reflection: Expressions such as “work step by step” can improve the result in some complex tasks, because they push the model to better structure the answer. It is not magic. It is a way to guide the generation toward a more orderly solution.
  • Self-criticism: The model can also be instructed to review its own output. For example: “Indicate what information is missing to reach absolute certainty” or “point out the assumptions you have made and what part of the answer depends on them”.

This type of instructions forces the system to be more cautious and transparent, especially in tasks where error can have important consequences.

The duality of hallucinations: critical error and creative wonder.

Hallucinations-moments when the AI generates false data with complete confidence-should not be understood solely as a failure of the developers. They are also a byproduct of the statistical performance of these models.

AI does not search for truth as a human researcher would. It predicts likely sequences of text. Sometimes those sequences are correct, useful and brilliant. Other times they are plausible, but false.

Risk cases and zero tolerance

In critical tasks, such as medical report writing, legal analysis, safety auditing or review of regulatory requirements, hallucinations are unacceptable. An error in a technical data can invalidate an entire compliance process. A fabricated legal reference can make a report lose credibility. A mistaken security recommendation can expose a real system.

In these cases, a zero tolerance should be indicated to the model: “If you do not find the answer in the documents provided, indicate ‘I don’t know’ instead of inventing an answer”. This simple instruction may seem minor, but it completely changes the usefulness of the system. In professional environments, an incomplete and honest answer is often better than a fancy, long and false answer.

Hallucination as a creative catalyst

However, in other contexts, that same ability to deviate from the existing can become a powerful tool.

In new drug discovery, generative models can propose molecular structures that do not appear in any previous database. Some of these proposals will be useless, but others may open promising lines of research.

In art, design, creative writing or concept generation, AI’s ability to make unexpected connections can produce ideas that break with the usual molds.

The key is to adjust the use of the model according to the task. For a security audit, we need precision, traceability and prudence. For a creativity session, we can allow more freedom. It is not the same game, and therefore the same rules should not apply.

Energy Sustainability and the Mixture of Experts (MoE) model

AI processing has a real physical cost. It doesn’t happen in an ethereal cloud, but in data centers full of servers, specialized chips, cooling systems and huge power requirements.

Estimates vary by source and year analyzed, but the trend is clear: data center power consumption is growing strongly, driven in part by the expansion of generative AI.

The Electric Power Research Institute (EPRI) estimated that data centers in the United States consumed about 184 TWh in 2024, and its most recent scenarios project that they could account for 9% to 17% of U.S. electricity by 2030.

These figures should be read with caution, because they depend on assumptions about new site construction, hardware efficiency, cooling, inference demand and actual deployment of AI applications.

Efficiency through MoE

To mitigate this impact, architectures such as MoE have been developed.

Instead of behaving as a monolithic block that activates all its parameters for any given task, a MoE model is divided into specialized sub-networks, called “experts”. A routing mechanism decides which experts should be activated for each token or task.

  • Dispersed activation: For a simple writing task, the system can activate only certain linguistic experts, leaving other modules less relevant to that operation idle.
  • Computational savings: This selective activation allows to increase the total size of the model without activating all its parameters in each query. In practical terms, a model can have a huge capacity, but use only a fraction of it in each inference step.

The core idea of MoE is precisely that: to scale the capacity of the model without each operation having to pay the full cost of activating the entire network. Companies and technology institutions describe this dispersed activation as one of the keys to improving the efficiency of very large models.

However, this does not mean that the model “thinks” like a person or that it consciously activates internal resources. What happens is more technical: the system selects processing routes according to learned patterns. So when we use advanced reasoning modes or instructions that force a more analytical response, we are usually asking the model to spend more inference time and more internal or external computational steps to solve the problem. The result is usually more expensive and slower, but can also be more reliable on difficult tasks.

The paradigm shift: from free access to local AI

During these years we are enjoying a period of relatively cheap, and even free, access to very powerful models. However, we should not assume that this situation will be permanent.

Inference costs, pressure on electrical infrastructure, enterprise demand and the concentration of specialized hardware may lead to a scenario where more advanced capabilities are increasingly tied to subscription plans, usage limits or pay-as-you-go models.

Against this backdrop, local AI andopen source models acquire strategic importance.

Not everyone needs to run models locally. For many users, a commercial subscription will suffice. But for professionals who work with sensitive information, private documents or large volumes of text, being able to run models on your own computer can be a significant advantage in privacy, cost and control.

How to save tokens and money

For those using paid APIs (Application Programming Interface), there are straightforward strategies to reduce token consumption:

  • Eliminate unnecessary courtesies: Avoiding formulas such as “please” or “thank you very much” in repetitive tasks can save input tokens and reduce decorative responses. Models do not need politeness to work.
  • Master English when it makes sense: Since many tokenizers are more efficient in English, writing long instructions in English and asking for a final translation can be cheaper than doing the whole process in Spanish, especially for large tasks. You can write your instructions in Spanish, ask another free model to translate them into English, and use the result to paste it into your paid model. And the same with the response.  
  • Increase text density: Writing in a straightforward manner, without redundancies or circular explanations, optimizes each processing unit.
  • Use efficient formats: Clear structures with tags, such as …, can help delimit information and reduce ambiguity. In some cases, they are cleaner than excessive formatting in Markdown.
  • Separate instructions from content: It is not the same to tell the model what to do as it is to give him/her the material to work on. The clearer this separation is, the less likely the model will confuse rules with information.

The local ecosystem: Ollama, LM Studio and AnythingLLLM

If suitable hardware is available - for example, a computer with good RAM, a sufficient GPU or a modern chip with integrated acceleration - it is possible to run AI models locally.

  • Ollama: Allows you to download and run models such as Llama, Mistral or DeepSeek in a simple way locally. It works as a kind of private AI server on your own computer.
  • LM Studio: Provides a visual interface for testing different models and quantizations. It can also act as a local API for other applications to connect to the model.
  • AnythingLLM: It is a very useful tool for creating local RAG systems. It allows indexing personal documents and chatting with them without those files necessarily having to leave the computer. Total privacy.

Such tools do not always achieve the performance of the most advanced commercial models, but they have a huge advantage: control. Control over the data, over the cost, over the models and over the workflow architecture.

Foundational models, frontier models and automation

For a company, distinguishing between types of models is not an academic question. It is a strategic decision.

  • Foundational models: These are the general bases, trained with huge volumes of data to be multi-purpose. Examples of this category are families such as GPT, Claude, Gemini, Llama or Mistral, each with its own characteristics, licenses and capabilities.
  • Frontier models: These are the ones that set the current limit of what is possible. They usually offer advanced reasoning, multimodal capabilities, better understanding of context, use of tools, code generation or complex analysis that has not yet become standard.
  • Specialized models: These are models adjusted for specific tasks, such as document classification, legal analysis, cybersecurity, customer service or code generation.

The right question is not always “what is the most powerful model?”. Many times, the right question is “what is the sufficient, cheapest, most private and easiest to integrate model for this particular use case?”.

Automation with APIs, webhooks and MCPs

Tools such as n8n, Zapier or Make allow AI to move from being a simple chatbot to becoming an integrated part of an automated workflow.

  • API: It is the bridge that allows a tool like n8n to ask an AI model to perform a task. It is an on-demand communication: “do this and give me back the result”.
  • Webhook: This is an automatic notification between systems. For example, if you receive an email or a new form is published, that event can trigger a flow in n8n without anyone having to manually check for updates.
  • MCP (Model Context Protocol): This is an emerging standard that makes it easier for AI to use external tools in a more structured way. For example, searching for information, consulting files, interacting with databases or executing actions in connected applications. Without you programming anything, the AI decides which is the best tool, among those you have indicated, to use to accomplish the task you have assigned it.

The combination of these elements completely changes the role of the AI. We are no longer talking about just asking it to write a response. We are talking about integrating it into real processes: reviewing documents, sorting emails, preparing drafts, comparing versions, consulting internal sources or generating draft reports.

Case study: automation, expert authoring and editorial review

To illustrate the power of these integrated technologies, let’s think about a real workflow that I have used.

On one occasion, I used n8n combined with MCP and a RAG system containing my own book manuscript on cybersecurity and privacy. Using the DeepSeek API, the system was able to generate a draft article for me while maintaining my original tone, style and depth of the text.

The process operated under a human-in-the-loop scheme, i.e., with mandatory human intervention at critical points:

  1. The AI extracted context from the book using RAG.
  2. It generated a draft following the previously defined style.
  3. It placed it as a draft in the CMS from which I create articles like this one.
  4. It then set me up with broadcast messages for Telegram, Facebook, X and LinkedIn.
  5. Only after my review and human approval, the system could run the publication or make everything ready for final publication.

This level of automation allowed me to see that it was possible to produce technical content with very little effort. However, it also made clear an important personal conclusion: just because something can be automated does not mean it should be automated.

In my case, I decided to keep writing as a manual activity. Not out of rejection of technology, but precisely out of respect for the creative process. Writing forces me to think, order ideas, find examples, detect contradictions and convert technical knowledge into an understandable explanation.

If I delegated that part completely, I could create hundreds of articles in record time, and the result might even look like mine, but it would no longer be mine in the main.

Where I do use AI on a regular basis is as editorial support and proofreader. That is, after writing the content, I can give it the text to act as an editor: to separate it into sections, propose appropriate titles, correct typos, improve punctuation, detect sentences that are too long, and check the overall coherence of the article.

It can also help me turn a block of spontaneously written ideas into a clearer structure for the reader. But the raw material - the ideas, the approach, the experience, the opinions and the intention of the text - remains genuinely mine.

This difference is fundamental. Using AI to replace authorship is not the same as using it to improve the presentation of a real authorship. In the first case, the tool displaces the author. In the second, it helps the author to express himself better.

That’s why, for me, AI is not an automatic article factory. Rather, it is a tireless editor, a patient proofreader and an assistant capable of detecting errors that sometimes slip through the cracks when you’ve been looking at the same text for too long.

Conclusion: AI as a major enabler

The integration of AI into business and professional life is not a simple incremental improvement. It is a profound transformation in the way we think, work, analyze information and produce knowledge.

For a few euros per month - either through a subscription or by purchasing tokens - any professional can access a support capability that would have been unthinkable before. They can ask for help in reviewing a contract, analyzing a technical document, summarizing a standard, preparing a presentation, proofreading a text, generating hypotheses or exploring complex scenarios.

But the key is to understand its role.

AI should not be treated as an infallible oracle. Nor as a universal substitute for human judgment. Its true value comes when it is used as an amplifier: a tool that enhances knowledge, speeds up repetitive tasks, improves clarity and allows more time to be spent on what really matters.

Professionals who learn to combine their expertise with these tools will have an advantage that is hard to ignore. Not because AI will magically make them experts, but because it will enable them to work with more speed, more depth and more contrast capability.

AI will not replace all experts, although it will gradually destroy more jobs at all levels. But until that happens, experts who know how to use AI will, in many areas, replace those who refuse to incorporate it into the way they work.

The question is no longer whether these synthetic minds will be part of our daily lives. The question is whether we will learn to integrate them with judgment, responsibility and human sense.