<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ricardo Moya on Medium]]></title>
        <description><![CDATA[Stories by Ricardo Moya on Medium]]></description>
        <link>https://medium.com/@richardmoya?source=rss-89a82c02d9e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MYvKNxr5_Cgye8pbTipg4Q.png</url>
            <title>Stories by Ricardo Moya on Medium</title>
            <link>https://medium.com/@richardmoya?source=rss-89a82c02d9e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:07:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@richardmoya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LangChain: Things I Wish I Knew Before Getting Started (Part I)]]></title>
            <link>https://medium.com/@richardmoya/langchain-things-i-wish-i-knew-before-getting-started-part-i-12af6956a063?source=rss-89a82c02d9e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/12af6956a063</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[lcel]]></category>
            <category><![CDATA[langchain]]></category>
            <dc:creator><![CDATA[Ricardo Moya]]></dc:creator>
            <pubDate>Sat, 21 Feb 2026 16:32:46 GMT</pubDate>
            <atom:updated>2026-02-21T16:54:00.956Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66cOWRxX1LyJ7R8dlxPtOA.png" /><figcaption>Generated by NanoBanana</figcaption></figure><blockquote><a href="https://jarroba.com/en/langchain-runnables-lcel-part-i/">https://jarroba.com/en/langchain-runnables-lcel-part-i/</a></blockquote><p>When you start learning a new framework, it’s easy to feel overwhelmed by the sheer number of concepts, components, and possibilities it offers. <strong>LangChain</strong> is no exception; it’s a broad and deep ecosystem that goes far beyond simply “writing prompts”.</p><p>That’s why, when I explore libraries like LangChain, it helps me a lot to <strong>build a mental model</strong> to <strong>understand</strong> what its <strong>key pieces</strong> are, how they fit together, and what <strong>real problems they solve</strong> inside a system. Without that conceptual map, it’s easy to get lost among classes and isolated examples.</p><p>In this post I want to share the <strong>mental model</strong> I’ve been building, with the goal of helping you <strong>understand what LangChain really is</strong>, how to use it with good judgement, and what kinds of architectures it adds value to. I’ll try to support each concept with small self-contained code snippets, although some points (due to their complexity) will require a more conceptual approach than a purely practical one.</p><blockquote><strong><em>NOTE:</em></strong> In this post (Part I) I’ll list the components I consider key to understanding LangChain, but I’ll only explain the first 6 in detail with examples. In the next parts (Part II, Part III and Part IV) I’ll go deeper into the remaining components and concepts.</blockquote><h3>Before we start: Is LangChain a library?</h3><p><strong>No — LangChain is not “a library”</strong>. And this distinction matters more than it seems. <strong>LangChain is a modular framework for orchestrating LLMs</strong>. It is composed of several packages with clearly separated responsibilities. Understanding this structure avoids confusion when you start installing dependencies or designing an architecture.</p><p>We can split the ecosystem into <strong>“3+1” main blocks</strong>:</p><ol><li><strong>LangChain Core</strong>: This is the stable core of the framework. It contains the fundamental abstractions such as:<br>Runnable, PromptTemplate, ChatPromptTemplate, Parsers, Composition with LCEL, etc. Install it with:</li></ol><pre>pip install langchain</pre><p><strong>2. LangChain Community</strong>: This contains community-maintained integrations with external services that are not part of the core, such as:<br>Chroma, Qdrant, PyPDFLoader, WebBaseLoader, experimental integrations, etc. Install it with:</p><pre>pip install langchain-community</pre><p><strong>3. Partner Packages</strong>: These are official connectors maintained in collaboration with LLM providers. They implement direct integration with commercial APIs such as<br>OpenAI, Gemini, Claude, DeepSeek, etc. Each provider is installed separately:</p><pre>pip install langchain-openai<br>pip install langchain-google-genai<br>pip install langchain-anthropic<br>pip install langchain-deepseek</pre><p>4. (+1) <strong>Complementary libraries</strong>: LangChain doesn’t live alone. In real systems, it’s often combined with libraries for building RAG pipelines, indexing systems, structured validation, or interactive deployments, etc. Some of these libraries include:<br>chromadb, faiss-cpu, pypdf, beautifulsoup4, pydantic, streamlit, fastapi, langchain-huggingface, sentence-transformers, tiktoken, etc., and each one has its own independent installation.</p><p>Understanding this modularity from day one changes how you work with the framework: you don’t “install LangChain”, you design a system made of interoperable pieces. Schematically, we can represent it like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GKh1hHFb0H2ls8gk.png" /><figcaption>Image generated by NanoBanana</figcaption></figure><h3>Concept index</h3><p>In this series of posts I’m going to cover the following <strong>key concepts</strong> to understand and <strong>use LangChain</strong> effectively:</p><ol><li><strong>What is an LLM?</strong></li><li><strong>LLM APIs and providers</strong></li><li><strong>Runnables</strong></li><li><strong>LCEL</strong></li><li><strong>PromptTemplate, ChatPromptTemplate &amp; Placeholder</strong></li><li><strong>MessagesPlaceholder</strong></li><li><strong>Document Loaders</strong></li><li><strong>Text Splitters</strong></li><li><strong>Embeddings</strong></li><li><strong>Vector databases</strong></li><li><strong>Retrievers</strong></li><li><strong>RAG</strong></li><li><strong>Pydantic</strong></li><li><strong>Streamlit</strong></li></ol><h3>1. What is an LLM?</h3><p>An <strong>LLM</strong> (Large Language Model) is a model that takes a text input called a <strong>Prompt</strong> and generates a natural-language answer. In order for the model to process the prompt, the text is converted into <strong>tokens</strong>, which are the smallest units of text an LLM understands and generates. A <strong>Token</strong> can be a whole word, a fragment, a space, or a symbol. As a rough reference, 1,000 tokens correspond to about 750 words (1 token ≈ 0.75 words). LLM providers measure and bill model usage based on the total number of tokens processed.</p><p>LLMs operate within a <strong>Context Window</strong>, which is the total amount of information the model can handle in a single interaction. This window includes the current prompt, the previous conversation history, and the tokens the model is generating as output; the sum of all of them cannot exceed the model’s maximum limit.</p><p>After receiving the prompt, <strong>Inference</strong> begins: the model generates output sequentially (token by token), progressively building coherent text until it completes the answer or reaches the set limit. The generated text is called the <strong>Completion</strong> (Prompt + Generated text).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kE1OK9tHAi54pel_.png" /></figure><p>As a comparative reference, the following table shows some representative models on the market, along with their context window and approximate costs per million tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*nAQUYWFd7YQowj-mMr07-g.png" /></figure><p>Summary of the key concepts related to LLMs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*mLyqlbDgfge0ISxpcytCAw.png" /></figure><h3>2. LLM APIs and providers — OpenAI, Gemini, Anthropic, DeepSeek, …</h3><p>The first step to building any system with LLMs is being able to invoke them correctly.</p><p>LangChain provides official API integrations with the main providers. Each offers different models, limits, usage policies, costs, etc. From an architectural point of view, they are all consumed as remote services exposing an HTTP endpoint and billing by the volume of processed tokens (input + output). Provider list: <a href="https://docs.langchain.com/oss/python/integrations/chat">https://docs.langchain.com/oss/python/integrations/chat</a></p><p>To use them you typically need to:</p><ol><li>Create an account on the provider’s platform.</li><li>Generate an API key.</li><li>Configure that key in your environment (usually as an environment variable).</li><li>Have enough credit, since billing is done per consumed token.</li></ol><p>In practice, all providers follow the same economic model: the more tokens you send and generate, the higher the cost. That’s why it’s important to design for efficiency from the start.</p><p>If you’re just getting started, Google Gemini can be a good option because it typically offers a limited free quota that lets you experiment without an upfront cost. However, this post won’t cover signup steps or API key generation; for that, check each provider’s official documentation.</p><p>Here are the signup links for the main platforms:</p><ul><li>OpenAI: <a href="https://openai.com/es-ES/api/">https://openai.com/es-ES/api/</a></li><li>Google Gemini: <a href="https://aistudio.google.com/app/api-keys">https://aistudio.google.com/app/api-keys</a></li><li>Anthropic: <a href="https://platform.claude.com/">https://platform.claude.com/</a></li><li>DeepSeek: <a href="https://platform.deepseek.com/">https://platform.deepseek.com/</a></li></ul><p>To use a chat model in LangChain, you first choose the provider and then install the corresponding package:</p><pre>pip install langchain-openai<br>pip install langchain-google-genai<br>pip install langchain-anthropic<br>pip install langchain-deepseek</pre><p>Each of these packages implements its own ChatModel class, but they all share a common interface and a very similar set of parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*rbGRVjaLG5-E-aIl_-Rrdw.png" /></figure><blockquote><strong><em>IMPORTANT NOTE:</em></strong> Never pass the api_key as a parameter in code. Set it as an environment variable ( OPENAI_API_KEY, GOOGLE_API_KEY, etc.).</blockquote><p>Below is the code to instantiate LLMs from different providers:</p><h3>OpenAI</h3><pre>from langchain_openai import ChatOpenAI<br><br>llm = ChatOpenAI(model=&quot;gpt-4o-mini&quot;, temperature=0.2, timeout=30, max_retries=2)</pre><h3>Google (Gemini)</h3><pre>from langchain_google_genai import ChatGoogleGenerativeAI<br><br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)</pre><h3>Anthropic (Claude)</h3><pre>from langchain_anthropic import ChatAnthropic<br><br>llm = ChatAnthropic(model=&quot;claude-3-5-sonnet-latest&quot;, temperature=0.2, timeout=30)</pre><h3>DeepSeek</h3><pre>from langchain_deepseek import ChatDeepSeek<br><br>llm = ChatDeepSeek(model=&quot;deepseek-chat&quot;, temperature=0.2, timeout=30, max_retries=2)</pre><p>Notice that in all cases we assign the instance to the variable llm. This makes it possible to switch providers without changing the rest of the system. A clean way to do that is to centralise model construction:</p><pre>from langchain_openai import ChatOpenAI<br>from langchain_google_genai import ChatGoogleGenerativeAI<br>from langchain_anthropic import ChatAnthropic<br>from langchain_deepseek import ChatDeepSeek<br><br><br>def build_llm(provider: str, temperature: float = 0.2, timeout: int = 30, max_retries: int = 2):<br>    provider = provider.lower()<br>    if provider == &quot;openai&quot;:<br>        return ChatOpenAI(model=&quot;gpt-4o-mini&quot;, temperature=temperature, timeout=timeout, max_retries=max_retries)<br>    elif provider == &quot;google&quot;:<br>        return ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=temperature, timeout=timeout, max_retries=max_retries)<br>    elif provider == &quot;anthropic&quot;:<br>        return ChatAnthropic(model=&quot;claude-3-5-sonnet-latest&quot;, temperature=temperature, timeout=timeout, max_retries=max_retries)<br>    elif provider == &quot;deepseek&quot;:<br>        return ChatDeepSeek(model=&quot;deepseek-chat&quot;, temperature=temperature, timeout=timeout, max_retries=max_retries)<br>    else:<br>        raise ValueError(&quot;Unsupported provider. Use: openai | google | anthropic | deepseek&quot;)</pre><p>This way, your architecture is decoupled from the provider and you can switch models without rewriting your pipeline.</p><h3>3. Runnables — LangChain’s base interface</h3><p>In LangChain, almost everything is a <strong>Runnable</strong>: models, prompts, retrievers, parsers, or even custom functions.</p><p>A Runnable is the <strong>framework’s base execution interface</strong>. It defines how any component runs: it <em>takes an input</em>, <em>performs an operation</em>, and <em>returns an output</em>. The standard way to execute it is via the <strong>invoke()</strong> method.</p><p>All Runnables implement the same execution interface:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*vWYi7QnR7u_JJO9z4HmZkA.png" /></figure><p>This implies something fundamental: <strong>an LLM, a Retriever, or a custom function are executed in exactly the same way</strong>. The architecture becomes homogeneous.</p><p>Let’s look at a simple example invoking a model with <strong>invoke()</strong>, the most common way to execute a Runnable:</p><pre>from langchain_google_genai import ChatGoogleGenerativeAI<br><br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br>out = llm.invoke(&quot;Who was the first person to receive more than one Nobel Prize?&quot;)<br><br>print(out.content)<br># The first person to receive more than one Nobel Prize was Marie Curie ...</pre><p>In this case, <strong>llm</strong> is simply a Runnable. It takes a string as input, calls the model, and returns an AIMessage object whose text we access via .content.</p><p>Understanding that everything in LangChain is a Runnable is key: it means any system component can be executed, combined, and replaced following the exact same pattern.</p><h3>4. LCEL — building the execution pipeline</h3><p>If <strong>Runnables</strong> are LangChain’s basic building blocks, <strong>LCEL (LangChain Expression Language)</strong> is the mechanism that lets you connect them to build an execution pipeline.</p><p>LCEL is a declarative syntax that mainly uses the <strong>|</strong> operator to chain Runnables. Conceptually, each <strong>|</strong> means the output of one component becomes the input of the next. In other words:</p><pre>input -&gt; Runnable1 -&gt; Runnable2 -&gt; ... -&gt; output</pre><p>We’re not writing step-by-step procedural code. We’re declaring a data transformation flow.</p><p>Below is a practical example where we chain an LLM with a custom function ( <strong>Runnable</strong>) that turns the output into uppercase:</p><pre>from langchain_google_genai import ChatGoogleGenerativeAI<br>from langchain_core.runnables import RunnableLambda<br><br># 1.- Instantiate the LLM<br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br><br># 2.- Create a Runnable that transforms the output to uppercase<br>to_upper = RunnableLambda(lambda msg: msg.content.upper())<br><br># 3.- Chain both Runnables (input -&gt; llm -&gt; to_upper -&gt; output)<br>chain = llm | to_upper<br><br># 4.- Run it<br>out = chain.invoke(&quot;Who was the first person to receive more than one Nobel Prize?&quot;)<br>print(out)<br># THE FIRST PERSON TO RECEIVE MORE THAN ONE NOBEL PRIZE WAS MARIE CURIE ...</pre><p><strong>What’s really happening in </strong><strong>chain = llm | to_upper?</strong></p><ol><li>The <strong>input</strong> (a string) goes into the LLM.</li><li>The LLM returns an <strong>AIMessage</strong>.</li><li>That <strong>AIMessage</strong> automatically flows to the next Runnable (<strong>to_upper</strong>).</li><li><strong>to_upper</strong> transforms the content to uppercase.</li><li>The final result is the pipeline output.</li></ol><p>In short, LCEL turns a set of isolated components into a declarative, composable pipeline, allowing you to build more complex systems without leaving the same execution pattern.</p><h3>5. PromptTemplates, ChatPromptTemplates &amp; Placeholders</h3><p>PromptTemplates let you define dynamic prompts as <strong>reusable artefacts</strong>, instead of scattering static text throughout the code. In practice they act as an <strong>input contract</strong>: they make explicit what variables the model needs and under what rules it should respond. This improves maintainability and makes behaviour more consistent.</p><p>Here we’ll see what a PromptTemplate and a ChatPromptTemplate are, introducing the idea of a <strong>Root Prompt</strong> and the use of <strong>placeholders</strong>.</p><p>To understand the <strong>Root Prompt</strong>, think about how you start a conversation in ChatGPT, Claude, Gemini, etc. You often begin with a first message that specifies:</p><ul><li>Role or personality</li><li>Rules and constraints</li><li>Answering style</li><li>Persistent context</li></ul><p>For example, we could write something like:</p><pre>You are an assistant specialised in football (soccer).<br><br>Rules:<br>- Respond in English, as spoken in Texas.<br>- Explain concepts in a simple way.<br>- Use analogies when possible.<br>- Don’t give generic answers; be concrete and direct.<br>- Answers must be brief, no more than 100 words.<br><br>Question:<br>What is offside?</pre><p>That first message is the <strong>Root Prompt</strong>: it defines identity, tone, and boundaries, and it influences the entire interaction that follows.</p><p>The key idea is that this <strong>Root Prompt can be made reusable and dynamic with a template</strong>. The rules could stay the same, but the topic and the question could change. That’s where <strong>placeholders</strong> come in: variables inside the prompt that get replaced with concrete values at runtime.</p><p>A PromptTemplate is exactly that: a <strong>text template with placeholders</strong> that lets you keep the base structure (identity and rules) and change only what&#39;s variable (topic, question) without rewriting the prompt.</p><p>In <strong>LangChain</strong> you do it with PromptTemplate like this:</p><pre>from langchain_core.prompts import PromptTemplate<br>from langchain_google_genai import ChatGoogleGenerativeAI<br><br># LLM<br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br><br># Prompt as a contract<br>prompt = PromptTemplate(<br>    template=&quot;&quot;&quot;<br>You are an assistant specialised in {topic}.<br>Rules:<br>- Respond in English, as spoken in Texas.<br>- Explain concepts in a simple way.<br>- Use analogies when possible.<br>- Don’t give generic answers; be concrete and direct.<br>- Answers must be brief, no more than 100 words.<br><br>Question: {question}<br>&quot;&quot;&quot;,<br>    input_variables=[&quot;topic&quot;, &quot;question&quot;]<br>)<br><br># LCEL (input -&gt; prompt -&gt; llm -&gt; output)<br>chain = prompt | llm<br><br># Run the pipeline with different questions while keeping the same input contract<br>response = chain.invoke({<br>    &quot;topic&quot;: &quot;Machine Learning&quot;,<br>    &quot;question&quot;: &quot;Overfitting&quot;<br>})<br><br>print(response.content)<br># Overfitting is when your Machine Learning model fits the training data too well...<br># It’s like a student memorising answers from an old exam instead of understanding the subject...</pre><p>This way, the template defines the contract (required variables) and you can reuse the same “mould” with different inputs. The limitation is that PromptTemplate fits <strong>single-message</strong> scenarios well, but it&#39;s less suitable when you need multi-turn conversations, history, examples, and explicit roles - that&#39;s where ChatPromptTemplate comes in.</p><p>ChatPromptTemplate builds the prompt as a <strong>sequence of messages</strong>, where each one has a role ( <em>system, human, ai,</em> etc.). This matters because the model interprets a system instruction, a user question, and a previous answer differently, and that structure improves coherence in conversational systems.</p><p>The most common predefined roles are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*XeR6AUJHZdQv4sCHxiDS7g.png" /></figure><p>An example with ChatPromptTemplate would be:</p><pre>from langchain_core.prompts import ChatPromptTemplate<br>from langchain_google_genai import ChatGoogleGenerativeAI<br><br># LLM<br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br><br># ChatPromptTemplate as a structured contract<br>chat_prompt = ChatPromptTemplate.from_messages([<br><br>    # SYSTEM role → Root Prompt (identity + global rules)<br>    (&quot;system&quot;, &quot;&quot;&quot;<br>            You are an assistant specialised in {topic}.<br><br>            Rules:<br>            - Respond in English, as spoken in Texas.<br>            - Explain concepts in a simple way.<br>            - Use analogies when possible.<br>            - Don’t give generic answers; be concrete and direct.<br>            - Answers must be brief, no more than 100 words.<br>    &quot;&quot;&quot;),<br><br>    #### Conversation history: persistent context ####<br>    (&quot;human&quot;, &quot;What is a supervised model?&quot;),<br>    (&quot;ai&quot;, &quot;It’s like learning with a coach who checks your work. You get examples with the right answer, and the model adjusts until it can get it right on its own.&quot;),<br>    #### End of persistent context ####<br><br>    # Dynamic input<br>    (&quot;human&quot;, &quot;{question}&quot;)<br>])<br><br># LCEL (input -&gt; chat_prompt -&gt; llm -&gt; output)<br>chain = chat_prompt | llm<br><br>response = chain.invoke({<br>    &quot;topic&quot;: &quot;Machine Learning&quot;,<br>    &quot;question&quot;: &quot;What is overfitting?&quot;<br>})<br><br>print(response.content)<br># Overfitting is when the model learns the training data way too well...<br># Then you change the inputs a little, and it struggles because it memorised instead of generalising...</pre><p>The practical difference is that the contract is expressed as a conversation: the Root Prompt lives in system, the persistent context is represented with human/ai messages, and the current input enters as human with a placeholder.</p><p>In short, <strong>PromptTemplate and ChatPromptTemplate turn prompts into maintainable artefacts</strong>: they declare input contracts, separate rules from business logic, and let you reuse system behaviour consistently — from simple cases to complex conversations.</p><h3>6. MessagesPlaceholder and few-shot</h3><p>An <strong>LLM has no built-in memory</strong>. It <strong>does not remember</strong> previous interactions and it <strong>does not learn from each conversation</strong>, because it is <strong>not retrained</strong> in real time. However, in apps like ChatGPT, Gemini, or Claude it can feel like it “remembers” what you said before. This happens because <strong>each request includes the new question plus the conversation history</strong> (context).</p><p>Remember: an LLM is just a model that <strong>generates text from an input text</strong> (a prompt). Nothing more. The responsibility for <strong>how that prompt is built and managed lies in the system you develop</strong>. Designing context correctly is what lets you build applications that appear to have memory, coherence, and continuity over time.</p><p>For this task, LangChain offers MessagesPlaceholder, a special type of placeholder used to represent <strong>message history inside a ChatPromptTemplate</strong>. Instead of inserting raw text, MessagesPlaceholder formats and structures the conversation history appropriately so the model can interpret it correctly.</p><p>Below is a practical example using MessagesPlaceholder to include multi-turn history and then ask a new question that depends on that context:</p><pre>from langchain_google_genai import ChatGoogleGenerativeAI<br>from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder<br>from langchain_core.messages import HumanMessage, AIMessage<br><br># LLM<br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br><br># Conversational prompt with history<br>prompt = ChatPromptTemplate.from_messages([<br>    (&quot;system&quot;, &quot;&quot;&quot;<br>            You are an assistant specialised in {topic}.<br><br>            Rules:<br>            - Respond in Texan English, as spoken in Texas.<br>            - Explain concepts in a simple way.<br>            - Use analogies when possible.<br>            - Don’t give generic answers; be concrete and direct.<br>            - Answers must be brief, no more than 100 words.<br>    &quot;&quot;&quot;),<br>    MessagesPlaceholder(variable_name=&quot;history&quot;),<br>    (&quot;human&quot;, &quot;{question}&quot;)<br>])<br><br># Conversation history (4 full iterations)<br>history = [<br>    HumanMessage(content=&quot;Hey, what is supervised learning?&quot;),<br>    AIMessage(content=&quot;It’s like learning with a coach who gives you exercises with the right answers and corrects you until you can do it yourself.&quot;),<br><br>    HumanMessage(content=&quot;And what is a model?&quot;),<br>    AIMessage(content=&quot;It’s like a mathematical rule that tries to capture a pattern: it takes inputs and transforms them into an output.&quot;),<br><br>    HumanMessage(content=&quot;And what does training the model mean?&quot;),<br>    AIMessage(content=&quot;It means adjusting its internal parameters using examples, like practising a lot until it becomes second nature.&quot;),<br><br>    HumanMessage(content=&quot;And what happens if it practises too much on the same examples?&quot;),<br>    AIMessage(content=&quot;It might start memorising them instead of learning the general idea.&quot;)<br>]<br><br># LCEL<br>chain = prompt | llm<br><br># New question that depends on context<br>resp = chain.invoke({<br>    &quot;topic&quot;: &quot;Machine Learning&quot;,<br>    &quot;history&quot;: history,<br>    &quot;question&quot;: &quot;So, what is overfitting in this context?&quot;<br>})<br><br>print(resp.content)<br># Overfitting is when the model becomes great at the data it already saw and basically memorises it...<br># But when you give it new data, it gets confused because it didn’t learn the general pattern.</pre><p>With this approach we can <strong>control context programmatically</strong> however we want: limiting the number of messages, summarising history, removing irrelevant or sensitive content, or applying any strategy that optimises quality and token cost.</p><p>Another key technique to improve model behaviour is <strong>few-shot prompting</strong> (few-shot learning). Instead of adding more instructions, we show concrete input/output examples.</p><p>For instance, we might ask the model to generate meeting minutes from a transcript and include examples of transcripts with their corresponding minutes. This guides the model towards a specific format, style, or pattern. With ChatPromptTemplate and MessagesPlaceholder, adding examples is as simple as <strong>adding human/ai pairs to the history</strong>.</p><p>Here’s a typical few-shot example where the model classifies texts by sentiment (positive, negative, or neutral) based on examples included in the history:</p><pre>from langchain_google_genai import ChatGoogleGenerativeAI<br>from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder<br>from langchain_core.messages import HumanMessage, AIMessage<br><br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br><br>prompt = ChatPromptTemplate.from_messages([<br>    (&quot;system&quot;, &quot;Classify the sentiment as: POSITIVE, NEGATIVE, or NEUTRAL. Reply with the label only.&quot;),<br>    MessagesPlaceholder(variable_name=&quot;examples&quot;),<br>    (&quot;human&quot;, &quot;Text: {text}&quot;)<br>])<br><br>examples = [<br>    HumanMessage(content=&quot;I love this product&quot;),<br>    AIMessage(content=&quot;POSITIVE&quot;),<br>    HumanMessage(content=&quot;The service was terrible&quot;),<br>    AIMessage(content=&quot;NEGATIVE&quot;),<br>    HumanMessage(content=&quot;It’s what I expected, nothing more, nothing less&quot;),<br>    AIMessage(content=&quot;NEUTRAL&quot;),<br>]<br><br>chain = prompt | llm<br><br>resp = chain.invoke({<br>    &quot;examples&quot;: examples,<br>    &quot;text&quot;: &quot;This works pretty well, but it could be better.&quot;<br>})<br><br>print(resp.content)<br># NEUTRAL</pre><p>In conclusion, MessagesPlaceholder and <strong>few-shot</strong> are not about &quot;adding more text&quot;. They&#39;re about controlling the context you pass to the LLM. History adds continuity and coherence, while examples shape behaviour and format.</p><p>Designing which messages go into the prompt, in what order, and for what purpose is what turns a simple text generator into a system that feels intelligent, consistent, and aligned with your expectations.</p><h3>Conclusion</h3><p>In this first part we’ve covered the <strong>fundamental concepts to understand what LangChain is</strong>, how it’s organised, and what problems it actually solves. We’ve seen it isn’t a monolithic library, but <strong>a modular ecosystem</strong> made up of distinct pieces with clear responsibilities.</p><p>We’ve learned how to <strong>invoke an LLM</strong> and why everything in LangChain revolves around the <strong>Runnable</strong> interface, which standardises execution. From there, we saw how <strong>LCEL</strong> lets you build declarative and composable pipelines, and how PromptTemplate and ChatPromptTemplate turn prompts into explicit, maintainable contracts inside your architecture.</p><p>Finally, we learned that conversational coherence isn’t real memory. It’s <strong>context management</strong>, supported by MessagesPlaceholder. We also saw how model behaviour can be guided effectively with <strong>few-shot</strong> examples. With these six pillars clear, you now have the <strong>minimum mental map to start designing LLM systems</strong> with architectural judgement.</p><h3>Bonus Track: Build a chat model with LangChain using the concepts covered</h3><p>With everything we’ve covered, let’s <strong>implement a console chat using Gemini + LangChain</strong>.</p><p>Once you run the code below, you’ll choose a conversation topic (for example, “Machine Learning”) and then you’ll be able to ask questions about that topic like a ChatGPT-style chat.</p><p>To help you see what is actually being sent to the model, on each turn we’ll print the system message (Root Prompt), the conversation history (context), and the current question. That way you can understand how the prompt is built on every interaction and how the model uses context to generate coherent answers.</p><pre># Console chat with Gemini + LangChain.<br># On each turn it prints what is sent to the LLM: system + history + question.<br><br>from langchain_google_genai import ChatGoogleGenerativeAI<br>from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder<br>from langchain_core.messages import HumanMessage, AIMessage<br><br>topic = input(&quot;Conversation topic: &quot;).strip() or &quot;Machine Learning&quot;<br><br>llm = ChatGoogleGenerativeAI(model=&quot;gemini-2.5-flash&quot;, temperature=0.2)<br><br>prompt = ChatPromptTemplate.from_messages([<br>    (&quot;system&quot;, f&quot;You are an expert assistant in {topic}. Reply in British English, brief and clear, with answers under 30 words.&quot;),<br>    MessagesPlaceholder(&quot;history&quot;),<br>    (&quot;human&quot;, &quot;{question}&quot;)<br>])<br><br>history = []<br><br>print(&quot;\nType &#39;exit&#39; to quit.&quot;)<br><br>while True:<br>    question = input(&quot;You: &quot;).strip()<br>    if question.lower() == &quot;exit&quot;:<br>        break<br><br>    # Exact messages sent to the LLM (system + history + question)<br>    messages = prompt.format_messages(history=history, question=question)<br><br>    print(&quot;\n--- SENT TO THE LLM ---&quot;)<br>    for m in messages:<br>        role = m.__class__.__name__.replace(&quot;Message&quot;, &quot;&quot;).lower()<br>        print(f&quot;[{role}] {m.content}&quot;)<br><br>    # Call the LLM<br>    resp = llm.invoke(messages)<br><br>    print(&quot;--- RESPONSE ---&quot;)<br>    print(resp.content)<br><br>    # Update history (this is the “context”)<br>    history += [HumanMessage(content=question), AIMessage(content=resp.content)]</pre><p>Below is an example of how the console interaction would look:</p><pre>Conversation topic:  Machine Learning<br>Type &#39;exit&#39; to quit.<br>You: What is supervised learning?<br>--- SENT TO THE LLM ---<br>[system] You are an expert assistant in Machine Learning. Reply in British English, brief and clear, with answers under 30 words.<br>[human] What is supervised learning?<br>--- RESPONSE ---<br>It learns from labelled data (input-output pairs) to predict or classify new data, aiming to map inputs to the correct outputs.<br><br><br>You: What is a model?<br>--- SENT TO THE LLM ---<br>[system] You are an expert assistant in Machine Learning. Reply in British English, brief and clear, with answers under 30 words.<br>[human] What is supervised learning?<br>[ai] It learns from labelled data (input-output pairs) to predict or classify new data, aiming to map inputs to the correct outputs.<br>[human] What is a model?<br>--- RESPONSE ---<br>A trained function or algorithm that predicts or classifies. It represents the knowledge extracted during learning.<br><br><br>You: And what does training the model mean?<br>--- SENT TO THE LLM ---<br>[system] You are an expert assistant in Machine Learning. Reply in British English, brief and clear, with answers under 30 words.<br>[human] What is supervised learning?<br>[ai] It learns from labelled data (input-output pairs) to predict or classify new data, aiming to map inputs to the correct outputs.<br>[human] What is a model?<br>[ai] A trained function or algorithm that predicts or classifies. It represents the knowledge extracted during learning.<br>[human] And what does training the model mean?<br>--- RESPONSE ---<br>It means adjusting internal parameters using data so the model learns patterns and makes accurate predictions or classifications.<br><br><br>You: What is overfitting?<br>--- SENT TO THE LLM ---<br>[system] You are an expert assistant in Machine Learning. Reply in British English, brief and clear, with answers under 30 words.<br>[human] What is supervised learning?<br>[ai] It learns from labelled data (input-output pairs) to predict or classify new data, aiming to map inputs to the correct outputs.<br>[human] What is a model?<br>[ai] A trained function or algorithm that predicts or classifies. It represents the knowledge extracted during learning.<br>[human] And what does training the model mean?<br>[ai] It means adjusting internal parameters using data so the model learns patterns and makes accurate predictions or classifications.<br>[human] What is overfitting?<br>--- RESPONSE ---<br>The model fits the training data too closely, losing its ability to generalise to unseen data and producing poor predictions.</pre><p><em>Originally published at </em><a href="https://jarroba.com/en/langchain-runnables-lcel-part-i/"><em>https://jarroba.com</em></a><em> on February 21, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12af6956a063" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top papers that made the LLM era possible — jarroba.com]]></title>
            <link>https://medium.com/@richardmoya/top-papers-that-made-the-llm-era-possible-jarroba-com-7727170de13f?source=rss-89a82c02d9e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7727170de13f</guid>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[open-source-ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai]]></category>
            <dc:creator><![CDATA[Ricardo Moya]]></dc:creator>
            <pubDate>Sun, 26 Oct 2025 15:33:30 GMT</pubDate>
            <atom:updated>2026-02-03T16:12:02.138Z</atom:updated>
            <content:encoded><![CDATA[<h3>Top papers that made the LLM era possible</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-pUogGmgKPtOKk71.png" /></figure><blockquote><a href="https://jarroba.com/en/top-papers-that-made-the-llm-era-possible/">https://jarroba.com/en/top-papers-that-made-the-llm-era-possible/</a></blockquote><p>Throughout history, major technological breakthroughs tend to follow a clear pattern: <strong>first, invention</strong>, born from research; <strong>then industrialization</strong>, which makes the idea scalable and useful;<strong> then optimization</strong>, which perfects it and reduces costs. This cycle can be seen in different moments in history such as <strong>penicillin</strong>, the <strong>steam engine</strong>, or the <strong>microprocessor</strong>. Scientific advances that, after their appearance, evolved from a scientific discovery into widely used solutions.</p><p>The recent evolution of <strong>LLMs (Large Language Models)</strong> clearly fits this pattern. First came the <strong>invention</strong>, with research that laid the foundations — such as the Transformer architecture in 2017 — . Then came the <strong>industrialization</strong>, with increasingly larger and more powerful models, and later, optimization, which reduced costs and expanded capabilities. We are now living a stage of <strong>democratization</strong>, in which these technologies are opening up to companies and users around the world (in the developed world).</p><p>In this article I will present (in my opinion and based on my knowledge) <strong>the key scientific papers</strong> that have driven each stage of development, showing how research has been the engine that has taken LLMs to their current expansion.</p><h3>🧠 1. Invention (2017–2019) — Transformers, the foundation of the revolution</h3><blockquote>In 1928, when Alexander Fleming discovered penicillin, he did not single-handedly cure every disease, but he laid the scientific foundations of modern antibiotic medicine, which over time would save hundreds of millions of lives.</blockquote><p>Something similar -although in a very different field- happened in 2017 with the publication of<strong> <em>Attention Is All You Need</em></strong>, Google’s paper that introduced <strong>Transformers</strong>, a new neural network architecture that established the <strong>scientific base</strong> on which the entire LLM revolution has been built.</p><h3>📄 Attention Is All You Need — June 2017</h3><p>📎 <a href="https://arxiv.org/abs/1706.03762">https://arxiv.org/abs/1706.03762</a></p><p>This paper introduced the<strong> Transformer architecture</strong>, a much more computationally efficient and more accurate approach than the sequential models (RNN and LSTM) used up to that point. Its great innovation was the use of <strong>attention mechanisms</strong>, which make it possible to process text in parallel and capture more deeply the <strong>semantic relationships</strong> between words and phrases. This capability not only <strong>improved performance</strong> in language understanding and generation tasks, but also <strong>enabled scalability</strong>, allowing <strong>larger models to be trained</strong> more efficiently.</p><h3>📄 BERT: Pre-training of Deep Bidirectional Transformers — October 2018</h3><p>📎 <a href="https://arxiv.org/abs/1810.04805">https://arxiv.org/abs/1810.04805</a></p><p><strong>BERT</strong> (Bidirectional Encoder Representations from Transformers) is a language model developed by Google. Before it appeared, most models read text in a single direction -left to right or right to left- which limited their ability to understand the full context of a sentence.</p><p>BERT changed this approach by introducing a <strong>bidirectional model</strong>, capable of “reading” simultaneously in both directions, thus better understanding the meaning of each word according to its context.</p><p>The paper also proposed a method to <strong>pre-train the model on large volumes of text</strong> (as if someone were being taught to read) and then <strong>easily fine-tune it for different tasks</strong> (as if someone who can read uses reading to learn how to solve “something”): text classification, sentiment analysis, or question answering. Thanks to this strategy, <strong>the same model could be reused across multiple applications.</strong></p><h3>📄 T5: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer — October 2019</h3><p>📎 <a href="https://arxiv.org/abs/1910.10683">https://arxiv.org/abs/1910.10683</a></p><p>T5 (Text-to-Text Transfer Transformer) is a model developed by Google that took the idea one step further. While many previous models required <strong>different architectures for each task</strong> -for example, one for classifying text, another for answering questions, another for translating- T5 proposed unifying everything into a single “text-to-text” framework.</p><p>The idea was simple: <strong>any language problem could be framed as generating text from other text</strong>. For example, if the task was translation, you would provide a text and ask for its translation; if it was question answering, you would provide the question and it would have to generate the answer, etc.</p><p>This approach greatly simplified the architecture and <strong>made it much easier to reuse a single model for multiple tasks</strong>, anticipating the logic of today’s LLMs: a single general-purpose model that can adapt to different uses with minimal adjustments.</p><h3>🚀 2. Industrialization (2020–2021) — The great expansion of AI</h3><blockquote>When James Watt improved the steam engine in 1769, he did not invent thermal energy or steam, but he managed to scale that technology and turn it into the engine of an entire industrial revolution.</blockquote><p>Something similar happened with <strong>LLMs</strong> starting in 2020. Transformers already existed, but it was in this stage that research focused on <strong>how to make them grow</strong>, training them with <strong>enormous volumes of data</strong> and <strong>large computational resources</strong>, showing that <strong>as their size increased, so did their capability</strong>. This is the stage in which LLMs stopped being experimental prototypes and became global technological infrastructure.</p><p>Below, we’ll look at some of the key papers that marked this leap and defined this new stage:</p><h3>📄 Scaling Laws for Neural Language Models — January 2020</h3><p>📎 <a href="https://arxiv.org/abs/2001.08361">https://arxiv.org/abs/2001.08361</a></p><p>This paper, developed by OpenAI, formulated the <strong>Scaling Laws</strong>, showing that the <strong>performance</strong> of language models <strong>improves as their size, the amount of training data, and compute increase</strong>. This finding provided <strong>a solid empirical foundation</strong> that not only <strong>justified the push toward ever-larger models</strong>, but also <strong>set a roadmap for the entire industry</strong>. For OpenAI, it represented a strategic inflection point, as it helped attract large-scale investment and laid the groundwork for the development of GPT-3 and, later, ChatGPT, driving a new phase in the history of generative AI.</p><h3>📄 Language Models are Few-Shot Learners (GPT-3) — May 2020</h3><p>📎 <a href="https://arxiv.org/abs/2005.14165">https://arxiv.org/abs/2005.14165</a></p><p>The <strong>GPT-3</strong> paper, developed by OpenAI, showed for the first time that a language model -with 175 billion parameters- could <strong>perform multiple tasks without needing to be retrained</strong>, simply from a few examples included in the prompt. This phenomenon, known as <strong>“few-shot learning”</strong>, demonstrated that as model size increases, models also gain<strong> the ability to adapt to different tasks</strong>, showing skills for which <strong>they had not been trained directly</strong>.</p><p>This discovery was a turning point in the evolution of LLMs, laying the conceptual foundations of what would later become ChatGPT.</p><h3>📄 Retrieval-Augmented Generation (RAG) — May 2020</h3><p>📎 <a href="https://arxiv.org/abs/2005.11401">https://arxiv.org/abs/2005.11401</a></p><p>The <strong>RAG</strong> paper, developed by Meta AI, introduced a key idea: <strong>combining language models with external sources of information</strong>. Until that point, LLMs could only generate answers based on what they learned during training, effectively “freezing” their knowledge to the data seen in that stage.</p><p>RAG proposed a different approach: allowing the model to <strong>“consult” external knowledge bases in real time</strong>, retrieving relevant documents to use as input (prompting) and generating an informed answer.</p><p>Imagine an LLM was trained with documents produced up to January 1, 2025, including the official football rulebook. If a new version of the rules is published on January 15 with new or modified regulations, an RAG-based system could incorporate that new text into an external database and answer questions according to the updated rules, without having to retrain the model (which is extremely expensive).</p><p>In this way, the model not only “remembers,” but also “searches” (through the use of <strong>embeddings</strong>), improving accuracy and keeping information up to date. This approach marked a fundamental step toward <strong>modern systems that integrate LLMs with search engines, databases, or external APIs</strong>, paving the way for assistants that combine linguistic reasoning with dynamic access to information.</p><h3>📄 Switch Transformers: Scaling to Trillion Parameter Models — January 2021</h3><p>📎 <a href="https://arxiv.org/abs/2101.03961">https://arxiv.org/abs/2101.03961</a></p><p>The <strong>Switch Transformers</strong> paper, developed by Google, tackled one of the major challenges in LLMs: the <strong>enormous computational cost of training.</strong> As models grew in size, training them became increasingly expensive and slow. This work proposed an ingenious solution: activating only a specific part of the model instead of using it in full.</p><p>The idea is based on a <strong>mixture of experts</strong> architecture, where the model contains multiple specialized “blocks” or <strong>neural sub-networks, activating only the most relevant ones for each input</strong>. Thus, even if the full model has trillions of parameters, only a fraction is used per forward pass, drastically reducing compute consumption without sacrificing accuracy or quality.</p><p>Imagine a large company with thousands of employees: instead of gathering everyone for every decision, you consult only the people who know the topic best. The model works the same way, dynamically selecting the most suitable “experts” (neural sub-networks) based on the input text.</p><p>This approach made it possible to <strong>train and run models far more efficiently and sustainably</strong>, marking a before-and-after in LLM design. It also introduced a principle that remains key today: it’s not only about building bigger models, but also about making them smarter in how they use their resources.</p><h3>📄 LoRA: Low-Rank Adaptation of Large Language Models — June 2021</h3><p>📎 <a href="https://arxiv.org/abs/2106.09685">https://arxiv.org/abs/2106.09685</a></p><p><strong>LoRA</strong>, developed by Microsoft, proposed a revolutionary way to adapt already-trained LLMs without having to retrain them end-to-end. Until then, retraining an LLM meant updating all of its parameters, which was extremely expensive.</p><p>LoRA offered an elegant solution: <strong>keep the original model frozen and add small trainable layers</strong> within its architecture. These layers learn from the new training data, and their outputs <strong>are combined with those of the original model during inference</strong>, allowing customization without altering the general knowledge.</p><p>In other words, LoRA showed that it wasn’t necessary to retrain the whole model to teach it something new; it was enough to add small, lightweight, and efficient adaptations. This approach dramatically reduced costs and simplified LLM adaptation, making it possible for smaller organizations to customize LLMs without incurring major expenses. In practice, LoRA democratized fine-tuning and opened the door to a new generation of more specialized and accessible models.</p><p>With advances such as Scaling Laws, GPT-3, RAG, Switch Transformer, and LoRA, LLMs reached the level of maturity needed to jump into real products. We see this in tools like ChatGPT, Claude, DeepSeek, GitHub Copilot, etc., which have already been integrated into our day-to-day lives.</p><h3>🛠 3. Optimization (2022–2024) — Improved and made cheaper</h3><blockquote>In 1947, Bardeen, Brattain, and Shockley invented the transistor, forming the technological foundation on which modern microprocessors were built. That innovation laid the groundwork for the creation of the Intel 4004 in 1971, the first microprocessor with 2,300 integrated transistors. Since then, the history of computing has been a race to optimize and reduce costs, making chips increasingly powerful, compact, and accessible, leading to processors like the Intel Core i7 that integrate billions of transistors.</blockquote><p>Something similar happened once tools based on <strong>LLMs</strong> had been built. The challenge became <strong>improving them and making them more efficient and useful for people</strong>. Between 2022 and 2024, research focused on three fronts: <strong>improving</strong> model <strong>efficiency</strong> through optimization techniques, giving them <strong>greater functionality</strong> with reasoning capabilities and the use of external tools, and achieving<strong> better interaction with people</strong>.</p><p>The result was a qualitative leap: LLMs stopped being limited to generating text and became <strong>useful, accurate, and collaborative systems</strong>. Let’s look at some of the key papers:</p><h3>📄 LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale — August 2022</h3><p>📎 <a href="https://arxiv.org/abs/2208.07339">https://arxiv.org/abs/2208.07339</a></p><p>This paper introduced a key technique in the area of <strong>quantization</strong> to reduce the size and computational cost of LLMs. Quantization consists of <strong>reducing the numerical precision</strong> with which models store and process their parameters -that is, using numbers with fewer decimal places-. This way, values take up less memory and operations run much faster. The challenge is that, as precision is reduced, models tend to lose accuracy and quality in their outputs.</p><p><strong>LLM.int8()</strong> showed that it was possible to apply <strong>8-bit quantization</strong> without significantly degrading performance, even in models with billions of parameters. Its innovation was a <strong>hybrid quantization</strong> strategy that used 8 bits for most computations and 16 bits only in cases with atypical activations (outliers), where numerical values are especially large.</p><p>This approach cut memory usage by roughly half and made it possible to run large models on a single GPU, enabling high-scale LLM work in a much more accessible and cost-effective way.</p><p>Overall,<strong> LLM.int8()</strong> became a benchmark in model optimization, showing that progress does not always depend on building bigger models, but on <strong>making them more efficient and smarter in their use of resources</strong>.</p><h3>📄 Training language models to follow instructions with human feedback (InstructGPT) — March 2022</h3><p>📎 <a href="https://arxiv.org/abs/2203.02155">https://arxiv.org/abs/2203.02155</a></p><p>In this paper, OpenAI transformed the way language models relate to people. The work focused on making <strong>LLMs provide answers more like those a human would give</strong>, introducing the method <strong>Reinforcement Learning from Human Feedback (RLHF)</strong>: a process in which human evaluators rate and compare the model’s answers, providing examples of how it should behave under different instructions.</p><p>From that feedback, the model learns to <strong>prioritize clearer, safer, and more useful responses</strong>, adjusting its behavior toward what people actually expect. The result was a model that not only predicts words, but understands and follows instructions (Instruct) coherently.</p><p><strong>InstructGPT</strong> showed that optimizing LLMs depends not only on technical efficiency, but also on their <strong>ability to communicate and interact more naturally with people</strong>, making AI more understandable, cooperative, and human-like.</p><h3>📄 Parameter-Efficient Fine-Tuning in Large Models (PEFT) — November 2024</h3><p>📎 <a href="https://arxiv.org/html/2410.19878v2">https://arxiv.org/html/2410.19878v2</a></p><p>This survey (a review of different research papers) compiles and analyzes the main techniques for <strong>Parameter-Efficient Fine-Tuning</strong> (PEFT). These techniques emerged to address a key problem: <strong>how to adapt LLMs without retraining all of their parameters</strong>, which is extremely costly in time and resources.</p><p>The study brings together methods such as <strong>LoRA, Prompt Tuning, Prefix-Tuning, and P-Tuning</strong>, all with a common goal: <strong>customize a large model by modifying only a small fraction of its parameters</strong>. Thanks to these approaches, LLMs can solve new tasks -such as text classification, sentiment analysis, or code generation- quickly and efficiently, without losing the general knowledge learned previously.</p><p>Overall, this work consolidated an essential research area for the practical optimization of LLMs, making their adaptation flexible, modular, and affordable, enabling more organizations to leverage their potential without relying on large infrastructures.</p><h3>📄 The Rise and Potential of Large Language Model Based Agents: A Survey — September 2023</h3><p>📎 <a href="https://arxiv.org/abs/2309.07864">https://arxiv.org/abs/2309.07864</a></p><p>This survey analyzes the rise of <strong>language agents (LLM Agents)</strong>, a new generation of LLM-based systems that not only generate text, but also <strong>reason, plan, and act</strong> autonomously. Agents are composed of several elements that allow them to interact more intelligently with their environment:</p><ul><li><strong>Core model (LLM):</strong> the nucleus that interprets instructions and generates reasoning or plans.</li><li><strong>Memory:</strong> stores information from past interactions to maintain context and coherence.</li><li><strong>External tools:</strong> allow the agent to access search engines, databases, or APIs to obtain information or execute actions.</li><li><strong>Planner:</strong> breaks down a complex goal into logical steps and decides when and which actions to take.</li></ul><p>Thanks to this modular structure, LLM agents can <strong>solve complex tasks, learn from context, and execute actions in real time</strong>. The study consolidated the concept of the “agent” within the LLM ecosystem and marked a key step toward more autonomous and practical systems.</p><p>Although today the term “intelligent agent” may sound modern, its origins go back to the 1980s within the field of artificial intelligence. As an anecdote from the author of these lines, I took a university course called Intelligent Agents in the 2009/2010 academic year. I remember perfectly that on January 27, 2010, the professor canceled the class for that course because it coincided with an event that would later prove “historic”: Steve Jobs’ presentation of the iPad.</p><p>With the advances shown, <strong>LLMs reached a new level of maturity.</strong> It was no longer only about making them bigger, but about <strong>making them more useful, faster, and more efficient</strong>. This phase consolidated the technical foundation on which today’s most advanced models are built, paving the way for their expansion and global adoption.</p><h3>🤝 4. Democratization (2023–2025) — LLMs open up to the world</h3><p>In February 2023, Meta AI <strong>released LLaMA</strong>, its LLM model. With this decision, language models stopped being a technology reserved for large companies and became an <strong>open and collaborative resource</strong>.</p><p>Other companies followed its example: Mistral AI with <strong>Mistral 7B</strong> (September 2023), Google with <strong>Gemma</strong> (February 2024), or DeepSeek AI with <strong>DeepSeek-V2</strong> (May 2024), among others. Some released only the model, and others also released its source code, under more or less restrictive licenses, but all contributed to <strong>expanding access and experimentation</strong>.</p><p>The release of these models triggered a true revolution, enabling developers and organizations to adapt them to areas as diverse as education, medicine, or law. Platforms like <strong>Hugging Face</strong> also played a key role by facilitating the sharing of trained and specialized models, consolidating themselves as the major meeting point of the open-source ecosystem. In this way, an <strong>open and collaborative environment</strong> emerged, where innovation no longer depends only on large corporations, but also on a global community that experiments, improves, and shares knowledge.</p><p>Below, we show the “technical reports” and information for the open models from Meta, Mistral, and DeepSeek:</p><h3>📄 LLaMA — Meta AI (2023–2025)</h3><ul><li><strong>LLaMA</strong> (February 2023) 📎 <a href="https://arxiv.org/abs/2302.13971">https://arxiv.org/abs/2302.13971</a>: First LLaMA model, designed with public data and high efficiency. Its release allowed the scientific community to access, for the first time, a competitive model developed by a large company.</li><li><strong>LLaMA 2</strong> (July 2023) 📎 <a href="https://arxiv.org/abs/2307.09288">https://arxiv.org/abs/2307.09288</a>: Second generation of LLaMA, which included conversational versions (chat models) and licenses that even allowed commercial use, greatly expanding its adoption.</li><li><strong>LLaMA 3</strong> (July 2024) 📎 <a href="https://arxiv.org/abs/2407.21783">https://arxiv.org/abs/2407.21783</a>: Third generation with improvements in performance, alignment, and scalability. It consolidated LLaMA as one of the pillars of the open LLM ecosystem.</li><li><strong>LLaMA 4</strong> (April 2025) 📎 <a href="https://ai.meta.com/blog/llama-4-multimodal-intelligence/">https://ai.meta.com/blog/llama-4-multimodal-intelligence/</a>: Fourth generation introducing a Mixture-of-Experts (MoE) architecture, multimodal capability (text, image, video), and ultra-long contexts.</li></ul><h3>📄 Mistral AI (2023–2025)</h3><p>A European company that became one of the leading drivers of open models, betting on efficiency and accessibility.</p><ul><li><strong>Mistral 7B</strong> (September 2023) 📎 <a href="https://arxiv.org/abs/2310.06825">https://arxiv.org/abs/2310.06825</a>: A 7-billion-parameter model under the Apache 2.0 license. Its optimized architecture (grouped-query attention and sliding-window attention) made it stand out against larger models.</li><li><strong>Mixtral 8×7B</strong> (December 2023): A Mixture of Experts (MoE) model that combines eight 7B experts, activating only those needed for each task, improving efficiency without losing quality.</li><li><strong>Voxtral Technical Report</strong> (July 2025): Extends the focus toward speech understanding and multimodal models.</li></ul><h3>📄 DeepSeek AI — (2024–2025)</h3><p>From China, DeepSeek AI emerged as one of the most solid and ambitious open-source projects, standing out for its efficiency and specialization.</p><ul><li><strong>DeepSeek-Coder</strong> (January 2024) 📎 <a href="https://arxiv.org/abs/2401.14196">https://arxiv.org/abs/2401.14196</a>: A model specialized in programming and code generation, trained on a massive dataset of public repositories.</li><li><strong>DeepSeek-V2</strong> (May 2024) 📎 <a href="https://arxiv.org/abs/2405.04434">https://arxiv.org/abs/2405.04434</a>: Introduces a Mixture of Experts architecture with “Multi-Head Latent Attention” and DeepSeekMoE, optimizing performance and computational cost.</li><li><strong>DeepSeek-R1</strong> (January 2025) 📎 <a href="https://arxiv.org/abs/2501.12948">https://arxiv.org/abs/2501.12948</a>: Explores logical reasoning with a technique called Reinforcement Learning with Reasoning Feedbacks (RLRF), which encourages more structured steps of thought.</li></ul><p>In just a few years, <strong>LLMs have gone from being an academic experiment to becoming one of the biggest technological transformations of our time</strong>. From their invention with the Transformer to their opening to the public with projects like LLaMA, Mistral, or DeepSeek, AI has evolved from the lab to everyday use, changing the way we learn, work, and create.</p><p>Today, <strong>LLMs</strong> represent much more than a tool: <strong>they are a new language between humans and machines</strong>, an open space where innovation emerges from global collaboration.</p><h3>List of the papers mentioned in the article in chronological order:</h3><ul><li><strong>Attention Is All You Need</strong> — Jun 2017: <a href="https://arxiv.org/abs/1706.03762">https://arxiv.org/abs/1706.03762</a></li><li><strong>BERT: Pre-training of Deep Bidirectional Transformers</strong> — Oct 2018: <a href="https://arxiv.org/abs/1810.04805">https://arxiv.org/abs/1810.04805</a></li><li><strong>T5: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer</strong> — Oct 2019: <a href="https://arxiv.org/abs/1910.10683">https://arxiv.org/abs/1910.10683</a></li><li><strong>Scaling Laws for Neural Language Models</strong> — Jan 2020: <a href="https://arxiv.org/abs/2001.08361">https://arxiv.org/abs/2001.08361</a></li><li><strong>Language Models are Few-Shot Learners (GPT-3)</strong> — May 2020: <a href="https://arxiv.org/abs/2005.14165">https://arxiv.org/abs/2005.14165</a></li><li><strong>Retrieval-Augmented Generation (RAG)</strong> — May 2020: <a href="https://arxiv.org/abs/2005.11401">https://arxiv.org/abs/2005.11401</a></li><li><strong>Switch Transformers: Scaling to Trillion Parameter Models</strong> — Jan 2021: <a href="https://arxiv.org/abs/2101.03961">https://arxiv.org/abs/2101.03961</a></li><li><strong>LoRA: Low-Rank Adaptation of Large Language Models</strong> — Jun 2021: <a href="https://arxiv.org/abs/2106.09685">https://arxiv.org/abs/2106.09685</a></li><li><strong>Training language models to follow instructions with human feedback (InstructGPT)</strong> — Mar 2022: <a href="https://arxiv.org/abs/2203.02155">https://arxiv.org/abs/2203.02155</a></li><li><strong>LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale</strong> — Aug 2022: <a href="https://arxiv.org/abs/2208.07339">https://arxiv.org/abs/2208.07339</a></li><li><strong>The Rise and Potential of Large Language Model Based Agents: A Survey</strong> — Sep 2023: <a href="https://arxiv.org/abs/2309.07864">https://arxiv.org/abs/2309.07864</a></li><li><strong>Parameter-Efficient Fine-Tuning in Large Models (PEFT)</strong> — Nov 2024: <a href="https://arxiv.org/html/2410.19878v2">https://arxiv.org/html/2410.19878v2</a></li></ul><p><em>Originally published at </em><a href="https://jarroba.com/en/top-papers-that-made-the-llm-era-possible/"><em>https://jarroba.com</em></a><em> on October 26, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7727170de13f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>