<?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 Ela on Medium]]></title>
        <description><![CDATA[Stories by Ela on Medium]]></description>
        <link>https://medium.com/@elanajafi?source=rss-b13932067432------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*f1bYbfZjzgqySnnsE3b8tQ.jpeg</url>
            <title>Stories by Ela on Medium</title>
            <link>https://medium.com/@elanajafi?source=rss-b13932067432------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 11:09:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elanajafi/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[From Aristotle’s Logic to NLP and Large Language Models: A Historical Journey]]></title>
            <link>https://medium.com/@elanajafi/from-aristotles-logic-to-nlp-and-large-language-models-a-historical-journey-443cd587e719?source=rss-b13932067432------2</link>
            <guid isPermaLink="false">https://medium.com/p/443cd587e719</guid>
            <dc:creator><![CDATA[Ela]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 20:27:24 GMT</pubDate>
            <atom:updated>2026-10-11T20:27:24.585Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction: the ancient question behind modern AI</h3><p>Natural language processing (NLP), knowledge graphs, and large language models (LLMs) seem modern, but they connect to an old question:</p><p><strong>How can I reason correctly?</strong></p><p>The question goes back to ancient Greek philosophy, especially <strong>Aristotle’s logic</strong>. Aristotle studied how terms and statements relate. Over time, logic developed into mathematical systems, while linguistics, statistics, and computer science developed their own methods. These fields eventually came together in AI.</p><p>This was not a straight line from Aristotle to ChatGPT. It was a meeting of different ideas. Here is the whole journey in one picture. Each step is a new way of <strong>representing</strong> reasoning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muAUwlqg51BWhUzsMG47jQ.png" /><figcaption><em>Figure 1. </em>From terms to vectors: six ways of representing reasoning, from Aristotle’s logic to modern LLMs.</figcaption></figure><h4><strong>From terms to propositions</strong></h4><p>Aristotle’s term logic focuses on categories and relationships between terms. For example:</p><ul><li>All humans are mortal.</li><li>Socrates is human.</li><li>Therefore, Socrates is mortal.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2g0fPall5HK85uRQ4rL9-g.png" /><figcaption><em>Figure 2. Polar bears ⊆ Animals ⊆ Living things. Groups inside groups is the core idea of the syllogism.</em></figcaption></figure><p>The reasoning works because Socrates belongs to the category human, and humans belong to the category mortal. This idea of <strong>organizing concepts into categories</strong> later became taxonomies, ontologies, databases, and knowledge graphs. A hierarchy like <strong>Animal → Human → Doctor</strong> is also a <strong>tree</strong>, one of the most important structures in computer science.</p><h4>The Stoics: from terms to statements</h4><p>The <strong>Stoics</strong> developed <strong>propositional logic</strong>, where the basic unit is a whole statement that is true or false:</p><ul><li>“It is raining” becomes <strong>P</strong></li><li>“It is raining AND it is cold” becomes <strong>P ∧ Q</strong></li><li>“If it is raining, then the ground is wet” becomes <strong>P → Q</strong></li></ul><p>The question moves from “how do these terms relate?” to also asking “how do these statements relate?” Now reasoning can be studied apart from the particular words used. This became very important for mathematics and computer science.</p><h4><strong>From logic to mathematics and computing</strong></h4><p>Later thinkers, including medieval scholars, <strong>Leibniz</strong>, and nineteenth-century algebraic logicians, asked something bolder: <strong>can reasoning itself be written as a formal system?</strong> The more exactly reasoning is written down, the closer we get to <strong>mechanizing</strong> it.</p><p><strong>Frege and the language of modern logic</strong></p><p>In the nineteenth century, <strong>Gottlob Frege</strong> helped create modern <strong>predicate logic</strong>. It can describe relations between objects:</p><ul><li>“John loves Mary” becomes <strong>Loves(John, Mary)</strong></li><li>“Every doctor treats some patient” becomes</li><li><strong>∀x(Doctor(x) → ∃y(Patient(y) ∧ Treats(x,y)))</strong></li></ul><p>Now we have objects, predicates, relations, variables, and quantifiers. This is close to the math language that computer science later used.</p><h4><strong>Logic becomes computable</strong></h4><p><strong>Terms → Statements → Logical formulas → Mathematical structures → Computational representations</strong></p><p>Once knowledge is written formally, a machine can change it by following rules. This is the center of <strong>symbolic AI</strong>: if knowledge can be represented formally, a machine can manipulate it using explicit rules.</p><p><strong><em>Note:</em></strong><em> Logic matters to computing not just because “computers use logic.” It matters because logic gives us ways to </em><strong><em>represent information and inference</em></strong><em> in forms that algorithms can run.</em></p><h4><strong>From formal logic to natural language</strong></h4><p>But a problem remained: <strong>what about ordinary human language?</strong> Predicate logic is powerful, but Fred Sommers believed something valuable was lost when the older term approach was dropped. In <em>The Logic of Natural Language</em> (1982), he explored how Aristotelian term logic could be rebuilt using modern formal methods while staying closer to the structure of everyday language. His central question was:</p><p><strong>Can Aristotle’s term logic be rebuilt with modern formal tools while staying close to natural language?</strong></p><p>MIT Press describes his work as a revival of Aristotelian syllogistic logic, leading to <em>The Logic of Natural Language</em> (1982). The title explains itself: it is <strong>old</strong>, because it returns to Aristotle, and <strong>new</strong>, because it is rebuilt with modern logical methods.</p><h4><strong>Fred Sommers: connecting logic with natural language</strong></h4><p>Sommers showed that term logic can be written like <strong>simple algebra</strong>, often called <strong>Term Functor Logic</strong>:</p><ul><li>“Every X is Y” is written <strong>−X + Y</strong></li><li>“Some X is Y” is written <strong>+X + Y</strong></li></ul><p>Now a syllogism becomes a sum:</p><p>The signs represent logical roles within the system. This approach aims to preserve the connection between logical structure and ordinary language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RL-f0_oO0_jG-Oy2wqxWcQ.png" /><figcaption><em>Figure 3. </em>A syllogism as algebra: adding −H + M and −G + H cancels the middle term H and leaves −G + M.</figcaption></figure><p>The important question is: Can we represent the structure of language mathematically without losing how its terms relate?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HR7b4_ODPGrNB0sEjQuJmg.png" /><figcaption><em>Figure 4. </em>A simplified tree of categories: a predicate fits its own node and everything below it, so “the number seven is asleep” is nonsense.</figcaption></figure><h4><strong>From categories to knowledge graphs</strong></h4><p>Grouping concepts into categories is also important in computing. For example:</p><p>Living things → Animals → Polar bears</p><p>These relationships can be represented as trees, taxonomies, and ontologies. A knowledge graph goes further by connecting entities through different relationships. For example:</p><p>Doctor → treats → Patient</p><p>These structures help computers store, connect, and retrieve explicit information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHWRoNmFtaVN8_Aqp6SydQ.png" /><figcaption><em>Figure 5. </em>Parse tree of “The doctor examined the patient”: a sentence splits into a noun phrase and a verb phrase.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cTL6Y5w7sl34L2HjCiXrCw.png" /><figcaption><em>Figure 6. A tree shows one kind of link (“is a”). A knowledge graph shows many kinds of links between many things.</em></figcaption></figure><h4><strong>From language to NLP and large language models</strong></h4><p>NLP aims to help computers process human language. Earlier approaches relied heavily on rules and symbolic representations. Later approaches increasingly used statistics and machine learning to identify patterns in text.</p><p>Modern language models learn statistical patterns from large amounts of text. They represent words and other text units as numerical vectors, allowing the model to capture patterns and relationships in context.</p><p>However, LLMs do not simply apply Aristotle’s logic. They learn patterns through training and can produce useful reasoning, but they can also make logical errors or generate false information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32MLVBp-mIPbIu-zoEhg8g.png" /><figcaption><em>Figure 7. </em>From hand-written rules to learned models: the shift from symbolic NLP to statistical NLP, neural networks, Transformers, and LLMs.</figcaption></figure><h4><strong>Neural networks learn representations</strong></h4><p>Instead of storing <em>doctor</em> as one symbolic node, a neural model stores it as a <strong>vector</strong>, a list of numbers:</p><p><strong>Doctor → [0.21, −0.47, 0.83, …]</strong></p><p>This is called an <strong>embedding</strong>. If two words are used in similar contexts, their vectors end up near each other in the learned space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mQpYf3-MTGpt72t8lYWeXQ.png" /><figcaption><em>Figure 8. </em>Words as points in space: similar meanings (doctor, physician, nurse) cluster together, away from apple, pear, and banana. Cosine similarity measures the angle between two word vectors. A small angle means similar meaning.</figcaption></figure><p>Now compute this for every pair of words. The result is a <strong>similarity matrix</strong> (a heatmap). Darker cells mean higher cosine similarity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*aRldbpal9K1shtRe3kk_YA.png" /><figcaption><em>Figure 9. </em>Cosine similarity matrix with illustrative numbers: high within the medical and fruit groups, near zero between them.</figcaption></figure><p>Two blocks of high similarity appear along the diagonal, one for medical words and one for fruit words. The cells between the groups are close to zero. This is how a model “knows” that <em>doctor</em> and <em>physician</em> are related while <em>doctor</em> and <em>banana</em> are not.</p><p><strong><em>Note:</em></strong><em> All numbers in the heatmap are </em><strong><em>illustrative</em></strong><em>, made up to show the pattern. Real similarity scores depend on the model and its training data.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u-xoB907t4xDeytoFRzfLg.png" /><figcaption><em>Figure 10. </em>Attention: when reading “she,” the model gives the most weight to “doctor” and “patient.” Thicker lines mean more attention.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRoU6oTdjyxfTiyB4TfXTQ.png" /><figcaption>Figure 11. Next-token prediction with illustrative probabilities: the model scores every possible next word and favors the most likely one.</figcaption></figure><p>During training, the model adjusts <strong>billions of numbers (parameters)</strong> so its guesses improve. From this one simple goal comes a system that can write, answer questions, summarize, translate, and write code.</p><p><strong><em>Important note:</em></strong><em> An LLM is </em><strong><em>not</em></strong><em> Aristotle’s logic implemented in a computer. Mechanically, it is a </em><strong><em>probabilistic, statistical, neural system</em></strong><em>. It does not normally prove things through explicit deductions. It learns patterns from data and predicts what comes next.</em></p><h4><strong>Conclusion</strong></h4><p>The history from Aristotle to NLP is not just a story of stronger technology. It is a history of <strong>representation</strong>.</p><p>We moved from asking how concepts and statements relate, to finding math that can describe those relations, to building structures machines can handle, and finally to systems that <strong>learn their own representations from data</strong>.</p><p>The deeper problem stays the same:</p><p><strong><em>How can information be represented, how are its parts related, and what can we infer or predict from those relations?</em></strong></p><p>The ancient question has not disappeared. We have simply built more powerful mathematical and computational ways of asking it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=443cd587e719" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAG Empowering AI : Enhancing Generative Pre-Trained Large Language Models (LLMs)]]></title>
            <link>https://medium.com/@elanajafi/rag-empowering-ai-enhancing-generative-pre-trained-large-language-models-llms-0d57230f955d?source=rss-b13932067432------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d57230f955d</guid>
            <dc:creator><![CDATA[Ela]]></dc:creator>
            <pubDate>Thu, 11 Jan 2024 06:32:04 GMT</pubDate>
            <atom:updated>2024-01-11T06:32:04.986Z</atom:updated>
            <content:encoded><![CDATA[<h3>RAG Empowering AI : Enhancing Generative Pre-Trained Large Language Models (LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*Tr-GX04vbCcPatucmhwJyg.jpeg" /></figure><p><strong>Retrieval Augmented Generation (RAG)</strong></p><p>Retrieval Augmented Generation (RAG) is a method in natural language processing (NLP) that combines the benefits of both retrieval-based and generation-based approaches for question answering or content creation.</p><p>In the context of language models, retrieval refers to retrieving relevant information from predefined set of documents or passages of a large corpus or text database. While generation involves creating novel text using large pre-trained language models such as Chat GPT.</p><h3><strong>Retrieval Component</strong></h3><p>The retrieval component consists of several parts including context, embedder, vector store and query retrieval part.</p><p><strong>Context</strong>: The context can be a database or related corpus or knowledge base or studies any kind of close or open resource even internet.</p><p><strong>Embedder</strong>: This parts creates vector embedding representation for all the text of the context. Embeddings are vector representation of words, phrases, or documents in a continuous vector space. Vectors consist of floating numbers.</p><p><strong>Vector Storage</strong>: The vector storage stores all the embeddings with their in a vector database.</p><p><strong>Query retrieval</strong>: When a user provide a query, the model has a retrieval system that can extract relevant information from context (knowledge base, document corpus, or other sources).</p><p>The query would be embedded and its embedding vector would be used to search in vector store to find relevant information.</p><h3><strong>Augmentation Component</strong></h3><p>Here, the contextual retrieved information would be augmented to the user’s query which creates an input to the Large Language Model (LLM). <br>This augmentation helps the generated answer to be contextually relevant as well as the information from pretrained LLM.</p><h3><strong>Generation Component</strong></h3><p>The generative component is applying the augmented query to the LLM to generate responses. The LLM is a generative model as it creates text based on its pretrained model. So, it enhances the generative capabilities of a model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZE_xGnWAva-UnJ4t-uuFWg.png" /></figure><h3><strong>How RAG empowers LLMs?</strong></h3><p>Large Language Models (LLMs), such as GPT (Generative Pre-trained Transformer) models, have shown remarkable capabilities in natural language understanding and generation. However, there are some cases where it would be very costly or not-fruitful to only depend on the LLMs.</p><p>In instances where there is an update to a knowledge source or when the information wasn’t available during the training of the Large Language Model (LLM), especially in highly specialized or specific domains, the process of retraining the LLM for these specific nuances can be both resource-intensive and time-consuming.</p><p>To avoid the costs of retraining the LLM for update the information or add source and knowledge to it, RAG can help in to get more accurate responses with less costs in a faster way.</p><p>As AI is being used increasingly for various tasks, the accuracy and relevance of the generated responses are getting more importance. Purely generative models may generate relevant text, but they can sometimes provide information that is factually incorrect or not grounded in real-world knowledge, which is called hallucination. Also, when the Large Language Model (LLM) lacks specific information on a given topic, it faces challenges in generating accurate responses. So the model may provide inaccurate responses.<br>By incorporating a retrieval component, RAG models can pull in information from external knowledge bases, improving the accuracy and grounding their responses in real-world facts and so less hallucinate.</p><p>Another main advantage of RAG is that it provide the capability to the model to take in real-time information from external sources, which makes the model more dynamic and adaptable to new information. This feature proves especially valuable in tasks requiring the model to reference specific details not present in its pre-trained knowledge, such as fact-checking or addressing inquiries about recent events.</p><h3><strong>RAG advantages</strong></h3><p>RAG can manage memory efficiently by take in new, updated, or specified knowledge from external databases. Rather than relying on an oversized model, RAG facilitates growth by updating or enlarging its external database, fostering a scalable knowledge base. RAG is adaptable. It can be customized for specific domains by adding the knowledge from external source.</p><h3><strong>Conclusion</strong></h3><p>RAG emerges not merely as a solution to help the performance of LLMs but as a strategic augmentation, enriching the accuracy, relevance, and adaptability of AI-generated responses in the face of the diverse and dynamic information landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d57230f955d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prompt in Large Language Models and ChatGPT Explained]]></title>
            <link>https://medium.com/@elanajafi/prompt-in-large-language-models-and-chatgpt-explained-a926ea8eeb81?source=rss-b13932067432------2</link>
            <guid isPermaLink="false">https://medium.com/p/a926ea8eeb81</guid>
            <dc:creator><![CDATA[Ela]]></dc:creator>
            <pubDate>Sun, 08 Oct 2023 06:24:25 GMT</pubDate>
            <atom:updated>2023-10-08T06:24:25.701Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-MGD2XiDaYBuMXJBd1Dfg.jpeg" /></figure><p>In this article I want to elaborate about prompt element in large language models and how it works.</p><p>First, I will give a brief definition about prompt and then explain different types of prompts which can be used in Large Language Models (LLMs) and their functionality and efficiency will be explored.</p><h4><strong>What is prompt?</strong></h4><p>A “prompt” is a word or phrase used to give instructions or ask questions to someone or something, like a computer or AI model. It’s a way to get a specific response or action.</p><h4><strong>What about prompt in large language models?</strong></h4><p>In LLMs, a prompt serves as a means of user interaction with the model by providing instructions and asking questions in a written mode. It plays a crucial role in LLMs as it can influence the model’s responses and overall efficiency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*sOljSBLCqIXs3TwJQd7lZQ.jpeg" /><figcaption>Prompting in LLMs, user provided the input to LLM through prompt and LLM create output to prompt</figcaption></figure><p>Large Language Models and among them ChatGPT (Generative Pre-trained Transformer) are mainly pretrained models on large corpus of data. They are trained on massive datasets by using transformers’ architecture with attention mechanisms which can memorize long sequences of data. They are learnt to guess what word comes next in a sequence. And when the model is big enough, it can learn human language grammar, word meanings, common knowledge, and basic logic as well. These models can recognize, translate, predict, or generate text or other contents.</p><p>A Large Language Model can be used as a foundation model which is trained for multiple tasks and can be customized, adapted and fine-tuned for a wide range of applications and special tasks related to human language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4StvpQWdS6b1MUWpY8gOOQ.jpeg" /><figcaption>Large Language Models are Foundation models which are specific to human language.</figcaption></figure><p>Training the foundation models to adapt them for special tasks is expensive and requires lots of resources. Large Language Models can be used as a foundation model for creating and tailoring models for specific needs and tasks, so they can be customized by Fine tuning, Prompt tuning and Prompt engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*69RfFrAMHzRmgQFdd7VDxQ.jpeg" /></figure><h4><strong>Fine Tuning Model</strong></h4><p>In model fine-tuning many examples of the special task would be gathered and labeled and then the model would be fine-tuned based on the examples rather than training from scratch.</p><p>Fine tuning can be full fine tuning with changing all the weights of a model or can be partial fine-tuning by retraining the last layers or copy the last layer(s) and train them without changing the original model, needs changing the pretrained models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*f1_LJ0C0G9NqJNN7e3h0_g.jpeg" /></figure><h4><strong>Prompt Tuning</strong></h4><p>Prompt-tuning is to adapt Large Language Model to more specific tasks without retraining the model or updating the model’s weights. It freezes the model, and so it is more cost effective than fine tuning the model and less time consuming. It allows to customize a large model to a very specific task with limited data. In prompt tunning the best cues, prompts or instructions or examples are fed to the model to give it task-specific context. The prompts are words equivalent vectors generated by algorithm in the model’s embedding layer, to guide the model towards specific goal. This part of the prompt is called soft prompt.</p><p>The tokens of the soft prompt are learnable vectors. This means a soft prompt can be optimized end-to-end over a training dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*bumFSmAOny-FIx3-8oYtTQ.jpeg" /></figure><p>Soft prompts are concatenated to the input text which is provided by user. To create a soft prompt for a specific task, the prompt would be initialized as a sequence of fixed length vectors then these vectors will be attached to the beginning of each embedded input and the combined sequence would be fed into the model. The model’s prediction will be compared to the desired result for the loss to be calculated and then to compute the gradients after backpropagating the errors. The updated gradients will only be applied to the new learnable vectors, keeping the core model unchanged. The soft prompts are not directly interpretable and readable by human. This process involves extracting information from the labeled dataset to guide the model in performing a task, similar to a manually crafted text prompt but without the limitations of human language.</p><h4><strong>Prompt Engineering</strong></h4><p>Prompt engineering is the art and practice of designing and improving and optimizing prompts — questions or instructions — to receive more precise and desired responses from AI models. So, the prompt is used to control the output of LLM. Users don’t have to try out different prompts, to find which one can provide best result or answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*KJ3b3b0L1BNNztRkQBoFyA.jpeg" /></figure><p>In prompt engineering the user would provide the engineered prompt beside the input to get desired output. Engineered prompt are instructions, examples or cues which are given with the input which is a question, order or request to the model. As these prompts are used per case and cannot be applied to several cases or be generalized, they are called hard prompt.</p><p>Prompt engineering can be done applying various techniques based on the input complexity and nature. The main techniques for prompt engineering are Zero-shot, One-Shot, Few-Shot prompting and Chain-of-Thought prompting.</p><p>By using the techniques for prompting, you guide the model to generate the most suitable prompts. This process involves steering the model’s understanding by adjusting the input prompt in a way that aligns the predicted next-tokens’ probability distribution with your desired outcome or intention. The prompt can influence the latent space, helping the model to produce the responses you want by tweaking the way you ask it questions or provide instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*aAIkRgIGkLgXHgHBgiMUlQ.jpeg" /><figcaption>Prompt Engineering Techniques</figcaption></figure><p><strong>Zero-Shot Prompting</strong></p><p>Because Large Language Models are trained on massive data, they can provide the output based on user’s input request. When the input is a part of trained data explicitly or implicitly, but there is no specified instruction or cue by user for providing result, but the model can generate acceptable output, then it is called, Zero-Shot prompting. This is the simplest prompting technique. Zero-Shot prompting is just asking your question or request in the best way possible, without providing any instruction or example.</p><p>zero-shot prompts are mainly preferred, as they need less instruction, writing and time from the user which in this case they are more efficient. They allow machines to provide what they learnt from trained data without receiving more data as input.</p><p>In the following there is an example of a Zero-Shot prompting. I asked ChatGPT as an input, to tell its sense about this sentence: “Watching nature is energizing “. The response is amazing as it understands the meaning and purpose of the question and provided the response without instructions or guidance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qUwOB6_Spjkl-zh1mDg7BQ.jpeg" /><figcaption>This is an example of Zero-Shot prompting, where I asked about what is the sense of a sentence which I provided as an input.</figcaption></figure><p><strong>One-Shot Prompting</strong></p><p>User can provide an example or an instruction of what is needed to guide the model towards more relative acceptable results. This type of prompting is called one-shot prompting. In the following example, I provided one example as an instruction “Red is related to Heart”, and then I asked as an input, “Then Blue is related to”. And it responded: “Blue is related to Ocean”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztvhGkIbmOjew3mp2T0jNA.jpeg" /><figcaption>An example of One-Shot prompting</figcaption></figure><p>But, here is another example, which I provided an example which is not among training data. I gave the definition of two created words and made a sentence with the first one, then asked a question as an input to make a sentence with the second word. This was the prompt I provided:</p><p>“ <em>Joojoo is an animal which is small and yellow colored. it may fly when getting bigger. one example that uses Joojoo is:<br>I was hiking around a village, where I found children were playing with Joojoos. // to do “Tati” means walking like babies. An example of a sentence that uses the word Tati is: </em>“</p><p>This time as the words were fake and had no context in its training data, it could not make the response based on my one example. Its response is again amazing, that I am describing a fictional or imaginative scenario involving the term “Joojoo” and “Tati.” And that without further context, it’s challenging to provide a specific interpretation or meaning for these terms!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBJBeCAgSTYXoOWaPYhYSA.jpeg" /><figcaption>An example of one-shot prompting with input which is not among training data, and ChatGPT did not provide the outcome and interestingly mentioned that it is challenging without further context.</figcaption></figure><p>In the next step I repeated the instruction and input question with a small change, to make a sentence with the two words. And this time it works. It learnt from one example!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fe2afnXjaFFNGmiy8UH8nA.jpeg" /><figcaption>ChatGPT learnt from my one example to make a sentence with the two fake words which it did not have them in its training dataset and had no context about them.</figcaption></figure><p><strong>Few-Shot Prompting</strong></p><p>Few-Shot prompting is about providing several examples of similar situations and asking for the result for the given input. It can be helpful when the user cannot provide explicit instructions or formulate what he wants as a request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*OA54vMAqLVdxzHQJaCu5LQ.jpeg" /><figcaption>An example of Few-Shot prompting, giving several examples as instructions, ChatGPT found through examples to relate Green to Nature.</figcaption></figure><p><strong>Chain-of-Thought (CoT) prompting</strong></p><p>Chain-of-Thought (CoT) prompting is a technique that significantly enhances the multi-step reasoning skills of large language models (LLMs). It achieves this by encouraging the LLM to produce intermediate explanations or justifications as it works through a problem. This is accomplished by offering a sequence of reasoning steps in the demonstration, prompting the model to think and articulate its reasoning process step by step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CkT7UxJzVKco-X8ObJilfw.jpeg" /><figcaption>In this example Zero-Shot prompting cannot encourage the right result.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ekt6tDz5V17K5iKljMsWGA.jpeg" /><figcaption>The same example just by adding a simple prompt as to think step by step, ChatGPT could find the right answer.</figcaption></figure><p>Chain-of-thought (CoT) prompting is a technique that allows for intricate reasoning by breaking down complex tasks into smaller, intermediate steps. When combined with few-shot prompting, it enhances the model’s ability to tackle more challenging tasks that demand thoughtful reasoning before generating a response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*Kgv-R8W2pFsYmsvbC5Cz-g.jpeg" /><figcaption>An example of Few-Shot-CoT prompting.</figcaption></figure><h4><strong>Conclusion</strong></h4><p>Fine tuning a model requires more computational power and time. So, it is a very expensive strategy to adapt LLMs to specific tasks.</p><p>Prompt engineering and prompt tuning are more resource-efficient strategies, as they would not involve in retraining and changing weights of the foundation model. Prompt tuning needs soft prompt input which is a vector of numbers of model’s embeddings layer which is not understandable by human and soft prompts cannot be created by general users. Prompt tuning Besides eliminating the requirement for manual design, enables the prompt to distill the insights from datasets that encompass thousands or even millions of examples. Prompt engineering is the most applicable and understandable strategy for general users to get desired results from LLMs and specially ChatGPT.</p><h4>References:</h4><p><a href="https://heidloff.net/article/introduction-to-prompt-tuning/">Introduction to Prompt Tuning | Niklas Heidloff</a></p><p><a href="https://www.union.ai/blog-post/fine-tuning-vs-prompt-tuning-large-language-models">Fine Tuning vs. Prompt Engineering Large Language Models • Union.ai</a></p><p><a href="https://research.ibm.com/blog/what-is-ai-prompt-tuning">What is prompt tuning? | IBM Research Blog</a></p><p><a href="https://www.hopsworks.ai/dictionary/in-context-learning-icl#:~:text=In%2Dcontext%20learning%20(ICL),the%20need%20for%20fine%2Dtuning.">What is In Context Learning (ICL)? — Hopsworks</a></p><p><a href="https://www.elastic.co/what-is/large-language-models">What is a Large Language Model? | A Comprehensive LLMs Guide | Elastic</a></p><p><a href="https://www.union.ai/blog-post/fine-tuning-vs-prompt-tuning-large-language-models">Fine Tuning vs. Prompt Engineering Large Language Models • Union.ai</a></p><p><a href="https://analyticsindiamag.com/how-do-zero-shot-one-shot-and-few-shot-learning-differ/">How do zero-shot, one-shot and few-shot learning differ? (analyticsindiamag.com)</a></p><p><a href="https://www.techopedia.com/definition/34949/zero-shot-one-shot-few-shot-learning">Zero-Shot, One-Shot, Few-Shot Learning — Techopedia</a></p><p><a href="https://www.techtarget.com/whatis/feature/Foundation-models-explained-Everything-you-need-to-know#:~:text=A%20foundation%20model%20is%20a,for%20their%20generality%20and%20adaptability.">Foundation models explained: Everything you need to know (techtarget.com)</a></p><p><a href="https://machinelearningmastery.com/what-are-zero-shot-prompting-and-few-shot-prompting/">What Are Zero-Shot Prompting and Few-Shot Prompting — MachineLearningMastery.com</a></p><p><a href="https://hai.stanford.edu/news/reflections-foundation-models">Reflections on Foundation Models (stanford.edu)</a></p><p><a href="https://www.allabtai.com/prompt-engineering-tips-zero-one-and-few-shot-prompting/">ChatGPT Prompt Engineering Tips: Zero, One and Few Shot Prompting (allabtai.com)</a></p><p><a href="https://www.projectpro.io/article/foundational-models-vs-large-language-models/893#:~:text=While%20Foundational%20Models%20focus%20on,complex%20language%20tasks%20more%20effectively.">Foundational Models Vs. Large Language Models: The AI Titans (projectpro.io)</a></p><p><a href="https://cset.georgetown.edu/article/what-are-generative-ai-large-language-models-and-foundation-models/">What Are Generative AI, Large Language Models, and Foundation Models? — Center for Security and Emerging Technology (georgetown.edu)</a></p><p><a href="https://machinelearningmastery.com/what-are-zero-shot-prompting-and-few-shot-prompting/">What Are Zero-Shot Prompting and Few-Shot Prompting — MachineLearningMastery.com</a></p><p><a href="https://blog.research.google/2022/02/guiding-frozen-language-models-with.html">Guiding Frozen Language Models with Learned Soft Prompts — Google Research Blog</a></p><p><a href="https://arxiv.org/abs/2201.11903">[2201.11903] Chain-of-Thought Prompting Elicits Reasoning in Large Language Models (arxiv.org)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a926ea8eeb81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Engineering: Explained in Triads and Triangles]]></title>
            <link>https://medium.com/@elanajafi/data-engineering-explained-in-triads-and-triangles-f74f262ac79?source=rss-b13932067432------2</link>
            <guid isPermaLink="false">https://medium.com/p/f74f262ac79</guid>
            <dc:creator><![CDATA[Ela]]></dc:creator>
            <pubDate>Sun, 17 Sep 2023 22:51:37 GMT</pubDate>
            <atom:updated>2023-09-17T22:51:37.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JA-NtaBmQLmLDFvaiq_UDw.jpeg" /></figure><p>In this article first I provide a definition of data engineering and then explain it in three contexts such as data processing, technical roles and organizational users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*0FAtKTbjRQLdu7bm19X07w.jpeg" /><figcaption>Data engineering explained in three contexts.</figcaption></figure><h4>What is data engineering?</h4><p>Data engineering is about data manipulation and management.</p><p>By definition, data engineering is the development, implementation and maintenance of systems and processes which take raw data as input and produce high-quality, consistent information.</p><h4>1. Data Engineering and Data Processing</h4><p>The information which is the output of data engineering can be fed to the fields such as data analytics and data science.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*f_S_YrQuxAe_rE2jPkzwtQ.png" /><figcaption>Data Engineering serves as the antecedent phase for data analytics and data science.</figcaption></figure><p>From data processing point of view, data engineering provides the input to data analytics and data science tasks. Considering the data science pyramid of needs, data engineering creates the three bottom base foundations for data science and analytics by collecting, storing, organizing, structuring, cleaning and preparation of data for further processes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JBzsiy6iE_MKXddFq3cJUA.png" /><figcaption>The hierarchy of data science needs</figcaption></figure><p>Data might need to be extracted, transformed and loaded (ETL) in a reliable data flow or pipeline. Further data processing after data engineering is applying data exploration, descriptive and diagnostic analysis, and modelling for prediction and prescription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*--JzWcLH5Cma0ivlPbu6GA.jpeg" /><figcaption>Data processing through hierarchy of AI’s needs</figcaption></figure><p>DIKW hierarchy represents a tiered structure of outcomes in the realm of data processing, which can be gaining more information, knowledge and finally wisdom through insights. Data engineering helps transformation of data into information which can be used as an input for data analytics and data science. It creates context for the data which will be meaningful and that is why data engineers need to have domain-specific knowledge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*sCePKOwZf1yd2aozVmC10w.png" /><figcaption>DIKW hierarchy</figcaption></figure><p>Comparing the DIKW triangle with Data science triangle regarding data processing, the more we go from base of the data science triangle needs up to the top we will get more valuable forms of outputs for deeper understanding and more actionable and integrated insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emqMA9yu5mAWMJBnwko7Gg.jpeg" /></figure><p>Considering the garbage-in, garbage-out (GIGO) effect, that is in any system the quality of output would be determined by the quality of the input, data engineering plays a crucial role in data processing as it is located in the base of the process and can affect the quality of outputs for further data consumers which take in its outputs as their input.</p><h4><strong>2. Data Engineering and Technical Roles</strong></h4><p>Data engineers act as the intermediates between data producers (<em>software engineers, data architects and DevOps and site-reliability engineers</em>) and data consumers (<em>data analysts, data scientists, machine learning engineers</em>)<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*fNjE1erSaFFd-8OvGl8ZGw.png" /><figcaption>Data producers provide the input for the data engineers and the output of data engineering would be used by data consumers as their input.</figcaption></figure><p>As data engineering locates at the nexus of the relations between various technical roles and as it is not a well-defined position it may overlaps some responsibilities and tasks with other roles which relates to it in data processing as data producers and consumers, depending on the company size and how much the company is data driven.</p><p>To succeed, data engineers need to possess knowledge of data architecture they use and the source systems which produce data. Also, there might be a need to work closely with software engineers to understand the applications that generates data, or even learn new programming languages which are used with domain-specific data tools. DevOps and site-reliability engineers produce data through operational monitoring, which facilitates real-time insights into system performance and helps address issues. Data engineers may overlap with these roles by designing and maintaining the data infrastructure that collects and processes this operational data, enabling further analysis and decision-making.</p><p>On the other hand, data engineers share certain technical skills with data scientists, particularly in programming languages like SQL and Python. They also may share overlapping areas of responsibility with ML (Machine Learning) engineers, encompassing operational duties related to ML systems.</p><p>Data engineers may come from different fields and disciplines with different skill sets and they may not have the same type of work, responsibilities and tasks depending on the industry, company size and usage of data for applications which they are working for. Also, they may take the responsibilities of other technical roles based on their skill sets.</p><h4><strong>3. Data Engineering and Organizational Users</strong></h4><p>Data engineer serves different users which might be inter organization users or external users. Depending on the end-users the responsibilities of a data engineer may differs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*WEcsNou_XClXPco7W8hOrw.jpeg" /></figure><p>External organizational users pertain to applications serving external user bases, such as social media apps, Internet of Thing (IoT) devices and e-commerce platforms. In these scenarios, data engineer would design, build and manage systems that collect, store and process transactional and event data from these applications. These systems often feature a feedback loop from applications to the data pipeline and back. External users need more security for external queries as well as limiting users’ queries for the sake of infrastructure limitations.</p><p>Inter organizational users mainly are data consumers which are inside the organization and working with the applications which are needed for the business inside the organization. For internal users, data engineers would create and maintain data pipelines and data warehouses for BI dashboards, reports, business processes, data analytics and data science and ML models.</p><p>Finally, data engineering is a flexible, dynamic and evolving role that continues to refine its specialization as the field progresses and the landscape of data roles.</p><h4><strong>References:</strong></h4><p><a href="https://journals.sagepub.com/doi/10.1177/0165551506070706">The wisdom hierarchy: representations of the DIKW hierarchy — Jennifer Rowley, 2007 (sagepub.com)</a></p><p>Fundamentals of Data Engineering: Plan and Build Robust Data Systems, by Joe Reis (Author), Matt Housley (Author), 26 July 2022, Publisher(s): O’Reilly Media, Inc., ISBN: 9781098108304</p><p>Data Science Hierarchy of Needs, by Monica Rogati, <a href="http://oreil.ly/pGg9U">http://oreil.ly/pGg9U</a></p><p>Data as a Product vs Data as a Service: the difference between providing data and providing insights, by Justin Gage, <a href="https://readtechnically.medium.com/data-as-a-product-vs-data-as-a-service-d9f7e622dc55">https://readtechnically.medium.com/data-as-a-product-vs-data-as-a-service-d9f7e622dc55</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f74f262ac79" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>