<?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 Andrei Nicușan on Medium]]></title>
        <description><![CDATA[Stories by Andrei Nicușan on Medium]]></description>
        <link>https://medium.com/@andreinicusan?source=rss-8cf7d824756c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Bd0jR22GQVa3Xx2vuiuwgw.jpeg</url>
            <title>Stories by Andrei Nicușan on Medium</title>
            <link>https://medium.com/@andreinicusan?source=rss-8cf7d824756c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:03:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andreinicusan/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[Things I Still Can’t Wrap My Head Around When It Comes To Generative AI]]></title>
            <link>https://medium.com/@andreinicusan/things-i-still-cant-wrap-my-head-around-when-it-comes-to-generative-ai-f9e1c8063816?source=rss-8cf7d824756c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9e1c8063816</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Andrei Nicușan]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 20:56:10 GMT</pubDate>
            <atom:updated>2024-10-09T20:56:10.983Z</atom:updated>
            <content:encoded><![CDATA[<p>One of my core values dictates that I always have more questions than certainties. Questions and <em>I don’t know</em>s are always healthier than convictions. When we as a human race run out of <em>I don’t know</em>s, that’s when we reach zero entropy — death of the universe. Where am I going with this though…? Well, in the previous two articles (<a href="https://medium.com/@andreinicusan/11-things-i-learned-about-generative-ai-as-a-java-dev-part-1-d9841804f7bf">1</a> and <a href="https://medium.com/@andreinicusan/11-things-i-learned-about-generative-ai-as-a-java-dev-part-2-01036b87644f">2</a>) I’ve given you some facts that I learned about Generative AI. In that process, I had ignored the vast ocean of darkness that I’ve yet to wrap my head around. Now I feel indebted to provide some unanswered questions - food for thought.</p><h4>1 — How do language models know grammar?</h4><p>Ok, I’ve got the intuition of learning similar concepts, putting them close together in an embedding space and sending opposite concepts as far as possible from each other. I’ve also got the intuition of how words that make sense are fetched from a vocabulary and appended to sentences one at a time. This is still <strong>not sufficient for building grammatically correct sentences</strong>. How do large language models always generate syntax parts in a grammatically correct order? Especially in a language like English, where frequently the modifier goes before the modified (e.g. adjective goes before the noun). Let’s look at an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*53gCQFMnjCz7hu2M3zLsyQ.png" /><figcaption>A sentence containing a noun with two modifier adjectives shown using X-bar notation.</figcaption></figure><p>In the sentence <em>The big round ball was bouncing</em> the noun <em>ball</em> is modified by two adjectives — <em>big</em> and <em>round</em> — that, according to English grammar, go before the noun they modify.</p><p>How does a human build that sentence at a conceptual level, even before (just slightly before) expressing it in words, written or spoken?</p><ol><li>They think of the concept of a <em>ball</em>. They may already utter (or write) the article <em>the</em>.</li><li>They hold the word <em>ball</em> for later, just in case they could think of one or more modifiers (e.g. adjectives) they’d like to use.</li><li>They realise the ball is big, so they <strong>squeeze</strong> the word <em>big</em> <strong>in between</strong> <em>the</em> and <em>ball</em>.</li><li>They realise the ball is round, so they <strong>squeeze</strong> the word <em>big</em> <strong>in between</strong> <em>the</em> and <em>ball</em>.</li><li>Finally, they express the action performed by <em>ball</em>, i.e. <em>was bouncing</em>.</li></ol><p>To the potential argument that step 3 and 4 might actually happen in reality before step 2, I would answer that <em>big</em> and <em>round</em> don’t make sense by themselves. One can’t think of the qualities of an object before thinking what the object is. One can’t just say <em>big round</em> in the hope that an object will dawn unto them, so their sentence is not left dangling.</p><p>The key to what I’m trying to say is the “<strong>squeeze in between</strong>” part at steps 3 and 4. This is very contrary to the whole idea of generating words one at a time in linear order. This is an example where the building of a sentence doesn’t happen in a linear fashion naturally. In reality, even if we don’t even perceive it as such because it happens a fraction of a second before we utter it, we build the sentence by going back and forth and adding words where they fit.</p><p>In conclusion, does it mean that an AI language model would first think of <em>big</em> and <em>round</em>, and then find a noun that best fits the adjectives it’d generated that far?</p><h4>2 — Do language models have knowledge?</h4><p>We’ve already discussed how language models merely work by generating the next word in a communication, and then the next, and then the next… Is this how the human brain works when generating language? I genuinely don’t know.</p><p>Is language a consequence of knowledge or is expressing through language intrinsic to having knowledge? Again, I am not the best person to answer this question. But I still wonder.</p><p>Can a large language model with a full vocabulary that’s been fully embedded in a semantic multidimensional space (essentially an ontology) count as an epistemic system? Same answer.</p><p>We’re getting really philosophical here, so I’d really like to recommend <a href="https://stackoverflow.blog/2023/07/03/do-large-language-models-know-what-they-are-talking-about/">this Stack Overflow article</a> that takes some similar concerns and elaborates on them a bit further than I’ve been able to.</p><h4>3 — Do large language models possess intelligence?</h4><p>But first, what is intelligence? By now it’s become accepted wisdom that there isn’t just one definitive “thing” that’s called intelligence. It’s not as simple as someone or something being smart, clever, witty or wise. So what’s the standard we are holding these systems to? As I said in the introduction, if you’ve come here for answers, you’re out of luck today. I’ll just mention the <a href="https://en.wikipedia.org/wiki/Theory_of_multiple_intelligences">theory of multiple intelligences</a>, and more specifically <a href="https://www.simplypsychology.org/multiple-intelligences.html">Howard Gardner’s</a> flavour of this theory, which identifies eight distinct types of intelligence:</p><ul><li>linguistic</li><li>logical-mathematical</li><li>spatial-visual</li><li>bodily-kinesthetic</li><li>musical</li><li>interpersonal</li><li>intrapersonal</li><li>naturalistic.</li></ul><p>Do language model possess any of these types of intelligence? I’ll leave the question here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9e1c8063816" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11 Things I Learned About Generative AI As a Java Dev — Part 2]]></title>
            <link>https://medium.com/@andreinicusan/11-things-i-learned-about-generative-ai-as-a-java-dev-part-2-01036b87644f?source=rss-8cf7d824756c------2</link>
            <guid isPermaLink="false">https://medium.com/p/01036b87644f</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[embedding]]></category>
            <dc:creator><![CDATA[Andrei Nicușan]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 19:28:49 GMT</pubDate>
            <atom:updated>2024-08-25T19:28:49.781Z</atom:updated>
            <content:encoded><![CDATA[<h3>11 Things I Learned About Generative AI As a Java Dev — Part 2</h3><p>In <a href="https://medium.com/@andreinicusan/d9841804f7bf">Part 1</a> I shared with you five gotchas I learned about generative AI with the naivety of a non-ML/AI professional. In the second part I will present a few more things that, this time, make more sense to the technical-savvy reader.</p><h4>6/11 — Python</h4><p>Python. I learned Python! Not necessarily out of necessity, but more out of convenience. Firstly, because Python is surely a first-class citizen in the world of machine learning and AI. Maybe even a special-class citizen. Whatever is new and noteworthy in that space will almost surely become available to developers in a Python SDK first. Secondly, being the only software engineer in the team, I’ve been naturally exposed to a lot of different technologists who use Python on a daily basis while fulfilling their profession — ML engineers, data engineers and scientists.</p><p>What’s more interesting is that I found I didn’t have to <em>learn</em> Python, actually. I just got on and used Python. It feels like Python is one of the <em>quintessential</em> programming languages — a very clean, basic, general-purpose language. As long as you are proficient in any other non-niche programming language — have a basic concept of a variable, function, for-loop and if-loop — , you can just start using Python straight away. The specific details will just happen to you on the way.</p><h4>7/11 — Notebooks</h4><p>I’m not sure if I’m late to the party here, I’m not sure if Java developers use notebooks on a daily basis, but I surely discovered notebooks when I started spending less time on Java and more time on Python. (Going odd on a tangent, does anyone even use jshell?) For those not familiar with notebooks, my routine half-hearted attempt at explaining it is: <em>notebooks are like a hybrid between a script and a shell. They have the concept of a </em><strong><em>cell</em></strong><em> central to their philosophy, where a cell can contain either executable code or markdown. Code cells can be executed separately, while maintaining a runtime between executions, which means that e.g. variables set in a cell are in scope for other cells execution. </em>One of the most popular notebook solution these days is <a href="https://jupyter.org/">Jupyter</a>. I am confident that you will also find a more accurate definition of notebooks in there.</p><p>Notebooks are a very powerful tool for experimentation, exploratory data analysis (EDA), exploring new libraries and APIs, and not the least creating interactive demos and presentations.</p><h4>8/11 — You can still use Java if you fancy</h4><p>Things have changed a lot in 2024. These days, if you are constrained to use Java (there can be many reasons for that), you are in safe hands. You can get access to generative AI building blocks in two ways:</p><ol><li>Via HTTP APIs, which goes without saying are language agnostic. You just use your HTTP client library of choice — Jersey, Feign, you name it — and get started with stuff like GPT via <a href="https://platform.openai.com/docs/api-reference/introduction">OpenAI API</a>, Google’s <a href="https://ai.google.dev/gemini-api">Gemini</a>, etc.</li><li>Via dedicated Java SDK libraries, which have seen a lot of maturing this year. I’ll name just two: <a href="https://spring.io/projects/spring-ai">Spring AI</a> and Google’s Vertex AI <a href="https://github.com/googleapis/google-cloud-java/tree/main/java-vertexai">Java SDK</a>.</li></ol><p>Spring AI has got a very mature common interface for generic generative AI building blocks like embedding, chat completion, multi-modal inference, vector search. It provides concrete implementations for a multitude of providers currently in the market.</p><p>Vertex AI is Google’s most modern machine learning platform, that gives you access to Google’s own AI models, as well as allows you to fine tune, deploy, operate and serve open source models. By the way, Spring AI has got a Vertex AI implementation.</p><h4>9/11 — Generative AI tools are becoming a commodity for the everyday developer</h4><p>As developers, there’s nothing we enjoy more than quickly spinning up application and seeing them do something. The more we can use APIs and treat what’s behind them as black boxes and the less setup, the happier we are. Lazy daisies! Or, if current and future employers are reading this, we take pride in developing lean proof of concepts to help us validate/invalidate assumptions early. Right…</p><p>In 2024 you can easily spin up a proof of concept using the skills of a (intellectually curious) software engineer only. As I showed already, main building blocks of generative AI are already available as APIs (i.e. black boxes) ready to integrate into your applications. Even more specialised tasks like fine tuning are tending to become a commodity. <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/models/gemini-use-supervised-tuning">Vertex AI</a> and <a href="https://platform.openai.com/docs/guides/fine-tuning">OpenAI</a> expose REST endpoints for that. All you need is to curate some tuning data.</p><p>At a stretch, you could even build a small scale, production-ready solution. However, for anything large, or for anything where cost and performance need to be kept in check, I’d recommend you keep the machine learning and data science disciplines represented in your project/product team. Above, it might seem like I glossed over the importance of curating a good data set for fine tuning. However, that’s a good example where you might need specialist skills. Yes, you might be using APIs as a black box, but sometimes you might need help understanding how to set your parameters. Or, in this specific case, how to choose a model, how to prompt it, how to set its temperature, how many dimensions to use for an embedding, and so on and so forth.</p><h4>10/11 — Embeddings</h4><p>If there’s one thing you need to understand, that’s <a href="https://www.pinecone.io/learn/vector-embeddings/">embeddings</a>. The term <em>embedding</em> refers to both:</p><ul><li>the numerical representation of the semantics, meaning and concepts in a given entity (left intentionally vague);</li><li>the process through which the above is extracted from the given entity.</li></ul><p>The numerical representation of an embedding is a long array (usually high hundreds or low thousands of elements) of decimal numbers. There are dedicated AI models specialised for generating embeddings.</p><p>(Almost) anything can be embedded: words, sentences, paragraphs, whole chapters or books, images, videos, code snippets, 3D models. And this is in itself a powerful enough tool you can build applications on top of. Especially when looked at in correlation with…</p><h4>11/11 — Semantic similarity</h4><p>Second best thing to understand is similarity and <a href="https://www.pinecone.io/learn/vector-database/">vector stores</a>. Embeddings, seen as arrays (or vectors) of numbers, can be plotted in a multi-dimensional space with as many dimensions as elements in each embedding array. And what’s the most exciting about them, embeddings will naturally group together based on the similarity of their meaning. This gave rise to a new class of databases (vector stores) and <a href="https://www.pinecone.io/learn/vector-database/">index algorithms</a>, both optimised for this type of scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9UAt28W0Tf8vfWuBRBb8AA.jpeg" /><figcaption>A diagrammatic representation of the vector database concept alongside older database types: key-value, document store and graph.</figcaption></figure><p>You can build a lot of use cases purely on top of <strong>embeddings + semantic similarity</strong>, e.g. an image-to-image search product or a knowledge base search for your internal documentation. You can build complete solutions even without starting to think about the generative capabilities of AI models, like chat completion, <a href="https://huggingface.co/runwayml/stable-diffusion-inpainting">in-painting</a>, <a href="https://openai.com/index/dall-e-introducing-outpainting/">out-painting</a> and so on.</p><p>I hope you found at least one new thing to learn out of eleven from my journey so far. If you landed to this page first, make sure you don’t miss the <a href="https://medium.com/@andreinicusan/d9841804f7bf">first part</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01036b87644f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11 things I learned about Generative AI as a Java dev — Part 1]]></title>
            <link>https://medium.com/@andreinicusan/11-things-i-learned-about-generative-ai-as-a-java-dev-part-1-d9841804f7bf?source=rss-8cf7d824756c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9841804f7bf</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Andrei Nicușan]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 19:28:07 GMT</pubDate>
            <atom:updated>2024-08-25T19:28:07.099Z</atom:updated>
            <content:encoded><![CDATA[<h3>11 Things I Learned About Generative AI As a Java Dev — Part 1</h3><p>A bit about me: all throughout my career I’ve been a backend developer. Java, more specifically. If I were to blatantly oversimplify, I would probably summarise my skills as <em>defining APIs and then doing all my best to implement them</em>. A database here, a 3rd party API there, maybe the odd email server. I never had any professional inclination towards data science, data engineering or machine learning. Nothing beyond the point of regarding them as another black box to interface to via an API contract. My only experience with generative AI that far was to mess around with ChatGPT and try to get it to say silly things; or with DALL·E and Stable Diffusion to get them to draw silly things. Little did I know that what I was doing had a name: prompt engineering.</p><p>Last year though I’ve been dragged (not lacking enthusiasm on my end) into a project looking to explore potential applications of generative AI. I was the sole software engineer on the team, surrounded by data scientists, data engineers and machine learning engineers. My job was again to identify the best ways to make generative AI building blocks available to my application developer peers. Since I would be the only one of my trade in the team, I would naturally end up speaking the same language as my new team mates.</p><p>One year on and I’m totally the wiser. Here are a few facts I learned about generative AI in the process. In this article I am writing about the ones that are interesting to the general public, tech-savvy or not. In part two, I will describe the ones that make more sense to the software engineers coming from a similar background as me.</p><h4>1/11 — A chat application like ChatGPT works by repeatedly generating the next word</h4><p>We’re starting with an easy one. As soon as you finished typing your question (or <strong>prompt</strong>, if you prefer) into your chat application (<a href="https://chatgpt.com/">ChatGPT</a>, <a href="https://gemini.google.com/app">Gemini</a>, <a href="https://claude.ai/">Claude</a>, etc.), it will embark on a very repetitive operation which is essentially generating the next word. The input at the first step will be only your prompt. At each subsequent step, the input will be your prompt plus all the words in the reply generated that far. Your chat companion will stop whenever it decided the next word to generate is a special word, let’s call it <em>end-of-communication</em>. By the way, using <em>word</em> here is a simplification. In reality, language models operate with <strong>tokens</strong>, which are not always entire words. But for all intents and purposes, let’s just say a chat application is always generating the next word.</p><p>Is this how humans speak or write? I genuinely don’t know. I am inclined to say it isn’t, but then I’m definitely not a linguist by formation. I’ll leave it as an open question, some food for thought didn’t kill anyone.</p><h4>2/11 — A language model is still a machine learning model</h4><p>Or, to be more complete, any <strong>generative</strong> model is a machine learning model. Which means a generative model <em>predicts </em>with a certain<em> probability</em>, rather than <em>calculates</em>. Building on top of what we learned at the previous item, we can say that a chat application will, at each step, predict <strong>the most likely</strong> next word. For the record, this is also a simplification. It’s not really and not always the most likely word, but one of the top X most likely. Generative models operate with a parameter named <strong>temperature</strong>. The higher the temperature, the less the model will strive to find the very top most likely word, therefore the temperature parameter is used to control the <strong>creativity</strong> of the output. The higher the temperature, the more creative the output, but also the higher the chance for hallucinations.</p><h4>3/11 — A language model doesn’t do math the way humans (or calculators) do</h4><p>Since we showed that language models predict output with a certain degree of confidence, which is never (or very rarely) 100%, they are not the best solution for problems that require <strong>low fault tolerance</strong>. The most simple example of a low fault tolerance operation is an arithmetical operation. If you want to know what’s 2+2, you’re pretty much looking for 4. No headroom there. So if your prompt is “what’s 2 plus 2?”, the language model will do its usual thing that we already described: try and find the most likely next word. Indeed, if during its training it has been told enough times that 2+2=4, it might decide that the most likely next word is “4” or “four”. However, that shouldn’t let us believe that the model has actually used an arithmetic computation unit.</p><figure><img alt="Screenshot by author. A screenshot from a Gemini chat window showing how it gave the correct answer to a mathematical question" src="https://cdn-images-1.medium.com/max/1024/1*v3yoqrb6cS5CZoxFPJrf1g.png" /></figure><p>Now, like with everything else, there is a nuance I need to highlight. Despite all I said above, you might find yourself struggling to actually get ChatGPT/Gemini/Claude to come up with a wrong answer. Looking at my example in this screenshot, you can see I asked Gemini a fairly non-trivial question. I also combined plain text (<em>cubic root</em>) with digits and operation signs. Yet Gemini was able to give me the correct answer. So what gives? Well… first of all please notice that in the previous paragraph I referred to language models and not to chat applications. And that’s the relevant nuance here. A chat application is not just a language model plain and simple. It is also able to detect patterns in the given prompts and then call more task-specific <strong>functions</strong> in order to perform the detected operations.</p><p>If you were to ask me, since you‘re already using a device to talk to a chat application, and that device most likely has a calculator application, why not use the latter?</p><h4>4/11 — Googling and asking ChatGPT work very differently under the hood</h4><p>I know people for whom ChatGPT is now top of mind when it comes to finding information online, over Google. It seems to be doing the job for them, no judging.</p><figure><img alt="Screenshot by author. A screenshot showing a search for “horatio nelson trafalgar” in Google Search side-by-side with the same text used as a prompt in Gemini chat." src="https://cdn-images-1.medium.com/max/1024/1*ptTJgG4ZIVJuAgdzUl9UyA.png" /></figure><p>The two, however, come from very different philosophies. Let’s imagine a chat application which uses a large language model that has been trained on the exact same content Google has indexed for its search engine.</p><p><strong>Googling</strong> makes use of traditional information retrieval techniques, chiefly the <a href="https://www.geeksforgeeks.org/inverted-index/">inverted index</a>. In essence, Google (or Bing or any other search engine, for that matter) takes each word in your query, looks up its own inverted index for each word, finds web pages relevant to as many of your words as possible and then serves a list of links to the said web pages. From that point on, you’re free to click through and see what information is available.</p><p>By contrast, a <strong>chat application</strong> operates with learned correlations between concepts — stronger correlation between similar concepts, weaker correlation between non-related concepts, and even negative correlation between opposite concepts. The data model used to store these correlations cannot be more different compared to the inverted index behind a search engine. Having this <em>knowledge</em>, the chat application will do the already familiar generation of the next word on repeat. What is the implication for the user experience then? Well, users will perceive it as they can skip a step, because they will be presented with a summary/synthesis of the web pages they would otherwise have to peruse.</p><h4>5/11 — ChatGPT is not the only player</h4><p>OpenAI were the first ones to break into the mainstream with their ChatGPT product, and I feel that ChatGPT is for the chat application market what Google is for search engines. And it’s probably gonna take a lot to change that.</p><p>With the emergence of Gemini and Claude, I got into the habit of using two chat applications in parallel. Whenever I need to ask a question, I use the same prompt and check both answers. Primarily, because it’s always a healthy choice to ask for a second opinion, like with everything else. But also out of curiosity to see how different chatbots have got different ways of structuring the answer, different philosophies and so on.</p><p>That’s enough for now. See you in part 2 for six more gotchas — this time a bit more technical than part 1.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9841804f7bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>