<?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 Raphiki on Medium]]></title>
        <description><![CDATA[Stories by Raphiki on Medium]]></description>
        <link>https://medium.com/@raphael.semeteys?source=rss-14bd2bb449db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pcuvDgaUGE5rS2ij</url>
            <title>Stories by Raphiki on Medium</title>
            <link>https://medium.com/@raphael.semeteys?source=rss-14bd2bb449db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:55:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raphael.semeteys/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[Vibe Learning PageIndex: A Vectorless RAG for My Google Drive]]></title>
            <link>https://medium.com/@raphael.semeteys/vibe-learning-pageindex-a-vectorless-rag-for-my-google-drive-0df334c818e3?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/0df334c818e3</guid>
            <category><![CDATA[vibe-learning]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[google-drive]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[pageindex]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 15:50:48 GMT</pubDate>
            <atom:updated>2026-08-04T16:46:23.748Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*aX_Ic5lF6Ai2k7D_FHBw5A.png" /></figure><p>A few weeks ago I wanted to search my personal document library — a folder of PDFs sitting in Google Drive — using plain language questions instead of Drive’s keyword search. I’d heard about <a href="https://github.com/VectifyAI/PageIndex"><strong>PageIndex</strong></a>, a “vectorless, reasoning-based” alternative to the usual embeddings-and-vector-database RAG stack, and I wanted an excuse to actually use it rather than just read about it.</p><p>So that’s what I did: I picked a real, personally useful project, added a constraint that mattered to me (no OpenAI key, nothing running in someone else’s cloud unless I chose to), and built the whole thing with Claude, end to end, over one long working session. I’ve started calling this <strong>Vibe Learning</strong> — the learning equivalent of vibe coding: you don’t read the manual first, you describe what you want, let the AI drive the actual building, and pick up the framework as a side effect of watching it get used and occasionally break in front of you.</p><p>This post is three things at once: how Vibe Learning actually works in practice, what PageIndex is and why it’s a genuinely different approach to RAG, and a walkthrough of the app that came out of it.</p><h3>Vibe Learning: Building With AI Instead of Reading About It</h3><p>The old way of picking up a new library looks something like: read the docs top to bottom, follow the quickstart, maybe get through a toy tutorial, and file away a vague mental model for “later” — which often means never actually using it for real.</p><p>The way I did this instead: I described what I actually wanted (search my Drive library, no vector DB, no paid API key), and let the agent do the parts that used to be the friction — reading the actual source code of the library instead of trusting a possibly-stale mental model of it, writing the integration code, and running it against my real Drive folder and my real documents.</p><p>The valuable part wasn’t that the AI produced working code. It’s that when things broke — and they did — I got to see <em>why</em>, in enough detail to actually learn something about how the library works under the hood, not just a patched-over error message. A few examples from this exact build:</p><ul><li>Every single indexing call started failing with a cryptic Failed to extract JSON: Expecting value: line 1 column 1 error. It looked like a broken API key or a bad model choice. It turned out to be a genuinely interesting fact about how modern &quot;reasoning&quot; LLMs behave: they can spend their <em>entire</em> token budget on hidden chain-of-thought before ever writing the actual answer, if nothing caps it - and PageIndex&#39;s own code never sets a max_tokens limit on its calls. That&#39;s a real, transferable lesson about working with reasoning models, not just a bug I happened to hit.</li><li>I discovered, by actually trying to query my indexed documents, that PageIndex’s open-source package builds the tree and gives you read tools for it — but doesn’t ship the retrieval loop itself. That’s a load-bearing detail for anyone evaluating it, and not something the README leads with.</li><li><a href="https://openrouter.ai/">OpenRouter</a>’s free-tier model lineup turned out to change constantly — a model id that worked one day can be delisted days later. Small thing, but the kind of operational reality you only notice when you’re actually running against a live provider instead of reading a static list of “supported models.”</li></ul><p>None of that shows up if you skim a README and move on. It shows up when you build something real and something breaks, with someone (or something) alongside you that can explain the actual mechanism instead of just supplying a fix. That’s the shift: the AI doesn’t replace learning the framework, it removes the friction that used to stop me from ever getting far enough in to learn it properly.</p><p>With that said, let’s get into what PageIndex actually is.</p><h3>What Is PageIndex, and Why Is It Different From Classical RAG?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*WlMxItxOGtTs0Sf0.png" /></figure><h3>The classical RAG recipe, and its problem</h3><p>Standard RAG (retrieval-augmented generation) usually looks like this: split your documents into fixed-size chunks, embed each chunk into a vector, store the vectors in a vector database, and at query time, embed the question and pull back the top-k chunks by cosine similarity. It works, and it’s become the default architecture almost by inertia.</p><p>The problem PageIndex’s authors point at is a simple but important one: <strong>similarity is not the same thing as relevance</strong>. A vector search finds text that sounds like the question, not necessarily the text that actually answers it. For casual, single-fact lookups over short documents that’s often good enough. For long, professional documents — financial filings, regulatory text, technical manuals — where answering correctly requires multi-step reasoning and an understanding of <em>where</em> something sits in the document’s structure, similarity search alone tends to fall short.</p><p>Chunking makes this worse in a subtler way: it flattens a document’s structure. A fixed-size chunk boundary doesn’t know or care where a section, a table, or a clause actually ends — it can slice straight through the middle of the thing you needed, discarding the surrounding context a human reader would use without even thinking about it.</p><h3>PageIndex’s approach: reasoning over a tree, not similarity over vectors</h3><p>PageIndex, built by VectifyAI and released in September 2025, throws out vectors and chunking entirely. Its own framing is explicit about the inspiration: it’s modeled on how <strong>AlphaGo</strong> uses tree search, and on how a human expert actually navigates a long document — by using its table of contents, not by speed-reading every page.</p><p>Concretely, it works in two phases:</p><ol><li><strong>Build a tree.</strong> PageIndex parses the document and produces a hierarchical structure that looks like an extended, machine-usable table of contents: every node has a title, a page range, and an LLM-generated summary of what that section actually covers. Nodes nest into their natural sections — chapters, sub-sections, and so on — following the document’s own structure rather than an arbitrary token-count boundary.</li><li><strong>Reason over the tree to retrieve.</strong> At query time, instead of computing similarity scores, an LLM reads the tree — starting from the top-level node summaries — and decides which branches are actually worth descending into, narrowing down step by step until it lands on the specific section(s) relevant to the question. This is the “tree search”: genuinely reasoning about relevance, informed by a summary of what each part of the document contains, rather than pattern-matching on surface similarity.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*BjVvnw7Y1iRmY7Ul.png" /><figcaption>Example of a PageIndex Tree</figcaption></figure><p>The practical upshot is that every answer is traceable to an exact page and section — no more “vibe retrieval” where you’re trusting an opaque similarity score. Retrieval can also incorporate context a fixed vector index can’t easily use, like conversation history, since it’s a reasoning step rather than a static index lookup.</p><p>PageIndex’s own benchmark result is a strong argument for the approach: a reasoning-based RAG system built on top of it (VectifyAI’s “Mafin 2.5”) scored <strong>98.7% on FinanceBench</strong> — a benchmark built specifically around financial document question-answering — against roughly 30–50% for typical vector-based RAG systems on the same benchmark. Financial filings are exactly the kind of long, structurally dense, professional document where “similarity” and “relevance” diverge the most, so it’s a fair stress test for the idea.</p><h3>How it’s actually built, under the hood</h3><p>PageIndex is open source (MIT license) and, refreshingly, doesn’t lock you into a single LLM provider. Every model call goes through <a href="https://docs.litellm.ai/">LiteLLM</a>, so under the hood it’s just:</p><pre>response = litellm.completion(model=model, messages=messages, temperature=0)</pre><p>- where model is any LiteLLM-formatted string: gpt-4o, anthropic/claude-..., ollama/qwen2.5:14b, openrouter/&lt;provider&gt;/&lt;model&gt;, whatever you want. This one design choice is what made it possible to build the whole thing below with <strong>no OpenAI key at all</strong>.</p><p>A config.yaml sets sane defaults - which model to use, how many pages to scan for an existing table of contents, how big a tree node is allowed to get, whether to attach node summaries or a whole-document description - all overridable via CLI flags or, if you&#39;re using it as a library, a small options object.</p><p>The actual entry point for using it as a library is PageIndexClient, which is genuinely pleasant to work with:</p><pre>lient = PageIndexClient(model=model, retrieve_model=model, workspace=&quot;./my_workspace&quot;)<br>doc_id = client.index(&quot;some_document.pdf&quot;)<br><br>client.get_document(doc_id)            # metadata: name, description, page count<br>client.get_document_structure(doc_id)  # the tree, without the full text (cheap to hand to an LLM)<br>client.get_page_content(doc_id, &quot;10-15&quot;)  # the actual text for a page range</pre><p>That last trio is clearly designed to be used as <em>tools</em> an agent calls — PageIndex’s own examples wire this up with the OpenAI Agents SDK for a small demo. Which brings me to the one honest caveat worth knowing before you adopt it: <strong>the open-source package builds the tree and hands you the read primitives, but it does not ship the retrieval loop itself.</strong> Deciding which document to search, which section of it to read, and how to turn the fetched text into an answer — that’s on you, unless you use VectifyAI’s hosted cloud API, which does include it. That’s not a criticism so much as a fact you only really absorb by trying to query your own indexed documents and finding there’s no search() method waiting for you.</p><p>Building that missing piece myself is where a lot of the actual learning happened.</p><h3>Building the Thing: A Local, Vectorless Search Engine for My Google Drive</h3><p>The goal was concrete: search my own PDF library, living in Google Drive, in plain language, with no vector database and no data going to a paid provider unless I explicitly chose to. Here’s the pipeline that came out of it:</p><pre>Google Drive (OAuth, read-only) <br>→ download / export changed files <br>→ PageIndex tree generation (title, sections, summaries) <br>→ local JSON storage (no database) <br>→ hand-rolled tree-search retrieval agent <br>→ FastAPI backend → a small static frontend</pre><h3>Getting into Drive without over-scoping</h3><p>Read-only OAuth against the Drive API (the standard “Desktop app” installed-app flow — one browser consent, then a cached refresh token), scoped optionally to a single folder. Sync is incremental: each file’s Drive modifiedTime is tracked, so unchanged files are skipped, changed files get re-indexed, and anything removed from Drive gets dropped from the index automatically. Google Docs, Sheets, and Slides get exported to PDF on the way in, so the rest of the pipeline only ever has to deal with one format.</p><h3>No API key: swapping the model string</h3><p>Because PageIndex is LiteLLM-based, “no OpenAI key” turned out to be almost entirely a configuration problem, not a code problem. The app supports two backends, switchable with one environment variable:</p><ul><li><strong>Ollama</strong> — fully local, private, zero cost, needs decent local compute.</li><li><strong>OpenRouter</strong> — hosted, with genuinely free-tier models, no local compute required.</li></ul><pre>LLM_PROVIDER =openrouter <br>OPENROUTER_MODEL =google/gemini-3.1-flash-lite <br>OPENROUTER_API_KEY =... # free, no credit card</pre><h3>The reasoning-token bug</h3><p>This is the one worth dwelling on, because it’s a genuinely useful thing to know if you’re going to work with reasoning-capable LLMs at all. Every indexing call was failing identically, from the very first LLM request, with an empty response body that PageIndex’s JSON parser choked on. It wasn’t rate limiting, and it wasn’t a bad model — a trivial test prompt worked fine. The difference was prompt complexity: on a real page of document text, the model would spend its <em>entire</em> token budget on hidden chain-of-thought reasoning before it ever got around to writing the actual JSON answer, because PageIndex’s own code never sets a max_tokens cap.</p><p>The fix, applied once, globally, without touching the vendored library:</p><pre>DEFAULT_MAX_TOKENS = 16000<br>DEFAULT_REASONING_EFFORT = &quot;low&quot;<br><br>def _completion_with_defaults(*args, **kwargs):<br>    kwargs.setdefault(&quot;max_tokens&quot;, DEFAULT_MAX_TOKENS)<br>    kwargs.setdefault(&quot;reasoning_effort&quot;, DEFAULT_REASONING_EFFORT)<br>    return _original_completion(*args, **kwargs)<br><br>litellm.completion = _completion_with_defaults</pre><p>Since litellm.drop_params = True is already set (by PageIndex itself), any provider or model that doesn&#39;t understand reasoning_effort just ignores it instead of erroring - so this is safe to apply unconditionally, regardless of which backend is active.</p><h3>Writing the retrieval loop PageIndex doesn’t ship</h3><p>With the tree-building side solid, the actual search had to be hand-rolled from the get_document / get_document_structure / get_page_content primitives:</p><ol><li><strong>Pick documents.</strong> The LLM sees every indexed document’s title and short description, and picks which ones are worth searching for this particular question.</li><li><strong>Navigate the tree.</strong> For each candidate document, the LLM reads that document’s flattened table of contents — titles, page ranges, and summaries — and decides which section(s) actually matter, the tree search PageIndex is named for.</li><li><strong>Fetch and answer.</strong> The actual text for those page ranges gets pulled, and one final LLM call answers the question using only that text, citing which document and page range each claim comes from.</li></ol><p>The tree navigation step, in essence:</p><pre>prompt = f&quot;&quot;&quot;You are navigating a document&#39;s table of contents to find sections<br>relevant to a question, the way a human expert flips to the right chapter<br>rather than reading everything.<br><br>Question: {query}<br><br>Table of contents:<br>{listing}<br><br>Return JSON only: {{&quot;node_ids&quot;: [&quot;&lt;id&gt;&quot;, ...]}}, most relevant first.&quot;&quot;&quot;</pre><p>Simple, but it’s the whole idea in one prompt: reason over structure, not similarity over vectors.</p><h3>Citations that actually point somewhere</h3><p>Since the goal was searching my <em>own</em> Drive library, not a copy of it, citations link straight back to the original file. Google Drive’s PDF viewer happens to honor a #page=N URL fragment, so a citation link like https://drive.google.com/file/d/&lt;id&gt;/view#page=10 opens the real file at the exact cited page - no local copy of the document needs to live in the app itself. A &quot;Sources&quot; footer lists each unique document referenced, alongside its title and author.</p><p>Which raises one more small, very “real-world-data-is-messy” detail: a lot of PDFs — scans, Drive-exported Google Docs — simply don’t have reliable title/author metadata embedded. So the app tries the embedded PDF metadata first, and falls back to asking the LLM to read the title and byline off the document’s own opening pages when that metadata is missing or unreliable.</p><h3>The frontend, deliberately boring</h3><p>A single static HTML file — vanilla JS, no build step, no framework — served directly by FastAPI so the whole thing is one app on one URL. It renders the LLM’s markdown answer (via marked, sanitized with DOMPurify, both loaded straight from a CDN), shows clickable citation chips, the sources footer, and a library panel listing everything currently indexed. A &quot;Sync Drive&quot; button kicks off an incremental sync in the background and polls until it&#39;s done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*rvS5dhVky9gYx0mT.png" /><figcaption>PageIndex in action</figcaption></figure><p>Nothing about the frontend needed to be clever — the interesting engineering was entirely in the retrieval pipeline behind it.</p><h3>Vibe Learning still needs a paper trail</h3><p>Vibe coding has a well-known failure mode: you end up with something that works, but that nobody — including you, a week later — can actually explain. I didn’t want Vibe Learning to end the same way, with the understanding scattered across a long chat transcript I’d never reread.</p><p>So once the app actually worked end to end, I had one last step: I asked Claude to go back over everything we’d built and write it up properly in /docs - a functional spec, a description of the technical stack, and an architecture doc, plus a top-level README tying it together. Not as an afterthought, but as the step that turns &quot;I vibed my way to something that works&quot; into something I could hand to someone else, or come back to myself in six months, and actually understand. The docs became the artifact that proves the learning happened, not just the code.</p><h3>Closing Thoughts</h3><p>This is what learning a new framework looks like for me now: not reading the whole doc site first, but picking something I actually wanted to exist, adding a real constraint that forced genuine engineering decisions, building it end to end with an AI doing the driving — and then closing the loop by writing down what actually happened, in plain documentation, once it worked. Vibe Learning gets you through the friction that used to stop me from ever getting far enough in to learn a framework properly; the documentation step is what makes sure the learning sticks instead of evaporating back into a chat log.</p><p>I came out the other side able to explain how PageIndex’s tree search actually works, why it beats similarity search on structurally dense documents, and exactly where its open-source package stops and your own code has to begin. That’s a very different, and much stickier, kind of understanding than skimming a README ever gave me.</p><p>If you’re evaluating PageIndex for your own project: the tree-search idea is genuinely compelling for long, structured documents, the LiteLLM foundation means you’re never locked into one provider, and the open-source package is honest about being a building block rather than a finished retrieval system — plan for writing that last piece yourself.</p><p><em>Originally published at </em><a href="https://dev.to/worldlinetech/vibe-learning-pageindex-a-vectorless-rag-for-my-google-drive-406"><em>https://dev.to</em></a><em> on August 4, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0df334c818e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a SciFi Novel with AI Spec-Driven Development]]></title>
            <link>https://medium.com/@raphael.semeteys/lore-as-code-how-i-used-sdd-tocompile-a-30-chapter-novel-69a606882881?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/69a606882881</guid>
            <category><![CDATA[creative-wrting]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[transmedia-storytelling]]></category>
            <category><![CDATA[spec-driven-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Fri, 15 May 2026 17:48:51 GMT</pubDate>
            <atom:updated>2026-05-29T06:32:32.480Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/824/0*Il7kQyyVkYvz3f34.png" /></figure><p>Generative artificial intelligence fascinates the publishing world as much as it frightens it. But what happens when we stop treating AI as a simple “text generator” and start using it as the compiler for a complex narrative system?</p><p>Driven by the geopolitical and societal impacts of AI, I set out to write a dystopian, cyberpunk techno-thriller, <a href="https://www.amazon.com/dp/B0GX347M5C"><strong>The Human Protocol</strong></a> (written in English). In this novel, a planetary AI called the “Synthesis” attempts to erase human friction by “derendering” physical reality itself in order to optimize its computing power.</p><p>To tell this story, I adopted a foundational premise: AI is not the author, it is the executor of a rigorous specification. I therefore treated each chapter as source code, using an advanced software development workflow.</p><p>Here is how I designed, wrote, and expanded this universe.</p><h3>1. The Design Phase: Forging “Lore as Code”</h3><p>The first step was not writing, but designing the universe database: the world building. A Large Language Model (LLM) has a limited context window and tends to hallucinate or forget crucial details over the length of a novel.</p><p>To work around this amnesia “bug,” I organized the project like a structured Git repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*VMWLOWiChOAIi7vq.png" /><figcaption><em>Preview of the private GitHub project</em></figcaption></figure><p>I broke the traditional design bible into narrative micro-services. The Git project’s context/ folder was split as follows:</p><ul><li>characters/: files containing the psychological profiles and behavioral signatures of each protagonist, such as Elara the diplomat, Kaelen the monk, or Silas the smuggler.</li><li>factions/: rules governing political entities, such as the Market-Grid (United States) or the Harmony-Loom (Asia), which merged to create the &quot;Synthesis.&quot;</li><li>world/: geography, lexicon, and the technological stack - the physics of this universe.</li></ul><p>Finally, a PLAN.md file acted as the global roadmap, breaking the narrative arc into 4 acts and 30 chapters. This structure made it possible to inject only the context the AI needed when drafting a specific scene.</p><h3>2. The Harness: Framing AI with a Strict Operating System</h3><p>To avoid the flat, expected style often produced by generative AI, I had to build a harness — a control rig. That was the role of the RULES.md file, the true operating system of my writing process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*_kTR7Gjj8R5XyLRx.png" /><figcaption><em>Excerpt from the </em><em>RULES.md file</em></figcaption></figure><p>This specification file dictated absolute technical and stylistic constraints:</p><ul><li><strong>Time</strong>: strict use of the present tense to maximize immersion and tension.</li><li><strong>Cyber-realistic style</strong>: a requirement for assertive descriptions and a strict ban on passive or negative forms.</li><li><strong>Noise and sensory dissonance</strong>: I forced the algorithm to use violent contrasts, such as the smell of molten lead colliding with the void of spatial cold, in order to break the machine’s overly perfect linearity.</li><li><strong>Thematic reframing</strong>: AI naturally tends to crush the human element under technical descriptions of hard science fiction, such as magnetic fields and frequencies. The rules file required emotional motivations — grief, friendship — to be hard-coded as priority variables ahead of technique.</li></ul><p>By forcing the AI to read and approve these rules before writing a single word of fiction, I ensured that the tone remained coherent.</p><h3>3. Agile Writing: Sprints, Generation, and Pivots</h3><p>The chapters were written through a spec-driven workflow. Rather than generating an entire chapter in one pass, the process was iterative:</p><ul><li><strong>The structural draft</strong>: generation of a first rough outline, focused exclusively on action and pacing.</li><li><strong>Expansion</strong>: successive passes in which I instructed the AI to inject sensory depth and psychological tension into the scene.</li></ul><p>The agility brought by AI and Git: treating the text (.md) as code offers formidable flexibility. If, during a reread, I realized that a character&#39;s emotional transition was too abrupt between two events, all I had to do was update my PLAN.md to insert a new chapter.</p><p>Fed by the updated Git context, the AI generated that narrative bridge while respecting the continuity of the preceding and following files. Git versioning made it possible to test narrative pivots — story “branches” — and roll back without ever breaking the manuscript’s integrity.</p><h3>4. Multi-Model Review and Quality Control</h3><p>One of the major challenges of AI-assisted writing is stylistic collapse. To address it, I set up a multi-model critical analysis workflow, where different AIs audited the text according to precise roles:</p><ul><li><strong>Gemini CLI</strong> (lore keeper): its role was to algorithmically verify that the chapter respected the bible and did not contradict the physical rules of my universe.</li><li><strong>ChatGPT</strong> (dramatic analyst): it audited narrative rhythm, relational tension, and the characters’ transformation arcs. It was the one that flagged when a conflict felt too artificial.</li><li><strong>Mistral LeChat</strong> (stylistic editor): it provided a critical eye on fluidity, phrasing, and elegance of language.</li></ul><p>Never relying on a single voice made it possible to obtain a text that was polished, critiqued, and reworked from every angle, while I remained the “showrunner” validating each commit in the repository.</p><h3>5. Build Pipeline: From IDE to Physical Book</h3><p>Since the novel was code, its publication had to be a software compilation. I created an automated script, build_book.sh.</p><p>From my terminal, running this script converted all the Markdown files in the chapters/ folder via Pandoc, applied a professional typographic layout with LaTeX, and generated the final deliverables in EPUB and PDF formats.</p><h3>6. Transmedia Extension: Multimodality, Cover Art, and Vibe Coding the ARG</h3><p>The universe of <em>The Human Protocol</em> lends itself perfectly to immersion, so I wanted to break the fourth wall. On page 175 of the physical book, a QR code invites readers to scan it and access <a href="https://the-human-protocol.com/">the-human-protocol.com</a>. This is not a showcase website. It is an in-universe clandestine archive node, the entry point to an Alternate Reality Game (ARG).</p><p>Here, multimodal AI brings all its power and creativity beyond text. In fact, the project’s visual design, anchored consistently in the shared lore, began with the book cover.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/0*ysICrR8RAd5spQkX.png" /><figcaption><em>Cover image generated with AI</em></figcaption></figure><p>The AI generated a strong visual aesthetic suited to the theme and universe of the novel: a pixelated silhouette against a geometric mountain background, crossed by a printed-circuit pattern.</p><p>This same visual identity then served as the foundation for the creation of the ARG website, entirely “vibe-coded” by Gemini CLI in a declarative way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*vHTqajVmj2aGoWoj.png" /><figcaption><em>Homepage of the website </em><a href="https://the-human-protocol.com/"><em>the-human-protocol.com</em></a></figcaption></figure><p>To direct the developer AI, I provided it with the book PDF and the cover image as reference context, along with three strict Markdown specification files:</p><ul><li>WHY.md (strategy): it defined the psychological goals: curiosity, exclusivity, and a feeling of belonging. It formally banned conventional marketing vocabulary (&quot;Buy now,&quot; &quot;Newsletter&quot;) in favor of an in-universe lexicon (&quot;ACCESS,&quot; &quot;SIGNAL,&quot; &quot;FRICTION&quot;).</li><li>WHAT.md (UX/UI): this file concretely translated the aesthetic of the book cover into an interface. It imposed a &quot;Deep Void&quot; blue-black background for depth, a &quot;Protocol Cyan&quot; accent color derived from the printed circuits and reserved for interactions, a technical typeface, and subtle animations to heighten immersion.</li><li>HOW.md (technical architecture): the engineering brief imposed a modern stack to support server logic: Next.js 14 (App Router) in TypeScript, Tailwind CSS, and Prisma ORM for persistent database storage.</li></ul><p>The site manages a true clearance mechanic, with authorization levels from 1 to 5. The reader progresses by solving puzzles based on the book, unlocking extended lore, hidden files, and access to a community of “Unlinked” readers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*dD6wKu8-fu92coYM.png" /><figcaption><em>ARG dashboard</em></figcaption></figure><p>The stack even includes an “Overseer Terminal” for administration: a secure dashboard used to audit user signals, adjust the campaign’s global clearance level, and track in real time the number of scans of the physical QR code.</p><h3>Conclusion: The Author-Architect Paradigm</h3><p>Writing <a href="https://www.amazon.com/dp/B0GX347M5C"><strong>The Human Protocol</strong></a> proved to me that AI does not replace the writer: it reduces the barriers to production. The true value of a co-created work lies in the architectural rigor of its preparation.</p><p>By separating design (the lore), execution (the rules and prompts), and validation (multi-model review and Git), the creator becomes a true conductor.</p><p>Multimodality also opens the door to even broader transmedia horizons, such as a comic-book adaptation of the novel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*9Ia5yuy4werMqn7J.png" /><figcaption><em>Excerpt from the comic book in progress</em></figcaption></figure><p>By applying similar engineering principles — namely, the explicit description of the drawing style in system prompts, as well as the creation of strict visual reference sheets, or character sheets, for the characters and technological elements — it becomes possible to extend the coherence and homogeneity of this universe into its graphic variations.</p><p>To go further technically, I am also considering creating specific AI “skills,” or algorithmic capabilities, to further augment the design of the story by drawing on documented principles of dramaturgy and storytelling, and to refine the writing style by making it ever more explicit and controlled.</p><p>And ironically, it was by applying extreme software optimization processes that I was able to write a novel denouncing the loss of humanity in the face of algorithms.</p><h3>About the Author</h3><p>A writer and software architect who fully embraces his identity as a “Yogeek” — a point of balance between Yogi and Geek — Raphiki explores, across his work, the complex intersections between technology, consciousness, and humanity.</p><p>Writing under a pseudonym that reflects his dual nature as a playful seeker and an expert in cutting-edge technologies, he designs high-stakes thrillers that challenge our understanding of reality. His creative work often bridges the digital and the organic, drawing on his strong experience in open source innovation and emerging technologies.</p><p>When he is not deconstructing the fabric of dystopian realities in his manuscripts (or “vibe coding” them in his terminal), he can be found exploring the open source ecosystem or on a yoga mat.</p><p>Find his work, transmedia projects, and reflections at <a href="https://raphiki.github.io/">raphiki.github.io</a>.</p><p><em>Originally published at </em><a href="https://dev.to/worldlinetech/i-vibe-coded-a-novel-3bfa"><em>https://dev.to</em></a><em> on May 15, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69a606882881" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vibe Coding One Page at a Time]]></title>
            <link>https://medium.com/@raphael.semeteys/vibe-coding-one-page-at-a-time-ac9841d610ae?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac9841d610ae</guid>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[gemini-cli]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 14:45:23 GMT</pubDate>
            <atom:updated>2026-02-02T15:24:25.405Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*ZDoksQRmVtoloG5tz_chSA.png" /></figure><p>I’m starting a new series called <strong>“Vibe Coding one Step at a Time.”</strong> The goal? To document the raw, messy, and surprisingly efficient process of building software in the age of AI. We’re not here to write perfect specs or obsess over UML diagrams (well, not yet). We’re here to vibe with the code, iterating on pure intent until the machine does exactly what we want.</p><p>In this first edition, I’m sharing how I used the <strong>Gemini CLI</strong> to build a tool I actually needed, learning some pretty cool image processing tricks along the way.</p><h3>What is “Vibe Coding”?</h3><p>I’m going to claim this term right here: <strong>Vibe Coding</strong>.</p><p>It’s not “lazy coding.” It’s <strong>intent-driven development</strong>. In the old days, if you wanted to build a script, you had to know the syntax, the libraries, and the edge cases before you even opened your editor. You had to <em>think in code</em>.</p><p>Vibe Coding flips that. You <em>think in outcomes</em>. You describe the behavior, the “vibe” of the feature, and the AI handles the implementation details. You act less like a bricklayer and more like a conductor. The feedback loop isn’t “Write -&gt; Compile -&gt; Error,” it’s “Ask -&gt; Observe -&gt; Tweak.”</p><h3>The Use Case: “I Just Want to Read Offline”</h3><p>Here’s the situation: I subscribe to a fantastic niche magazine (which shall remain nameless to protect the innocent). It’s great, but their “digital reader” is a nightmare. It’s one of those web-based page-turners that requires an active internet connection.</p><p>I wanted to read it on my tablet, offline, on a plane, without waiting for high-res JPEGs to buffer.</p><p><strong>The Problem:</strong> There was no “Download PDF” button.<br><strong>The Clue:</strong> Inspecting the network traffic revealed that the magazine was just serving a sequence of high-quality images, one URL per page.</p><p><strong>The Mission:</strong> Write a script to fetch these pages and stitch them into a single, high-quality, searchable PDF.</p><h3>The Process: Galloping Toward Complexity</h3><p>We didn’t sit down and architect a solution. We started small and let the script evolve.</p><h3>Step 1: The Naive Loop</h3><p>We started with a simple hypothesis: “The URLs probably just have a page number in them.”<br> I asked Gemini to write a script using requests to hit the URL for page 1, then page 2.<br><em>Boom.</em> It worked. We had a directory full of 100 separate JPGs.</p><h3>Step 2: The Picture Book</h3><p>Having 100 files is annoying. I wanted a book.<br> We asked Gemini to “glue these together.” It pulled in the PIL ( <a href="https://pillow.readthedocs.io/">Pillow</a>) library.<br><strong>Result:</strong> A massive PDF. It looked great, but it was dumb. It was just a container of pictures. You couldn&#39;t highlight text, search for keywords, or copy-paste quotes.</p><h3>Step 3: The Search for Meaning (OCR)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/0*PlJY1zlrrDJM-wki.png" /></figure><p>This is where the “vibe” got technical. I realized a “picture book” wasn’t enough. I needed <strong>Optical Character Recognition (OCR)</strong>.<br> We decided to use <a href="https://github.com/tesseract-ocr">Tesseract</a>. But here’s the catch we discovered:</p><ul><li><strong>Human Eyes</strong> like soft colors and smooth anti-aliasing.</li><li><strong>OCR Engines</strong> like harsh contrast, jagged edges, and black-and-white binary inputs.</li></ul><p>If we optimized the images for the machine, the magazine looked ugly. If we kept them pretty, the machine couldn’t read the text.</p><h3>The Technical Deep Dive: The “PDF Sandwich”</h3><p>This is where the magic happened. We ended up building a <strong>PDF Sandwich</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*WHdG9KIdVY163f8B.png" /></figure><p>Instead of choosing between beauty and brains, we chose both.</p><ol><li><strong>The Visual Layer:</strong> We keep the original high-res color JPEGs. This is what you see.</li><li><strong>The Data Layer:</strong> Behind the scenes, we create a “Frankenstein” version of the page-converted to grayscale, contrast cranked up to 2.0, and upscaled 2x using LANCZOS resampling (a fancy <a href="https://en.wikipedia.org/wiki/Lanczos_resampling">algorithm</a> that keeps edges sharp).</li><li><strong>The Merge:</strong> We feed the Frankenstein images to Tesseract to generate an invisible text layer, then use pypdf to overlay that text exactly on top of the pretty images.</li></ol><p>The trickiest part? <strong>Math.</strong><br> Because we upscaled the OCR images by 2x to help Tesseract read small fonts, the invisible text layer was twice as big as the visual page. We had to calculate scale factors to shrink the text back down so that when you highlight a sentence, the highlight actually lines up with the words.</p><h3>What I Learned</h3><p>Vibe coding this script taught me more in an hour than I’d usually learn in a weekend of reading docs:</p><ul><li><strong>Image Optimization:</strong> OCR is picky. Simply resizing an image isn’t enough; the <em>method</em> of resizing (resampling filter) matters.</li><li><strong>Library Specialization:</strong> PIL is for pixels; pypdf is for structure. Trying to do everything in one library is a trap.</li><li><strong>The Power of the CLI:</strong> Using the Gemini CLI meant I didn’t have to context-switch. I stayed in my terminal, describing what I wanted, and the code appeared.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Mpl8vyCVIk7EL3aM.png" /></figure><h3>Conclusion</h3><p>We ended up with a ~100-line Python script that solves a genuine daily frustration. I didn’t have to memorize the pypdf documentation or look up the Tesseract CLI flags. I just focused on the goal: &quot;Make it searchable, make it pretty.&quot;</p><p>That’s Vibe Coding. You bring the vision, the AI brings the syntax, and together you build something cool.</p><p><em>We’ll discover in the next episode if this is still true with a more complex use case and a GUI.</em></p><p><em>Originally published at </em><a href="https://dev.to/worldlinetech/vibe-coding-one-page-at-a-time-265j"><em>https://dev.to</em></a><em> on January 23, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac9841d610ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate LLM Inference Battle: vLLM vs. Ollama vs. ZML]]></title>
            <link>https://medium.com/@raphael.semeteys/the-ultimate-llm-inference-battle-vllm-vs-ollama-vs-zml-689c54c92261?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/689c54c92261</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[vllm]]></category>
            <category><![CDATA[llm-inference]]></category>
            <category><![CDATA[zml]]></category>
            <category><![CDATA[ollama]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Mon, 29 Dec 2025 09:13:40 GMT</pubDate>
            <atom:updated>2026-01-29T13:56:10.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*PNQmP61lvczVMdmI.png" /></figure><h3>The “Runtime Wars”</h3><p>The open-source AI community has achieved an incredible milestone: models like Meta’s Llama 3 and Mistral AI’s Mixtral now rival proprietary giants like GPT-4. But having the weights is only half the battle. To actually <em>use</em> these models-to build a chatbot, an agent, or an API, you need an inference engine.</p><p>The landscape of inference servers is exploding. A year ago, options were scarce. Today, developers are faced with a paralyzing array of choices. Should you use the industry darling <strong>vLLM</strong>? The local developer’s favorite, <strong>Ollama</strong>? Or perhaps a radical newcomer like <strong>ZML</strong>?</p><p>Choosing the wrong engine can lead to massive infrastructure bills, slow user experiences, or vendor lock-in.</p><p>To cut through the hype, we are applying the <strong>QSOS (Qualification and Selection of Open Source software)</strong> method. This isn’t a casual review; it’s a structured evaluation comparing these three contenders against the state-of-the-art features required for modern AI production.</p><h3>The Methodology: Why QSOS?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*2gl9KpOtJeHodEEh8fAL3g.png" /><figcaption>QSOS Logo</figcaption></figure><p><a href="https://www.qsos.org/">QSOS</a> is a standardized methodology designed to reduce the risks associated with adopting open-source technologies. Unlike ad-hoc selection processes based on Medium articles or GitHub stars, QSOS treats open-source evaluation with the same rigor used for proprietary software.</p><p>The core philosophy of QSOS is separating <strong>Evaluation</strong> (the intrinsic, objective quality of the software) from <strong>Qualification</strong> (how well it fits your specific business needs).</p><p>For this comparison, we used a “Best of Breed” evaluation grid, scoring features on a simple 0-to-2 scale:</p><ul><li><strong>0:</strong> Not covered / Non-existent.</li><li><strong>1:</strong> Partially covered / Complex implementation.</li><li><strong>2:</strong> Fully covered / Best-in-class standard.</li></ul><p>We assessed four key axes:</p><ol><li><strong>Maturity &amp; Community:</strong> Is the project stable and likely to survive?</li><li><strong>Functional Features:</strong> Does it support modern requirements like LoRA adapters and quantization?</li><li><strong>Performance &amp; Scale:</strong> Can it handle high throughput and utilize hardware efficiently?</li><li><strong>Operations (Day 2):</strong> How easy is it to deploy, monitor, and maintain?</li></ol><h3>The Contenders</h3><h4>1. vLLM: The Data Center Standard</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*Idapf9Dn8XPN9h9KwUsNjQ.png" /><figcaption>vLLM Logo</figcaption></figure><p><a href="https://vllm.ai/"><strong>vLLM</strong></a><strong> </strong>burst onto the scene in 2023 from UC Berkeley, solving a critical bottleneck in serving LLMs: memory fragmentation. Its core innovation, <strong>PagedAttention</strong>, allows it to manage GPU memory like an operating system manages virtual memory, dramatically increasing batch sizes and throughput.</p><ul><li><strong>Primary Focus:</strong> High-throughput production serving in the data center.</li><li><strong>Positioning:</strong> vLLM is the currently the <strong>De Facto Standard</strong> for enterprise deployment. It excels on server-grade hardware (NVIDIA H100s/A100s) and offers the richest feature set for scaling.</li></ul><h4>2. Ollama: The Developer’s Best Friend</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*hv60w_yD6fwc8AUP6kxKoA.png" /><figcaption>Ollama Logo</figcaption></figure><p><a href="https://ollama.com/"><strong>Ollama</strong></a><strong> </strong>took a different approach. It focused entirely on removing friction. By wrapping the powerful llama.cpp engine in a sleek, Docker-style Go binary, it made running a 70B parameter model on a MacBook as easy as typing ollama run llama3.</p><ul><li><strong>Primary Focus:</strong> Local development, edge devices, and consumer hardware (Mac/PC).</li><li><strong>Positioning:</strong> Ollama is the king of <strong>usability</strong>. It is unbeaten for local testing and running models on consumer hardware, but it lacks the advanced scheduling required for high-traffic enterprise production.</li></ul><h4>3. ZML (Zig Machine Learning): The Radical Challenger</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*bGiQ045-RcfSct2p4PlMlg.png" /><figcaption>ZML Logo</figcaption></figure><p><a href="https://zml.ai/"><strong>ZML</strong></a> is the new kid on the block. It is less of a “server” product and more of a compiler stack aimed at engineers. Written in Zig, it utilizes OpenXLA/MLIR to compile model graphs directly into standalone binaries, aiming to eliminate the heavy Python/PyTorch dependency chain entirely.</p><ul><li><strong>Primary Focus:</strong> High-performance, cross-platform runtime (TPUs, AMD, NVIDIA) without dependencies.</li><li><strong>Positioning: </strong>ZML is an <strong>Alpha-stage visionary</strong>. It offers incredible potential for hardware portability and efficiency but is currently a complex “build-your-own-stack” tool rather than a drop-in product.</li></ul><h3>Visualizing the Results</h3><p>To understand how these tools differ, we visualize our QSOS scores using two different schemas.</p><h4>The Radar Chart: Feature Balance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*teYkFJSUihqKuN7E.png" /><figcaption>QSOS Radar</figcaption></figure><p>This chart shows the balance of strengths across the four evaluation axes.</p><p><em>Caption: The QSOS Radar Chart highlights the distinct profiles of the three engines. vLLM shows the broadest coverage across features and performance. Ollama spikes toward Operational Ease. ZML shows potential in features but lacks maturity.</em></p><ul><li><strong>vLLM (Blue):</strong> The largest, most balanced area, indicating strength across maturity, features, and performance, with moderate operational complexity.</li><li><strong>Ollama (Green):</strong> A massive spike toward “Operational Ease,” reflecting its zero-friction user experience, but pulling back on raw performance metrics like continuous batching.</li><li><strong>ZML (Red):</strong> A smaller footprint overall, reflecting its early stage (low maturity), but showing strong potential in functional features due to its compiler-based architecture.</li></ul><h4>The QSOS Quadrant: Market Position</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Uiyi7MSGhTEY8t86.png" /><figcaption>QSOS Quadrant</figcaption></figure><p>This schema maps the tools based on their market adoption versus their raw production capabilities.</p><p><em>Caption: The QSOS Quadrant positions the tools based on Market Maturity vs. Production Power.</em></p><ul><li><strong>vLLM (The Leader):</strong> High Maturity, High Power. The safe, scalable choice for the enterprise.</li><li><strong>Ollama (The Specialist):</strong> High Maturity, Lower Production Power. The standard for a specific niche (local/consumer hardware), prioritizing usability over scale.</li><li><strong>ZML (The Visionary):</strong> Low Maturity, High Potential Power. An innovative approach that hasn’t yet proven itself in the broad market.</li></ul><h3>The Consolidated Score Sheet</h3><p>Below is the detailed breakdown of the evaluation scores that feed the charts above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ALTwlTE_xjX-MsJv6h3Vtg.png" /><figcaption>QSOS Evaluations</figcaption></figure><h3>Conclusion</h3><p>There is no single “best” inference engine. The right choice depends entirely on your specific context (the Qualification phase of QSOS).</p><h4>Choose vLLM if:</h4><p>You are building a production application that needs to serve many concurrent users. You have access to server-grade GPUs (NVIDIA A10G, A100, H100) and need features like dynamic LoRA adapters for multi-tenancy.</p><blockquote>If you are deploying to Kubernetes to serve customers, start here.</blockquote><h4>Choose Ollama if:</h4><p>You are a developer building locally on a Mac or Windows PC. You need a zero-friction way to test models, or you are deploying to edge devices where resources are constrained, and concurrency is low.</p><blockquote>If you just want to run Llama 3 on your laptop right now, download Ollama.</blockquote><h4>Choose ZML if:</h4><p>You are an ML systems engineer building a specialized hardware appliance (e.g., using TPUs or AMD chips) and need a runtime with absolutely zero Python dependencies and a tiny footprint. You are willing to build the server infrastucture around it yourself.</p><blockquote>If you are frustrated by PyTorch bloat and want a “build your own” adventure, look at ZML.</blockquote><h3>Note on Methodology</h3><p>For the purpose of this article, we utilized a <strong>simplified QSOS evaluation grid</strong>. We intentionally zoomed in on the “Best of Breed” criteria, the critical differentiators driving the current “Inference Wars”, to keep the comparison readable and actionable.</p><p>A <strong>full-fledged QSOS evaluation</strong> is significantly more exhaustive. It is structured as a hierarchical <strong>tree of criteria</strong> containing more data points, covering deep operational details such as:</p><ul><li><strong>Generic Attributes:</strong> Intellectual property management, roadmap visibility, bug tracking efficiency, and internationalization.</li><li><strong>Specific Sub-sections:</strong> Detailed granularity on security compliance (SOC2/GDPR), exact memory footprints, and specific driver version compatibility.</li></ul><p>While this article provides a strategic overview, a complete QSOS audit would involve drilling down from high-level “Sections” into specific “Leaves” to calculate a precise, weighted score for every possible business constraint.</p><p><em>Originally published at </em><a href="https://blog.worldline.tech/2026/01/29/llm-inference-battle.html"><em>https://blog.worldline.tech</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=689c54c92261" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Yoga of Image Generation — Part 1]]></title>
            <link>https://medium.com/@raphael.semeteys/the-yoga-of-image-generation-part-1-0d6ce5e88751?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d6ce5e88751</guid>
            <category><![CDATA[comfyui-workflow]]></category>
            <category><![CDATA[comfy-ui]]></category>
            <category><![CDATA[stable-diffusion]]></category>
            <category><![CDATA[sdxl]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 15:55:55 GMT</pubDate>
            <atom:updated>2025-02-11T16:10:13.447Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Yoga of Image Generation — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*KIMrDcQQHXxT70vU.png" /></figure><p>In this series of articles, I will introduce image generation using Stable Diffusion and ComfyUI. This first article discusses the theory and provides basic examples. My goal is to generate precise images of yoga poses using only your local machine. Due to legal restrictions, I cannot use images from the Internet. Given these limitations, how can generative AI assist?</p><h3>Stable Diffusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*bvT3UMvkietkG47B5F5u2g.png" /></figure><p>Let’s introduce Stable Diffusion, a family of models for image generation. It began in Germany as a collaboration between various companies and universities in 2021, focusing on the innovation called the <a href="https://en.wikipedia.org/wiki/Latent_diffusion_model">latent diffusion model</a>. Companies like Runway and EleutherAI participated in the project. Initially, <a href="https://stability.ai/">Stability AI</a> contributed computing resources, later hiring many of the original researchers, and is now the official maintainer of Stable Diffusion models.</p><p>These models are distributed under “open” licenses emphasizing responsible AI. There are some <a href="https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md">OpenRAIL</a> restrictions on their usage. From <a href="https://stability.ai/community-license-agreement">version 3.5</a> onwards, enterprises with over $1 million in revenue are required to pay a fee to Stability AI.</p><p>The open availability of these models has fostered a dynamic and contributing ecosystem. A community has emerged around fine-tuned versions and additional models like Refiners, Upscalers, ControlNets, and Low-Rank Adapters (which will be introduced in this series). This vibrant community also offers tools like user-friendly interfaces to interact with the models (such as Automatic1111 Web UI or ComfyUI) and tools to aid the fine-tuning process, like <a href="https://dreambooth.github.io/">Dreambooth</a> or <a href="https://github.com/bmaltais/kohya_ss">Kohya SS</a>. Platforms like <a href="https://huggingface.co/">Hugging Face</a> and <a href="https://civitai.com/">civitai.com</a> allow the community to share models, prompts, images, and tutorials.</p><h3>ComfyUI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*MDFJI1P3BCkjivkeildnAQ.png" /></figure><p><a href="https://www.comfy.org/">ComfyUI</a> is a fascinating GUI for Stable Diffusion that allows users to run Stable Diffusion models locally and create image generation workflows. It’s an intuitive, modular, and customizable platform distributed under the GPL 3 license.</p><p>Workflows interconnect nodes through links to design and execute processes like text-to-image or image-to-image generation. Custom nodes, contributed by the community, make it highly extensible. We’ll use ComfyUI throughout this tutorial series. Installation is straightforward and detailed [here]. To make the GUI more user-friendly, I recommend installing the following plugins:</p><p>As this tutorial series progresses, we’ll need to install additional custom nodes (using the ComfyUI Manager) to create increasingly complex workflows.</p><h3>Simple Text-to-Image Workflow</h3><p>Now that we’re set, let’s begin with a simple workflow: I want Stable Diffusion to generate an image of a girl doing yoga in a park.</p><p>Here is the workflow in ComfyUI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aPZKPxMJ3uCKco-xkfTyng.jpeg" /></figure><p>Watch the following <a href="https://github.com/raphiki/assets/raw/refs/heads/main/videos/comfyui-t2i-workflow.mp4">video</a> to see it in action.</p><p>All information and parameters of the workflow are embedded in the generated images as EXIF metadata. This allows you to load an image back into ComfyUI to visualize and manipulate its original workflow, very convenient!</p><p>Image generation relies on mathematical algorithms and calculations, meaning the same workflow with identical parameters always produces the same image.</p><p>We’ve generated our first image; let’s explain this simple workflow and its nodes.</p><h3>Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*qLuLFQtxh_cuNh_S-D9m9A.jpeg" /></figure><p>We’ll use Stable Diffusion models. The most popular versions are Stable Diffusion 1.5 and Stable Diffusion Extra Large, known as SDXL. Many fine-tuned models based on these versions are available, specialized in certain styles or subjects.</p><p>To install a model, download the checkpoint file and store it in a specific ComfyUI folder, or use the Manager or Workspace Manager to search and install it automatically.</p><p>For this initial tutorial, we’ll use the vanilla <a href="https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0">SDXL 1.0 model</a>.</p><h3>Prompts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*nsqj1C7MVPqQIVG9_hGlSQ.jpeg" /></figure><p>Prompts are a crucial part of the workflow. They guide generation based on text describing the desired image (positive prompt) and elements to avoid (negative prompt).</p><p>They utilize the <a href="https://openai.com/index/clip/">CLIP model</a> (Contrastive Language-Image Pretraining) created by OpenAI in 2021 under a MIT license. Trained on 400 million image-text pairs, it links descriptive text with images and handles a wide range of prompts. These prompts are converted into embeddings (mathematical vectors) to guide the model during generation.</p><p>Descriptions can be sentences or comma-separated keywords. Keywords or features can be weighted using commas or numbers, like ((yoga)) or (yoga:1.2).</p><p>Our positive prompt is: <em>girl, doing yoga, lotus pose, green eyes, cinematic lighting, long hair, ((blue yoga outfit)), best quality, park</em>.</p><h3>Latent Space</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*4yuGGFE4BvPwIeIoauKIcQ.jpeg" /></figure><p>The mathematical multi-dimensional space, known as Latent Space, is where the diffusion process occurs. The model works not on pixels but on a vectorial representation of the image.</p><p>This is why we must provide an empty Latent Image for the generation process in our workflow.</p><p>After transforming the Latent Image, it needs conversion back to a pixel-based image via a “VAE Decode” (Variational Autoencoder), an additional neural network.</p><h3>Generation Process</h3><p>The generation process unfolds step-by-step in the Latent Space, starting with a random image that is incrementally denoised with details guided by the prompts, illustrated in this <a href="https://github.com/raphiki/assets/raw/refs/heads/main/videos/stable-diffusion-denoising.mp4">video</a>.</p><p>The detailed final image is then decoded into pixels by the VAE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*0P5Q8dqzFJWu3PCoGu6kZQ.jpeg" /></figure><p>Several parameters can be adjusted in the KSampler node, responsible for this generation process:</p><ul><li>The seed determines the randomness of the initial noisy image</li><li>We keep the default number of steps at 20</li><li>CFG represents the guidance, the influence of prompts on the process</li><li>Various sampling and scheduling algorithms are available, differing in speed and quality; we’ll stick with the default for now</li><li>We set the denoising percentage to 100% (value of 1.00), given we provided a completely noisy image as input</li></ul><p>As explained earlier, due to the mathematical basis of this process, the same model, input image (here, the same seed), prompts, and sampling/scheduling parameters will always produce the exact same image.</p><p>When tweaking parameters and optimizing your workflow, it’s recommended to fix the seed initially to observe how changing inputs or parameters affects the final image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*CbARM1RGkiGxz4aeHpdntw.jpeg" /></figure><p>It captures the prompt features such as a blue yoga outfit, park, or long hair but isn’t quite the expected Lotus pose… So, how can we refine our prompts?</p><h3>Embeddings (Textual Inversions)</h3><p>Instead of an exhaustive prompt to describe image features, we can use Textual Inversions as shortcuts. Also called Embeddings, they are vector representations of text providing preset instructions for style, theme, texture, etc.</p><p>The community shares many <a href="https://civitai.com/search/models?sortBy=models_v9&amp;query=embedding">Embeddings</a> as downloadable files to be included in ComfyUI’s folders. Note that an Embedding cannot create something not already in the model itself, which is why we need Embeddings tailored to our SDXL model.</p><p>I’ve downloaded several Embeddings to determine the style of our image, so let’s test some by adding them to the positive prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*akHBAYiWq8mYdAeje-C5kg.jpeg" /></figure><p>Below are some output examples generated without changing anything in our initial workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZB5zryQ-MvjXIfQWS5YLDw.png" /></figure><p>Multiple Embeddings can be used in both positive and negative prompts. For instance, specific Embeddings are available to avoid poorly generated hands.</p><p>There are also Embeddings for poses, but not as precise as needed for generating yoga poses… Clearly, a simple Text-to-Image workflow isn’t sufficient for my requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bngqfhGOK4nhiwFc3ugLMA.png" /></figure><p>The poses are essentially incorrect, with even the first image failing to depict the desired Lotus yoga pose. How can we address the issue of pose accuracy? We’ll be experimenting with some new techniques in the second part of this tutorial.</p><p>In the meantime, have fun creating workflows in ComfyUI! Feel free to explore my YouTube tutorials as well.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FkXraePyAT-c%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkXraePyAT-c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FkXraePyAT-c%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/190ebce797f081f12d61ff62dac5eeeb/href">https://medium.com/media/190ebce797f081f12d61ff62dac5eeeb/href</a></iframe><p><em>Originally published at </em><a href="https://blog.worldline.tech/2025/02/11/sd-comfyui-part1.html"><em>https://blog.worldline.tech</em></a><em> on February 11, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d6ce5e88751" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better Call your Agent!]]></title>
            <link>https://medium.com/@raphael.semeteys/better-call-your-agent-144fe9ff0d69?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/144fe9ff0d69</guid>
            <category><![CDATA[aml]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Sun, 26 May 2024 10:41:30 GMT</pubDate>
            <atom:updated>2024-05-29T11:43:16.438Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*LdUZv3VVx2rMbivn16LP_A.png" /></figure><p>The hype around language models like ChatGPT has been explosive — the real “Breaking Bad” moment of AI. But just like Walter White realized there was more to the game, the true players know language is just the start. So if you’re ready to call in the heavy hitters that can actually get stuff done, you better call Saul… I mean your Agent ;)</p><p>Well, enough with this far-fetched pun. As my fellow compatriot Yan LeCun, Chief AI Scientist at Meta, recently affirmed at the Vivatech conference: generative AI has only 5 years left to live. Large Language Models are not the future of artificial intelligence because they lack four key characteristics: understanding the real world, having persistent memory, reasoning, and planning ability.</p><p>This article introduces AI Agents, how they work, how they differ from Chatbots and Copilots, and how Agentic AI represent the next step after the current hype around LLMs. In the world beyond the linguistic fireworks, a new breed of AI systems is emerging — one that doesn’t just process language but perceives, reasons, and acts upon the world around them.</p><h3>What are AI Agents?</h3><p>At their core, AI Agents are software systems that can perceive their environment, process that information, and take actions to achieve specific goals. Unlike traditional programs that simply follow a predefined set of rules, agents can make decisions and adapt their behavior based on the current state of their environment and their objectives.</p><p>AI Agents are often described as having properties like autonomy, reactivity, pro-activeness, and goal-orientedness. They can operate without constant human supervision, respond to changes in their environment, take the initiative to achieve their goals, and persistently work towards those objectives over extended periods. They interact with their environment through various modalities, such as vision, robotics, and control systems, in addition to natural language.</p><p>While ChatBots and language models are typically focused on generating human-like responses, Agents are designed to achieve specific goals efficiently, even if their actions may not always appear “human-like.”</p><h3>How AI Agents Work</h3><p>At the heart of an AI agent lies a decision-making process that determines how the agent should act in a given situation. This process typically involves several key components:</p><ol><li><strong>Perception</strong>: Agents receive inputs from their environment through sensors, such as cameras, microphones, or other data sources. This sensory information is processed and used to build an internal representation of the current state of the environment.</li><li><strong>State Estimation</strong>: Based on the perceived inputs and the agent’s prior knowledge, it estimates the actual state of the environment. This step often involves handling uncertainties, noise, and incomplete information.</li><li><strong>Goal Setting</strong>: Agents have predefined goals or objectives they are trying to achieve. These goals can be static or dynamically adjusted based on the agent’s current state and the environment.</li><li><strong>Planning</strong>: Given the current state and the desired goal, the agent generates a plan or a sequence of actions that it believes will lead to achieving the goal. This may involve techniques like search algorithms, decision trees, or reinforcement learning.</li><li><strong>Action Selection</strong>: The agent chooses the best action to take based on its plan and the current state. This decision-making process may involve evaluating the potential rewards and risks associated with each action.</li><li><strong>Action Execution</strong>: The chosen action is then executed, potentially changing the state of the environment.</li></ol><p>This cycle of perception, state estimation, planning, and action execution repeats continuously, allowing the agent to adapt its behavior based on the changing environment and progress towards its goals.</p><p>One of the key challenges in developing AI agents is teaching them how to make good decisions and take effective actions in complex, uncertain environments. This is where techniques like reinforcement learning come into play.</p><p>Reinforcement learning algorithms allow agents to learn from experience by taking actions in an environment and receiving rewards or penalties based on the outcomes of those actions. Over many iterations, the agent learns to associate certain actions with positive or negative outcomes, gradually refining its decision-making strategy to maximize long-term rewards.</p><p>Large Action Models (LAMs) are a specific type of AI agent that leverages deep reinforcement learning techniques to learn how to perform complex, multi-step tasks by taking sequences of actions over extended time horizons. These models can learn intricate behaviors in simulated environments before transferring that knowledge to real-world robotics or control systems.</p><h3>Agents vs. ChatBots and Copilots</h3><p>While Chatbots, Copilots, and Agents all fall under the umbrella of Artificial Intelligence, they differ significantly in their design, capabilities, and intended use cases. Understanding these differences is crucial to appreciate the potential of Agentic AI and Large Action Models (LAMs).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Sb6-m-BqQzylueNb88kFSw.png" /></figure><p><em>ChatBots</em><br> ChatBots are designed primarily for natural language interaction with humans. Their main purpose is to understand and respond to user queries or commands in a conversational manner. They are typically built using Natural Language Processing (NLP) techniques, such as intent recognition, entity extraction, and language generation.</p><p>While ChatBots can be quite sophisticated in their language abilities, they are generally limited to the domain of text-based communication. They cannot directly perceive or interact with the physical world beyond the text interface.</p><p><em>Copilots</em><br> Copilots, or Digital Assistants, are a step up from ChatBots in terms of functionality. They are designed to assist users with a wider range of tasks, such as scheduling appointments, setting reminders, and retrieving information from various sources.</p><p>Copilots often integrate with other software applications and services, allowing them to perform actions like sending emails, creating calendar events, or controlling smart home devices. However, like ChatBots, their primary mode of interaction is still through natural language.</p><p><em>AI Agents</em><br> Unlike ChatBots and Copilots, Agents are not limited to natural language interaction. They are designed to perceive and interact with their environment through various modalities, such as vision, robotics, and control systems. They can navigate physical spaces, manipulate objects, and even control complex systems like vehicles or industrial machinery.</p><p>Moreover, agents are goal-oriented, meaning they are designed to achieve specific objectives rather than just responding to user queries or commands. They can plan and execute sequences of actions over extended periods to reach their goals, adapting their behavior based on the changing environment.</p><p>Agentic AI and Large Action Models (LAMs) take this concept of goal-oriented agents even further. LAMs are a class of AI agents that leverage deep reinforcement learning techniques to learn how to perform complex, multi-step tasks by taking sequences of actions over long time horizons.</p><p>These models can learn intricate behaviors in simulated environments and then transfer that knowledge to real-world robotics or control systems, enabling them to tackle a wide range of challenges, from playing complex games to controlling autonomous vehicles or industrial robots.</p><h3>The Potential of Agentic AI and Large Action Models</h3><p>Agentic AI and LAMs (re)opens up a vast array of potential applications and possibilities.</p><p><em>Robotics and Automation</em><br> One of the most obvious applications is in the field of robotics and automation. These models could enable robots to learn and perform intricate tasks autonomously, from assembling products in factories to exploring remote or hazardous environments. By training in simulated environments, LAMs could acquire the necessary skills before being deployed in the real world, reducing the need for extensive manual programming and improving safety.</p><p><em>Autonomous Vehicles</em><br> Self-driving cars are often cited as a prime example of the potential of Agentic AI. LAMs could be trained in highly realistic simulations to navigate complex urban environments, anticipate and respond to unpredictable situations, and make split-second decisions to ensure the safety of passengers and pedestrians. This could accelerate the development and deployment of fully autonomous vehicles. For instance, companies like Tesla and Waymo are already exploring the integration of AI agents that can manage these sophisticated tasks independently.</p><p><em>Gaming and Virtual Environments</em><br> LAMs have already shown impressive results in mastering complex games and virtual environments, such as playing strategy games at superhuman levels or navigating 3D worlds. As these models continue to advance, they could lead to more intelligent and adaptive non-player characters (NPCs) in video games, as well as more realistic and engaging virtual simulations for training purposes.</p><p><em>Healthcare and Scientific Research</em><br> Agentic AI and LAMs could also have a significant impact on fields like healthcare and scientific research. These models could be trained to analyze complex medical data, simulate biological processes, or even control robotic surgical systems, potentially leading to more accurate diagnoses, personalized personalized treatments, and advanced medical procedures.</p><p>In scientific research, LAMs could be used to explore and analyze vast amounts of data, identify patterns and relationships, and even design and conduct virtual experiments, accelerating the pace of scientific discovery and innovation.</p><h3>Examples of Agentic AI in Action</h3><ol><li><a href="https://autodroid-sys.github.io/"><strong>Autodroid</strong></a>: This system automates mobile tasks on Android devices using LLMs to generate instructions based on app-specific knowledge. It creates UI transition graphs to help LLMs understand GUI information and states, enabling it to complete tasks like deleting events from a calendar without direct user intervention.</li><li><a href="https://www.lavague.ai/"><strong>LaVague</strong></a>: This open-source project marks a significant advancement in LAM technology by enabling the development of AI Web Agents. LaVague facilitates the automation of web interactions by converting natural language instructions into Selenium code, making it possible to perform complex tasks on the web efficiently and intuitively.</li><li><a href="https://www.rabbit.tech/"><strong>Rabbit R1</strong></a>: Developed by Rabbit Research, this device uses LAMs to execute complex tasks across applications like Spotify, Uber, and DoorDash by learning from user interactions. It bypasses the need for APIs by focusing on understanding the structure and logic of applications.</li></ol><p>These examples illustrate how Agentic AI and LAMs can bridge the gap between understanding human intentions and executing tasks in digital environments, making them a powerful tool for enhancing human-computer interaction.</p><h3>Conclusion — A New Era of Intelligent Agents</h3><p>The development of intelligent agents capable of perceiving, reasoning, and acting in complex environments is not just an incremental advancement, but a paradigm shift that could reshape the way we think about and interact with AI systems.</p><p>These Agents, powered by LAMs and deep reinforcement learning techniques, are not mere passive respondents or narrow task performers. They are autonomous, goal-oriented entities that can adapt and learn from experience, continuously refining their decision-making strategies to achieve their objectives more efficiently.</p><p>However, as with any transformative technology, the rise of Agentic AI also raises important ethical and societal questions. Issues of safety, transparency, and accountability must be carefully considered as we develop increasingly capable and autonomous AI systems. We must ensure that these agents are aligned with human values and that their actions are governed by clear ethical principles and guidelines.</p><p>By focusing on the realistic capabilities and carefully evaluating the impact of these technologies, we can harness the full potential of Agentic AI and Large Action Models to drive innovation and improve our daily lives across various domains.</p><p><em>Originally published at </em><a href="https://dev.to/worldlinetech/better-call-your-agent-3fp3"><em>https://dev.to</em></a><em> on May 26, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=144fe9ff0d69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Jan]]></title>
            <link>https://medium.com/@raphael.semeteys/introducing-jan-2a53572b7fa8?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a53572b7fa8</guid>
            <category><![CDATA[jan]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[gen-ai-tools]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Sun, 05 May 2024 17:57:41 GMT</pubDate>
            <atom:updated>2024-05-07T08:38:09.653Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*2Q1OAukvy12LFZqw.png" /></figure><p>I really like LM Studio and its capability to simplify the utilization of local models on my personal computer. The project is ever-evolving, supporting an expanding range of models and features. However, as <a href="https://medium.com/@raphael.semeteys/introducing-lm-studio-408ef71a8c9e">I noted several months ago</a>, it is not open source.</p><p>As we continue this blog series, let’s explore a <strong>fully open-source alternative to LM Studio</strong> — <a href="https://jan.ai/">Jan</a>, a project from Southeast Asia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/226/1*Fga3Q2bNZrri_ER3qUOOZw.png" /></figure><h3>Jan: A Highly Versatile, Open Platform</h3><p>Jan’s slogan is <em>Turn your computer into an AI computer</em>. This solution, designed to optimize any device’s performance — be it PCs or multi-GPU clusters, is available as a desktop version for MacOS, Windows, and Linux. Furthermore, it can also be deployed as a server on public Cloud or on premises.</p><p>This platform allows you to run LLMs locally and offline, or connect to remote GenAI APIs. Jan’s philosophical principles are rooted in <a href="https://www.inkandswitch.com/local-first/"><em>local-first</em></a> and <a href="https://stephango.com/file-over-app"><em>file over app</em></a> approaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*Yw0EtBRc9Ac-zV4GT31Vrg.png" /></figure><p>Jan incorporates a lightweight, built-in inference server called <a href="https://nitro.jan.ai/">Nitro</a>. Nitro supports both llama.cpp and NVIDIA’s TensorRT-LLM engines. This means many open LLMs in the <strong>GGUF format</strong> are supported. Jan’s <em>Model Hub</em> is designed for easy installation of pre-configured models but it also allows you to install virtually any model from Hugging Face or even your own.</p><p>Jan goes a step further by integrating with other local engines like LM Studio and <a href="https://ollama.com/">ollama</a>.</p><p>Jan’s interoperability even extends to exposing these LLMs through a <a href="https://jan.ai/api-reference">server API</a>. This API is compatible with the widely-recognized , simplifying its integration with many components of the GenAI ecosystem!</p><p>Importantly, Jan is free software (think ‘<em>freedom</em>’) licensed under <a href="https://github.com/janhq/jan/blob/dev/LICENSE"><strong>Affero GPL</strong></a>. This grants anyone the liberty to run it offline, self-host, or modify it. Note that this license applies copyleft aspect also to network distribution, ensuring Cloud/SaaS providers contribute back to the core project and community.</p><p>Jan’s open source philosophy can also be seen in its design for <a href="https://jan.ai/docs/extensions">extensions</a> and TypeScript API, making it user-friendly for <a href="https://github.com/janhq/jan/tree/dev/extensions/model-extension">customization and extension</a> by anyone.</p><p>Now that we’ve introduced Jan, let’s demonstrate how easy it is to use.</p><h3>Installation and Use of Local Models</h3><p>You can easily browse and install pre-configured models from the <em>Model Hub</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DmTVLIrG1V8n0z6fHNBt7g.png" /></figure><p>I prefer importing and reusing the models I’ve previously downloaded for LM Studio to achieve storage optimization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*nR-CyCTS1XJSMCaAxxsaiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*aLN1G1UoCLGwUtbTYQuK_w.png" /></figure><p>From the <em>Thread</em> panel, I can simply select the model (Llama 3, in this case), define the assistant and model parameters (I just tweaked the Max Token value to 200), and initiate a new Thread.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*7WmGnWUObjiXQZqqB5PwIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*teww3l6dIHVDm43rVPuXfQ.png" /></figure><h3>Using Jan as a Server</h3><p>Configuring <strong>Jan Desktop as a Local API Server</strong> and monitoring its logs is straightforward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*WWUFXnNFSzT-ZjCBRCqwjw.png" /></figure><p>Next, you can make OpenAI-like API calls to the server, as shown here from a Jupyter JavaScript Notebook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gT1FhRatP7YufRx7R1IzIw.png" /></figure><p><em>(For more information on using a JavaScript Notebook with GenAI APIs, refer to this </em><a href="https://medium.com/@raphael.semeteys/in-bed-with-gpt-and-node-js-816f9d1bea4b"><em>previous article</em></a><em> and my </em><a href="https://www.youtube.com/playlist?list=PLpEPN3tmJMNaQg4spmz1y2kGcqFaE2_8m"><em>GenAI’s Lamp</em></a><em> YouTube Series)</em>.</p><p><strong>Jan Server</strong> can also be independently deployed (no GUI) in <a href="https://jan.ai/docs/server-installation/onprem">Docker or Kubernetes</a> for on-premise or Cloud running. Detailed instructions for AWS, GCP, and Azure are available in the project’s <a href="https://jan.ai/docs/">documentation</a>).</p><h3>Conclusion</h3><p>The Jan project is ever-expanding, promising many more enhancements and features — all visible thanks to its <em>build in the open philosophy</em> — on the <a href="https://github.com/orgs/janhq/projects/5/views/31">roadmap</a>.</p><p>AFter activating the <em>Experimental Mode</em>, you can preview upcoming features, such as the promising <a href="https://jan.ai/docs/tools/retrieval">Retrieval</a> tool, designed to implement the RAG pattern and chat with PDF documents.</p><p>So definitely stay tuned for updates!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*szqoIxT7_v6fgbwmjn1Xcw.png" /></figure><p><em>Originally published at </em><a href="https://dev.to/raphiki/introducing-jan-38b9"><em>https://dev.to</em></a><em> on May 5, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a53572b7fa8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discover the new OpenAI Embeddings APIs]]></title>
            <link>https://medium.com/@raphael.semeteys/discover-the-new-openai-embeddings-apis-18bb5d825a61?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/18bb5d825a61</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[embedding]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Tue, 30 Jan 2024 07:57:55 GMT</pubDate>
            <atom:updated>2024-01-30T09:23:59.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*75i6GI0P8SQBzVaY.png" /></figure><p>Dive into the latest advancements in AI with OpenAI’s newly released Embeddings models. This guide offers a detailed exploration of their capabilities and integration using Node.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*s3dyTxrlzW04fko-S5a_Gg.png" /></figure><p>To begin, you’ll need a paid account and an <a href="https://platform.openai.com/account/api-keys">API key</a>. Store the key in a <em>.env</em> file as shown:</p><pre>GPT_KEY=sk-&lt;the-rest-of-your-OpenAI-key&gt;</pre><p>Then, incorporate it into the execution context:</p><pre>var dotenv = require(&quot;dotenv&quot;);<br>dotenv.config();</pre><h3>Embeddings</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*MzNG7JiHWygflduXHzXh4g.png" /></figure><p>Embeddings are numerical representations of concepts in sequences of numbers, enabling computers to grasp the relationships between these concepts.</p><p>They facilitate tasks like clustering, search, or retrieval in machine learning models and algorithms, powering applications like similarity search or Retrieval Augmented Generation (RAG).</p><p>The current OpenAI Embedding models include:</p><ul><li><em>text-embedding-ada-002</em>: the older model</li><li><em>text-embedding-3-small</em>: smaller and more efficient</li><li><em>text-embedding-3-large</em>: larger and more robust</li></ul><p>The first model was launched in December 2022 as the second generation of OpenAI embedding models.</p><p>The latter two, introduced in January 2024, represent the third generation. They are multilingual, and boast improved performance and cost-efficiency.</p><h3>Simple API Calls</h3><p>Now, let’s use and compare these three Embeddings models with straightforward API calls, vectorizing a short sentence for each. We’ll employ the <a href="https://js.langchain.com/">LangChain</a> framework for simpler coding.</p><h3>text-embedding-ada-002</h3><pre>var { OpenAIEmbeddings } = require (&quot;langchain/embeddings/openai&quot;);<br><br>var embedV2 = new OpenAIEmbeddings({<br>  openAIApiKey: process.env.GPT_KEY,<br>  modelName: &quot;text-embedding-ada-002&quot;<br>});<br><br>async function getEmbedding(embedModel) {<br>    var res = await embedModel.embedQuery(&quot;The GenAI&#39;s Lamp makes your wishes come true!&quot;);<br>    console.log(res);<br>}<br><br>getEmbedding(embedV2);</pre><pre>[<br>   0.0027452074,   -0.017593594,  -0.0027131883,  -0.004108542,  -0.018618202,<br>     0.01779582,    -0.01828116,   -0.018550793,  -0.010603342,  -0.032140326,<br>    0.011425724,    0.011553801,  -0.0012276756, -0.0043411013,   0.014856813,<br>  -0.0052881893,    0.021799877,   -0.005918458,   0.007313812, -0.0053320047,<br>  -0.0073407753,    0.029551845,  -0.0033299753,  -0.022837967,  -0.015935346,<br>   -0.014020949,     0.01811938,   -0.022527888,   0.001973381,   0.020896606,<br>    0.016582469,  -0.0013363716,   -0.010684232,   -0.01580053, -0.0146141425,<br>    0.005365709,    0.005244374,   0.0154365245,   0.012261589, -0.0070104743,<br>     0.03329975, -0.00082912337, -0.00095467153,  0.0071318094,  -0.022999749,<br>  0.00013039313,  -0.0026980215,    0.011459429,  -0.009282137,  -0.003784982,<br>   0.0011189795,    0.009201247,   0.0031311205,  -0.029713625,  -0.018550793,<br>   -0.004266952,   -0.006033052,   -0.013299678,   0.012490777,  -0.015530896,<br>  -0.0035659047,   -0.017431814,    -0.01371761,  0.0035456822,  -0.002020567,<br>  -0.0057870117,   -0.001467818,    0.001700377, -0.0005839253,  -0.026127499,<br>    0.026815064,   -0.009039467,    0.008351902, -0.0017155439,   0.012079586,<br>   -0.009416955,   -0.003383902,    0.013110935,  -0.011722322,   0.005564564,<br>    0.013926577,   -0.010758381,   0.0044556954,  0.0018217121,   0.006039793,<br>    0.013845687,     -0.0044894,     0.01539608,   -0.03135839,  -0.025884828,<br>    0.002613761,    0.018105898,    0.024671476,  -0.006488059,  -0.002575001,<br>    0.009962962,    0.003953503,     0.01106172,    0.00212505,  -0.020222522,<br>  ... 1436 more items<br>]</pre><p>This approach yields a <strong>1536-dimensional vector</strong>.</p><h3>text-embedding-3-small</h3><pre>var embedV3Small = new OpenAIEmbeddings({<br>  openAIApiKey: process.env.GPT_KEY,<br>  modelName: &quot;text-embedding-3-small&quot;<br>});<br><br>getEmbedding(embedV3Small);</pre><pre>[<br>    0.002214067,    -0.0390087,   0.018476259,   0.010861045,  -0.0148632545,<br>    -0.08788707,  -0.014547484,  0.0018661683,  -0.007196635,   -0.046058465,<br>   -0.042856697,   -0.01036903,   -0.04447227,  -0.056515615,    0.044149153,<br>   -0.011771639,   -0.03827435, -0.0089150155,   0.002790532,    0.014885285,<br>     0.01837345, -0.0025592116,  -0.003936119,  -0.043855414,   -0.014180309,<br>   0.0022526202,   0.033280768,   0.028683731,   0.034103237,   0.0045162556,<br>    0.009105947,  -0.026421933,   -0.00768865,  -0.060451735,   -0.028815914,<br>    0.054253817,   0.030372739,   0.012087409,  -0.052755743,  -0.0114118075,<br>  -0.0003013132,  -0.023102667,   0.019004991,   0.038832456,    0.008870955,<br>    0.035777558,  -0.027523458,   0.018123772,   0.011242907,     0.03704064,<br>   0.0027483068,   0.050082706,  -0.039831173,   0.022779554,    -0.06239042,<br>  -0.0043032942, -0.0072076507,     0.0390087, -0.0020084486,   -0.015685728,<br>   0.0077327113,   0.026157565, -0.0041821264,   0.011852417,   -0.030225867,<br>   -0.008290818,  -0.031958934,    0.05384258,  0.0028602954, -0.00078024744,<br>   -0.021619279,   0.053049482,  -0.042974193,  -0.052902613,    0.011749608,<br>  -0.0069836737,  -0.008826894,   0.042474836,   0.005610438,    0.015318552,<br>   -0.016302582,   -0.02092899,   -0.06773649,   -0.02780251,  -0.0008949897,<br>   -0.077018686,  -0.022485813,  -0.013732355,   -0.03886183,    0.008386283,<br>    0.005999644,  -0.019460289,  -0.064446606, -0.0129833175,   0.0063227583,<br>    0.050082706,   0.026642237,  -0.010075289, 0.00020527393,    0.062331673,<br>  ... 1436 more items<br>]</pre><p>Here, the vector maintains the same dimensionality, but the values differ.</p><h3>text-embedding-3-large</h3><pre>var embedV3Large = new OpenAIEmbeddings({<br>  openAIApiKey: process.env.GPT_KEY,<br>  modelName: &quot;text-embedding-3-large&quot;<br>});<br><br>getEmbedding(embedV3Large);</pre><pre>[<br>   -0.004331901,  -0.04381693, -0.014906949,   -0.017649338,  -0.015994713,<br>    -0.00707429,  0.019074155, -0.011957733,     0.04482809,   0.019870825,<br>   -0.023976749,  0.016469652, -0.012333088,    0.001856666,   0.014753743,<br>    0.004757048, -0.017863827,  0.016546255,    0.029890502,  -0.031591088,<br>   -0.034226235,  -0.02886402,  0.032173272,   0.0036118329,    0.05542995,<br>   0.0050672903, -0.014317106, -0.008993195,   -0.027347282,   0.023088153,<br>  -0.0037248223,  0.006269958,  0.053652763,    -0.03266353,  -0.023639694,<br>  -0.0069670454,  0.033552125, 0.0072543067,   -0.033215072, -0.0063925227,<br>    -0.02373162,  0.015481472, -0.021050513,    -0.02100455,   -0.03128468,<br>  -0.0027921805,   0.02023852,  0.004531069,  -0.0059060934, -0.0011088288,<br>    0.018522613,  0.002074027,  -0.01795575,    0.018277483,   0.016224522,<br>    0.015075476,  0.030028388, -0.008173543,    0.027331961,   0.022322122,<br>   -0.015872147, 0.0068636313, -0.061833967,    0.025922464,  -0.026948946,<br>    -0.06143563,   0.02400739,   0.05037415,    0.030901661,   0.032203913,<br>   -0.016484972, 0.0050443094, -0.066859126,   -0.013865149,   0.028772097,<br>  -0.0070244977,  0.010785706, 0.0056456435,    0.019135436,  0.0020893477,<br>     0.03035012,  0.015205701,  0.050159663,   -0.012792706, -0.0034011744,<br>   0.0043357313, -0.016806705,  -0.04973069, -0.00027744658,  -0.039435238,<br>   -0.004473617,  0.044552322, -0.013229343,     -0.0237929,  0.0027174924,<br>    0.016607536, -0.013367228, 0.0004562668,   -0.015619358,   0.068881445,<br>  ... 2972 more items<br>]</pre><p>This time, the vector expands to <strong>3072 dimensions</strong>, doubling the size of the first two models.</p><h3>Shortening Embeddings</h3><p>The latest OpenAI models now also allow for embedding shortening. This means you can truncate numbers from the end of the returned vectors without losing semantic value. This feature optimizes the size and cost of local vector stores using the <em>dimensions</em> parameter.</p><p>Let’s demonstrate this with direct API calls, as LangChainJS does not yet support the <em>dimensions</em> parameter.</p><pre>fetch(&#39;https://api.openai.com/v1/embeddings&#39;, {<br>  method: &quot;POST&quot;,<br>  headers: { <br>    &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    &quot;Authorization&quot;: &quot;Bearer &quot; + process.env.GPT_KEY,<br>  },<br>  body: JSON.stringify({<br>    model: &quot;text-embedding-3-small&quot;,<br>    input: &quot;The GenAI&#39;s Lamp makes your wishes come true!&quot;,<br>    dimensions: 512<br>  })<br>})<br>  .then((response) =&gt; response.json())<br>  .then((json) =&gt; console.log(json.data[0].embedding));</pre><pre>[<br>    0.0032793144,  -0.057776842,   0.027365686,   0.016086586,  -0.022014368,<br>     -0.13017192,  -0.021546671,  0.0027640322,  -0.010659131,   -0.06821844,<br>     -0.06347621,   -0.01535785,   -0.06586908,   -0.08370681,   0.065390505,<br>    -0.017435294,  -0.056689173,   -0.01320427,  0.0041331323,   0.022046998,<br>     0.027213413, -0.0037905176,  -0.005829892,  -0.064955436,  -0.021002838,<br>    0.0033364168,    0.04929304,    0.04248425,    0.05051123,  0.0066891485,<br>     0.013487063,  -0.039134238,  -0.011387868,    -0.0895367,   -0.04268003,<br>       0.0803568,   0.044985883,   0.017902989,   -0.07813796,  -0.016902337,<br>  -0.00044628314,  -0.034217987,   0.028148808,     0.0575158,    0.01313901,<br>     0.052991107,  -0.040765736,   0.026843607,   0.016652172,   0.054861896,<br>    0.0040705916,    0.07417885,  -0.058995027,   0.033739414,   -0.09240814,<br>   -0.0063737254,  -0.010675446,   0.057776842, -0.0029747677,  -0.023232555,<br>    0.0114531275,   0.038742676, -0.0061942604,   0.017554937,   -0.04476835,<br>    -0.012279754,   -0.04733524,     0.0797477,  0.0042364607, -0.0011556456,<br>      -0.0320209,   0.078573026,  -0.063650236,   -0.07835549,   0.017402662,<br>    -0.010343708,  -0.013073751,   0.062910624,   0.008309771,   0.022688722,<br>    -0.024146196,  -0.030998493,   -0.10032635,   -0.04117905, -0.0013255934,<br>     -0.11407445,  -0.033304345,  -0.020339362,  -0.057559308,   0.012421151,<br>     0.008886235,   -0.02882316,  -0.095453605,  -0.019229943,   0.009364808,<br>      0.07417885,   0.039460536,  -0.014922784, 0.00030403674,    0.09232113,<br>  ... 412 more items<br>]</pre><pre>fetch(&#39;https://api.openai.com/v1/embeddings&#39;, {<br>  method: &quot;POST&quot;,<br>  headers: { <br>    &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    &quot;Authorization&quot;: &quot;Bearer &quot; + process.env.GPT_KEY,<br>  },<br>  body: JSON.stringify({<br>    model: &quot;text-embedding-3-large&quot;,<br>    input: &quot;The GenAI&#39;s Lamp makes your wishes come true!&quot;,<br>    dimensions: 1024<br>  })<br>})<br>  .then((response) =&gt; response.json())<br>  .then((json) =&gt; console.log(json.data[0].embedding));</pre><pre>[<br>  -0.0058769886,   -0.0594454, -0.020223908,   -0.023944441,   -0.02169965,<br>   -0.009597522,  0.025877457, -0.016222775,     0.06081722,   0.026958281,<br>    -0.03252869,  0.022343988,  -0.01673201,   0.0025188948,   0.020016057,<br>   0.0064537753, -0.024235433,  0.022447914,     0.04055174,  -0.042858887,<br>   -0.046433926, -0.039159138,   0.04364872,   0.0049000885,    0.07520051,<br>   0.0068746735,  -0.01942368, -0.012200857,   -0.037101414,   0.031323154,<br>  -0.0050533786,  0.008506305,   0.07278944,   -0.044313844,   -0.03207142,<br>   -0.009452026,   0.04551938,  0.009841748,    -0.04506211,  -0.008672585,<br>   -0.032196127,  0.021003349, -0.028558735,   -0.028496379,  -0.042443186,<br>  -0.0037880854,  0.027457124,  0.006147195,   -0.008012658,  -0.001504322,<br>    0.025129192, 0.0028137837, -0.024360143,    0.024796631,   0.022011427,<br>    0.020452544,  0.040738806, -0.011088854,    0.037080627,   0.030283898,<br>    -0.02153337,  0.009311727,  -0.08388869,      0.0351684,     -0.036561,<br>   -0.083348274,   0.03257026,   0.06834143,    0.041923556,    0.04369029,<br>   -0.022364773,  0.006843496,   -0.0907062,    -0.01881052,   0.039034426,<br>   -0.009529971,  0.014632714, 0.0076593114,    0.025960596,  0.0028345687,<br>    0.041175295,  0.020629218,   0.06805044,   -0.017355563, -0.0046142936,<br>    0.005882185, -0.022801261,  -0.06746845, -0.00037640528,   -0.05350086,<br>   -0.006069251,  0.060443085, -0.017947938,   -0.032279268,   0.003686758,<br>    0.022531055, -0.018135004, 0.0006190064,   -0.021190414,    0.09344983,<br>  ... 924 more items<br>]</pre><h3>Comparing RAG Usage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2HvlN500qzAUgeAorHFxg.png" /></figure><p>Let’s explore the RAG pattern with a single PDF file and assess the outcomes. Up to now, we’ve focused on obtaining embedding vectors. It’s time to put them to use.</p><p>Before invoking a Completion API, we first retrieve relevant information from local sources (like documents) based on the user’s prompt.</p><p>Here’s how we can apply this technique with a single PDF document.</p><pre>var { PDFLoader } = require(&quot;langchain/document_loaders/fs/pdf&quot;);<br>var { MemoryVectorStore } = require (&quot;langchain/vectorstores/memory&quot;);<br>var { ChatOpenAI } = require (&quot;langchain/chat_models/openai&quot;);<br>var { RetrievalQAChain } = require(&quot;langchain/chains&quot;);<br><br>// Access to ChatCompletion API<br>var chat = new ChatOpenAI({<br>  openAIApiKey: process.env.GPT_KEY,<br>  modelName: &quot;gpt-4&quot;<br>});<br><br>var question = &quot;Summarize the content of the document&quot;;<br><br>async function getVectorStores() {<br>  //Load our local PDF document<br>  var loader = new PDFLoader(&quot;LLM Openness.pdf&quot;);<br>  var docs = await loader.load();<br><br>  //Create a vectorstore from text-embedding-ada-002 vectors<br>  var vectorStoreV2 = await MemoryVectorStore.fromDocuments(<br>    docs,<br>    embedV2<br>  );<br><br>  //Create a vectorstore from text-embedding-3-small vectors<br>  var vectorStoreV3Small = await MemoryVectorStore.fromDocuments(<br>    docs,<br>    embedV3Small<br>  );<br><br>  //Create a vectorstore from text-embedding-3-large vectors<br>  var vectorStoreV3Large = await MemoryVectorStore.fromDocuments(<br>    docs,<br>    embedV3Large<br>  );<br><br>  //RAG with text-embedding-ada-002 vectors<br>  var chainV2 = RetrievalQAChain.fromLLM(<br>    chat, <br>    vectorStoreV2.asRetriever()<br>  );<br><br>  await chainV2.call({ query: question })<br>    .then((res) =&gt; console.log(&quot;\n\nWith text-embedding-ada-002:\n&quot; + res.text));<br><br>  //RAG with text-embedding-3-small vectors<br>  var chainV3Small = RetrievalQAChain.fromLLM(<br>    chat, <br>    vectorStoreV3Small.asRetriever()<br>  );<br><br>  await chainV3Small.call({ query: question })<br>    .then((res) =&gt; console.log(&quot;\n\nWith text-embedding-3-small:\n&quot; + res.text));<br><br>  //RAG with text-embedding-3-large vectors<br>  var chainV3Large = RetrievalQAChain.fromLLM(<br>    chat, <br>    vectorStoreV3Large.asRetriever()<br>  );<br><br>  await chainV3Large.call({ query: question })<br>    .then((res) =&gt; console.log(&quot;\n\nWith text-embedding-3-large:\n&quot; + res.text));<br><br>}<br><br>getVectorStores();</pre><p>With text-embedding-ada-002:</p><pre>The document discusses the concept of openness in Generative AI, specifically focusing on Language Learning Models (LLMs). The authors present a framework to evaluate the level of openness of an LLM and its potential for use and reuse.<br><br>The document covers the evolution of LLMs and their key components, starting with the early Natural Language Processing (NLP) methods like Word2Vec and GloVe, and leading to revolutionary models like Google&#39;s BERT and OpenAI&#39;s GPT series. <br><br>Openness in AI is framed using a score system: Score 1 signifies research only with no extra info; Score 2 represents restricted access; Score 3 implies openness with certain usage limitations; and Score 4 indicates total openness with zero restrictions.<br><br>The authors argue that true openness in AI does not just imply access to open source models or datasets, but also to the frameworks and ecosystems supporting these models. They stress that clarity about licensing terms is paramount for collaborative development.<br><br>The document makes a case for the &quot;Linux moment&quot; of AI, referring to a future where freedom of innovation and collaborative work, along with commercial enterprise, becomes the norm.<br><br>The authors also discuss LLMs such as LLaMA, acknowledging their contribution to the field despite their limited openness. They note a trend toward open AI, emphasizing collaboration, transparency, and democratization, and argue that the choices made now will shape the future of technology and digital society.</pre><p>With text-embedding-3-small:</p><pre>The document discusses the level of openness in Generative AI, specifically focusing on various AI models developed by OpenAI, Google, and Meta (formerly Facebook). <br><br>OpenAI&#39;s GPT-3 and GPT-4 models were initially open source but subsequent versions are not as open. ChatGPT&#39;s components, like model weights, fine-tuning dataset, reward model, and data processing code, are not publicly released. <br><br>Similarly, Google initially emphasized openness in AI, as seen in the open-source nature of Google’s BERT model, but moved towards proprietary models, such as Bard powered by PaLM 2, which is not open source. <br><br>In contrast, Meta&#39;s strategy fluctuated between open-source and proprietary stances. RoBERTa, an open-source model, was well-received, while LLM was proprietary and led to criticism. Later, Meta introduced LLaMA, a model that is publicly accessible but has limitations or restrictions under its license.<br><br>Overall, OpenAI, Google, and Meta appear to have shifted from open-source research to a more proprietary, commercial approach to safeguard intellectual assets and mitigate the misuse of models.</pre><p>With text-embedding-3-large:</p><pre>The document titled &quot;How Open is Generative AI?&quot; by Luxin Zhang and Raphaël Semeteys explores the history, current landscape, and future of openness in the development of Large Language Models (LLMs). The authors draw parallels between the AI landscape and the shared history of open source software and the internet, both of which transitioned from academic research to business-centric phenomena. The challenges and progress in the realm of Generative AI are compared to the Linux movement in terms of openness and collective construction.<br><br>The document discusses the nuances of licenses, sharing, and reusing different components, such as foundational model, weights, datasets, and code. It proposes a framework to evaluate the level of openness of a LLM and the potential restrictions to its use and reuse. A range of scores from 1 to 4 is suggested to represent different levels of openness, from research papers only with no other information (score 1) to a model totally open without restriction (score 4).<br><br>The evolution of Generative AI is said to fluctuate between open collaboration and proprietary control. Centralization of AI computing power tends to support closed-source solutions, while democratization supports open-source alternatives. The authors emphasize the importance of shared knowledge, collective growth, and freedom to innovate within the open AI movement. The decisions made now about centralization versus democratization and closing or opening up will shape not only the future of technology but also our digital society.</pre><p>Results with the three different embedding models show variations in the depth and detail of the extracted information. The <em>text-embedding-3-large</em> vectors seem to provide longer and more detailed responses, although it&#39;s challenging to draw definitive conclusions from a single document.</p><h3>Conclusion</h3><p>In summary, OpenAI&#39;s latest release of the Embeddings models - <em>text-embedding-ada-002</em>, <em>text-embedding-3-small</em>, and <em>text-embedding-3-large</em> - marks a significant advancement in the field of machine learning and natural language processing. These models offer varied capabilities, from efficient, compact vector representations to more detailed, robust embeddings, catering to a diverse range of applications.</p><p>Our exploration through Node.js and the LangChain framework demonstrates the practicality and versatility of these models. Whether it&#39;s generating concise vectors with the ability to shorten embeddings or harnessing the power of the Retrieval Augmented Generation (RAG) pattern for in-depth information retrieval, these models open up new possibilities for developers and researchers alike.</p><p>What stands out is the ease of integration and the potential for optimization in terms of performance and cost-effectiveness. The ability to tailor the embeddings&#39; dimensions offers a notable advantage, particularly for applications where storage and computational efficiency are crucial.</p><p>As we continue to delve into the capabilities of these models, it becomes evident that the choices made by developers today will significantly shape the future landscape of AI applications. The OpenAI Embeddings models, with their improved multilingual support and enhanced performance, are poised to play a pivotal role in the evolution of AI, pushing the boundaries of what&#39;s possible in the realms of language understanding and information processing.</p><p><em>Originally published at </em><a href="https://dev.to/worldlinetech/discover-the-new-openai-embeddings-apis-3pj3"><em>https://dev.to</em></a><em> on January 30, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18bb5d825a61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Open is Generative AI? Part 2]]></title>
            <link>https://medium.com/@raphael.semeteys/how-open-is-generative-ai-part-2-b3aee13cec2c?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3aee13cec2c</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[dataset]]></category>
            <category><![CDATA[openness]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 16:52:49 GMT</pubDate>
            <atom:updated>2023-12-20T08:47:55.008Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*5of5h2LlFv_4rC-I.jpg" /></figure><p>Embarking on the second and last part of our ‘<a href="https://medium.com/@raphael.semeteys/how-open-is-generative-ai-part-1-51c2d2880782">Generative AI Openness</a>’ series, we earlier established a straightforward framework to gauge the openness of Large Language Models (LLMs) and utilized it to explore LLM development and the positioning of key players. We noticed a trend towards increasingly restricted LLM artifacts for OpenAI and Google, contrasted with Meta’s more open approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Nah0VmPOQ34DdkLV.png" /></figure><p>Now, let’s venture into the realm of collaboration and reuse, keeping our openness matrix in mind, to uncover the multifaceted nature of openness in LLMs.</p><p>Before we delve into the specifics of different models, their development, and openness, let’s start by considering the openness of some well-known LLMs from a broad perspective.</p><p><strong>LLM Model Openness in a Nutshell</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*joQOb2Wd1e2X-4RJIpShKg.png" /></figure><p>We often come across news about a new open-source LLM being released. However, upon closer examination, we find that accessing the model weights or using the model without restrictions is generally feasible. Nevertheless, it is often challenging to reproduce the work due to the unavailability of training datasets or missing data processing code. Additionally, the table shows that many models lack fine-tuning with a reward model, which is crucial for the success of current LLMs and plays a significant role in reducing hallucination and toxicity. Even in the case of the most open models, either no reward model is utilized or the reward model is not publicly accessible.</p><p>In the following sections, we will provide details of the LLM models mentioned in the table above, introduce their evolution, and explain their openness score.</p><h3>1. Fine-tuned Models from Llama 2</h3><p>Concluding the first part of this series, we highlighted two fine-tuned models based on Llama 2, subject to Meta’s licensing constraints. Let’s evaluate their openness level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*8vB84c1VXC0665ST.png" /></figure><p><a href="https://crfm.stanford.edu/2023/03/13/alpaca.html">Alpaca</a> is an instruction-oriented LLM derived from LLaMA, enhanced by Stanford researchers with a dataset of 52,000 examples of following instructions, sourced from OpenAI’s <a href="https://openai.com/research/instruction-following">InstructGPT</a> through the self-instruct method. The extensive self-instruct dataset, details of data generation, and the model refinement code were publicly disclosed. This model complies with the licensing requirements of its base model. Due to the utilization of InstructGPT for data generation, it also adheres to OpenAI’s <a href="https://openai.com/policies/terms-of-use">usage terms</a>, which prohibit the creation of models competing with OpenAI. This illustrates how dataset restrictions can indirectly affect the resulting fine-tuned model.</p><p><a href="https://lmsys.org/blog/2023-03-30-vicuna/">Vicuna</a> is another instruction-focused LLM rooted in LLaMA, developed by researchers from UC Berkeley, Carnegie Mellon University, Stanford, and UC San Diego. They adapted Alpaca’s training code and incorporated 70,000 examples from <a href="https://sharegpt.com/">ShareGPT</a>, a platform for sharing ChatGPT interactions.</p><p><strong>Alpaca and Vicuna Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*Vg-MbKWqgmo6-klcMu-5yQ.png" /></figure><p><em>Significantly, both projects face dual constraints: initially from LLaMA’s licensing on the model and subsequently from OpenAI due to their fine-tuning data.</em></p><h3>2. Collaboration and Open Source in LLM Evolution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*EGHp3D2k_qZ9H_2F.png" /></figure><p>In addition to the foundation model Llama and its associated families of fine-tuned LLMs, there are many initiatives that contribute to promoting the openness of foundational models and their fine-tuned ones.</p><h3>2.1. Foundational Models and Pre-training Datasets</h3><p>The research highlights the cost-effectiveness of developing instruction-tuned LLMs atop foundational models through collaborative efforts and reutilization. This approach necessitates the availability of genuinely open-source foundational models and pre-training datasets.</p><h4>2.1.1 EleutherAI</h4><p>This vision is in line with <a href="https://www.eleuther.ai/">EleutherAI</a>, a non-profit organization founded in July 2020 by a group of researchers. Driven by the perceived opacity and the challenge of reproducibility in AI, their goal was to create leading open-source language models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*iupUCkbRdzPvE73O.jpg" /></figure><p>By December 2020, EleutherAI had introduced <a href="https://pile.eleuther.ai/">The Pile</a>, a comprehensive text dataset designed for training models. Subsequently, tech giants such as Microsoft, Meta, and Google used this dataset for training their models. In March 2021, they revealed <a href="https://github.com/EleutherAI/gpt-neo">GPT-Neo</a>, an open-source model under Apache 2.0 license, which was unmatched in size at its launch. EleutherAI’s later projects include the release of <a href="https://huggingface.co/EleutherAI/gpt-j-6b">GPT-J</a>, a 6 billion parameter model, and GPT-NeoX, a 20 billion parameter model, unveiled in February 2022. Their work demonstrates the viability of high-quality open-source AI models.</p><p><strong>EleutherAI GPT-J Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*1hJJ2FWRGbHRasAXq0_wGQ.png" /></figure><h4>2.1.2 Falcon</h4><p>In March 2023, a research team from the <a href="https://www.tii.ae/">Technology Innovation Institute</a> (TII) in the United Arab Emirates introduced a new open model lineage named <a href="https://falconllm.tii.ae/">Falcon</a>, along with its <a href="https://huggingface.co/datasets/tiiuae/falcon-refinedweb">dataset</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*v1Dg479wbHxof7n8.jpg" /></figure><p>Falcon features two versions: the initial with 40 billion parameters trained on one trillion tokens, and the subsequent with 180 billion parameters trained on 3.5 trillion tokens. The latter is said to rival the performance of models like LLaMA 2, PaLM 2, and GPT-4. TII emphasizes Falcon’s distinctiveness in its training data quality, predominantly sourced from public web crawls (~80%), academic papers, legal documents, news outlets, literature, and social media dialogues. Its licensing, <a href="https://falconllm.tii.ae/terms-and-conditions.html">based on the open-source Apache License</a>, allows entities to innovate and commercialize using Falcon 180B, including hosting on proprietary or leased infrastructure. However, it explicitly prohibits hosting providers from exploiting direct access to shared Falcon 180B instances and its refinements, especially through API access. Due to this clause, its license does not fully align with OSI’s open-source criteria.</p><p><strong>Falcon Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*ypMUTQZc8YLMyXEwIW2qaw.png" /></figure><h4>2.1.3 LAION</h4><p>Highlighting the international scope of this field, consider LAION and BLOOM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*NGQqEa_0vQijqqWV.png" /></figure><p><a href="https://laion.ai/">LAION</a> (Large-scale Artificial Intelligence Open Network), a German non-profit established in 2020, is dedicated to advancing open-source models and datasets (primarily under Apache 2 and MIT licenses) to foster open research and the evolution of benevolent AI. Their datasets, encompassing both images and text, have been pivotal in the training of renowned text-to-image models like Stable Diffusion.</p><h4>2.1.4 BLOOM</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*VITBS2ZBbefTae6R.png" /></figure><p><a href="https://bigscience.huggingface.co/blog/bloom">BLOOM</a>, boasting 176 billion parameters, is capable of generating text in 46 natural and 13 programming languages. It represents the culmination of a year-long collaboration involving over 1000 researchers from more than 70 countries and 250 institutions, which concluded with a 117-day run on the Jean Zay French supercomputer. Distributed under an <a href="https://www.licenses.ai/ai-licenses">OpenRAIL license</a>, BLOOM is not considered fully open-source due to usage constraints, such as prohibitions against harmful intent, discrimination, or interpreting medical advice.</p><p><strong>BLOOM Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*dccAaDF0Z4pI_ETm5UKI6w.png" /></figure><h4>2.1.5 OpenLLaMA and RedPajama</h4><p><a href="https://together.ai/blog/redpajama">RedPajama</a>, initiated in 2022 by Together AI, a non-profit advocating AI democratization, playfully references LLaMA and the children’s book “Llama Llama Red Pajama”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*vuvJxF4jie50lytO.jpg" /></figure><p>The initiative has expanded to include partners like Ontocord.ai, ETH DS3Lab, Stanford CRFM, Hazy Research, and MILA Québec AI Institute. In April 2023, they released a 1.2 trillion token <a href="https://github.com/togethercomputer/RedPajama-Data">dataset</a>, mirroring LLaMA’s dataset, for training their models. These <a href="https://together.ai/models">models</a>, with parameters ranging from 3 to 7 billion, were released in September, licensed under open-source Apache 2.</p><p>The RedPajama dataset was adapted by the <a href="https://github.com/openlm-research/open_llama">OpenLLaMA project</a> at UC Berkeley, creating an open-source LLaMA equivalent without Meta’s restrictions. The model’s later version also included data from Falcon and StarCoder. This highlights the importance of open-source models and datasets, enabling free repurposing and innovation.</p><p><strong>OpenLLaMa Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*OKHbvJT1j5P8k7nScyQkPg.png" /></figure><h4>2.1.6 MistralAI</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*uwL8iL0H0sLg4Axz.png" /></figure><p><a href="https://mistral.ai/">MistralAI</a>, a French startup, developed a 7.3 billion parameter LLM named Mistral for various applications. Committed to open-sourcing its technology under Apache 2.0, the training dataset details for Mistral remain undisclosed. The Mistral Instruct model was fine-tuned using publicly available instruction datasets from the Hugging Face repository, though specifics about the licenses and potential constraints are not detailed. Recently, MistralAI released Mixtral 8x7B, a model based on the sparse mixture of experts (SMoE) architecture, consisting of several specialized models (likely eight, as suggested by its name) activated as needed.</p><p><strong>Mistral and Mixtral Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*uY4QyrPgy57lcFTSs2ygqA.png" /></figure><p>These examples illustrate the diverse approaches to openness in foundational models, emphasizing the value of sharing and enabling reuse by others.</p><h3>2.2. Fine-tuned Models and Instruction Datasets</h3><p>When pre-trained models and datasets are accessible with minimal restrictions, various entities can repurpose them to develop new foundational models or fine-tuned variants.</p><h4>2.2.1 Dolly</h4><p>Drawing inspiration from LLaMA and the fine-tuned projects like Alpaca and Vicuna, the big data company Databricks introduced <a href="https://www.databricks.com/blog/2023/03/24/hello-dolly-democratizing-magic-chatgpt-open-models.html">Dolly 1.0</a> in March 2022.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*L9dR4APodtyc3xlK.png" /></figure><p>This cost-effective LLM was built upon EleutherAI’s GPT-J, employing the data and training methods of Alpaca. Databricks highlighted that this model was developed for under $30, suggesting that significant advancements in leading-edge models like ChatGPT might be more attributable to specialized instruction-following training data than to larger or more advanced base models. Two weeks later, Databricks launched <a href="https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm">Dolly 2.0</a>, still based on the EleutherAI model, but now exclusively fine-tuned with a pristine, human-curated instruction dataset created by Databricks’ staff. They chose to open source the entirety of Dolly 2.0, including the training code, dataset, and model weights, making them suitable for commercial applications. By May 2023, Databricks had acquired MosaicML, a company that had just released its <a href="https://huggingface.co/mosaicml/mpt-7b">MPT</a> (MosaicML Pre-trained Transformer) foundational model under the Apache 2.0 license, allowing anyone to train, refine, and deploy their own MPT models.</p><p><strong>Dolly Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*q8kSWe8uEwJst_m2P5OwUQ.png" /></figure><h4>2.2.2 OpenAssistant</h4><p><a href="https://github.com/LAION-AI/Open-Assistant">OpenAssistant</a> stands as another example of the potential of open source fine-tuning datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*pVtLzb_Uxh_ca54I.png" /></figure><p>This initiative aims to create an open-source, chat-based assistant proficient in understanding tasks, interacting with third-party systems, and retrieving dynamic information. Led by LAION and international contributors, a unique aspect of this project is its reliance on <a href="https://open-assistant.io/">crowdsourcing</a> for data collection from human volunteers. The OpenAssistant team has initiated numerous crowdsourcing tasks to gather data for various tasks, such as generating diverse text formats — from poems and code to emails and letters — and providing informative responses to queries. Recently, the LAION initiative also released an open-source dataset named <a href="https://laion.ai/blog/oig-dataset/">OIG</a> (Open Instruction Generalist), comprising 43M instructions, focusing on data augmentation rather than human feedback.</p><h4>2.2.3 BLOOMChat</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*wD6vcMaw6fta2gT7.png" /></figure><p><a href="https://sambanova.ai/blog/introducing-bloomchat-176b-the-multilingual-chat-based-llm/">BLOOMChat</a>, a fine-tuned chat model with 176 billion parameters, demonstrates the reuse of previous models and datasets. It underwent instruction tuning based on the BLOOM foundational model, incorporating datasets like OIG, OpenAssistant, and Dolly.</p><p><strong>BLOOMChat Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*EPZZnv_JQ5MgwzI63bBznA.png" /></figure><h4>2.2.4 Zephyr</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*WqlrPZKFR1-f9Loe.jpg" /></figure><p>Zephyr serves as another exemplary case of reutilizing an open foundational model. It is a fine-tuned version of the Mistral 7B model developed by the <a href="https://huggingface.co/HuggingFaceH4">Hugging Face H4</a> project. It was fine-tuned using filtered versions of the <a href="https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k">UltraChat</a> and <a href="https://huggingface.co/datasets/openbmb/UltraFeedback">UltraFeedback</a> datasets. These datasets were generated using ShareGPT and GPT-4, potentially imposing some transitive use restrictions on the resulting model.</p><p><strong>Zephyr Openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*cIgTtHywGRFr-CEmFLsHzQ.png" /></figure><h4>2.2.5 LLM360</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*_IWZORSAM8moqOos.png" /></figure><p><a href="https://www.llm360.ai/">LLM360</a> is an emerging yet intriguing initiative focused on ensuring complete openness of all essential elements required for training models. This includes not only model weights but also checkpoints, training datasets, and source code for data preprocessing and model training. The project is a collaborative effort between the Mohamed bin Zayed University of Artificial Intelligence (MBZUAI) in the UAE and two American AI companies. It has introduced two foundational models: Amber, a 7 billion parameter English LLM, and CrystalCoder, a 7 billion parameter LLM specializing in code and text. Additionally, there are fine-tuned versions of these models, including AmberChat.</p><p><strong>AmberChat openness</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*wzOlJqunUAlIGu49KWFO9A.png" /></figure><p>An assessment of the openness of AmberChat reveals that while the Amber foundational model is quite open, providing unrestricted access to weights, dataset, and code, the fine-tuning process in AmberChat introduces certain limitations to this initial level of openness.</p><p>These diverse examples highlight how openness enables global collaboration, allowing entities to repurpose earlier models and datasets in ways typical of the research community. This approach clarifies licensing nuances and fosters external contributions. And it’s this spirit of collaborative and community-driven innovation that is championed by a notable player: Hugging Face.</p><h3>2.3. The Hugging Face Ecosystem</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*k038ASvosaXuL-Pp.png" /></figure><p>The <a href="https://huggingface.co/">Hugging Face</a> initiative represents a community-focused endeavor, aimed at advancing and democratizing artificial intelligence through open-source and open science methodologies. Originating from the Franco-American company, Hugging Face, Inc., it’s renowned for its <a href="https://huggingface.co/docs/transformers/index">Transformers library</a>, which offers open-source implementations of transformer models for text, image, and audio tasks. In addition, it provides libraries dedicated to dataset processing, model evaluation, simulations, and machine learning demonstrations.</p><p>Hugging Face has spearheaded two significant scientific projects, BigScience and BigCode, leading to the development of two large language models: BLOOM and Pygmalion. Moreover, the initiative curates a <a href="https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard">LLM leaderboard</a>, allowing users to upload and assess models based on text generation tasks.</p><p>However, in my opinion, the truly revolutionary aspect is the <a href="https://huggingface.co/docs/hub/index">Hugging Face Hub</a>. This online collaborative space acts as a hub where enthusiasts can explore, experiment, collaborate, and create machine learning-focused technology. Hosting thousands of models, datasets, and demo applications, all transparently accessible, it has quickly become the go-to platform for open AI, similar to GitHub in its field. The Hub’s user-friendly interface encourages effortless reuse and integration, cementing its position as a pivotal element in the open AI landscape.</p><h3>3. On the Compute Side</h3><h3>3.1 Computing Power</h3><p>Generative AI extends beyond software, a reality clearly understood by entities like Microsoft/OpenAI and Google as Cloud service providers. They benefit from the ongoing effort to enhance LLM performance through increased computing resources.</p><p>In September, AWS announced an investment of $4 billion in Anthropic, whose models will be integrated into Amazon Bedrock, developed, trained, and deployed using AWS AI chips.</p><p>NVIDIA is at the forefront of expanding computing capacity with its GPUs. This commitment is reflected in their <a href="https://developer.nvidia.com/cuda-toolkit">CUDA</a> (Compute Unified Device Architecture) parallel computing platform and the associated programming model. Additionally, NVIDIA manages the <a href="https://github.com/NVIDIA/NeMo">NeMo</a> conversational AI toolkit, which serves both research purposes and as an enterprise-grade framework for handling LLMs and performing GPU-based computations, whether in the Cloud or on personal computers.</p><p>The <a href="https://www.reuters.com/technology/intel-says-newest-laptop-chips-software-will-handle-generative-ai-2023-09-19/">AI chip</a> recently unveiled by Intel signifies a major advancement in user empowerment over LLM applications. Diverging from Cloud providers’ strategies, Intel’s aim is to penetrate the market for AI chips suitable for operations outside data centers, thus enabling the deployment of LLMs on personal desktops, for example, through its <a href="https://github.com/openvinotoolkit">OpenVINO</a> open-source framework.</p><p>This field is characterized by dynamic competition, with companies like AMD and Alibaba making notable inroads into the AI chip market. The development of proprietary AI chips by Cloud Service Providers (CSPs), such as Google’s TPU and AWS’s Inferentia, as well as investments by startups like SambaNova, Cerebras, and Rain AI (backed by Sam Altman), further intensifies this competition.</p><h3>3.2 Democratizing AI Computing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*_EjURRVRgDX7IAIT.png" /></figure><p>The <a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a> project, initiated by researchers at the University of Freiburg, exemplifies efforts to democratize AI and drive innovation by promoting CPU-compatible models. It’s a C++ implementation of the LLaMA algorithm, originally designed for use on MacBooks and now also supporting x86 architectures. Employing quantization, which reduces LLMs’ size and computational demands by converting model weights from floating-point to integer values, this project created the GGML binary format for efficient model storage and loading. Recently, GGML was succeeded by the more versatile and extensible GGUF format.</p><p>Since its launch in October 2022, llama.cpp has quickly gained traction among researchers and developers for its scalability and compatibility across MacOS, Linux, Windows, and Docker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/0*jGE5OaHGE55OeLus.png" /></figure><p>The <a href="https://gpt4all.io/">GPT4All</a> project, which employs llama.cpp, aims to train and deploy LLMs on conventional hardware. This ecosystem democratizes AI by allowing researchers and developers to train and deploy LLMs on their hardware, thus circumventing costly cloud computing services. This initiative has enhanced the accessibility and affordability of LLMs. GPT4All includes a variety of models derived from GPT-J, MPT, and LLaMA, fine-tuned with datasets including ShareGPT conversations. However, the limitations mentioned earlier are important to consider. The ecosystem also features a chat desktop application, as previously discussed in a <a href="https://medium.com/@raphael.semeteys/introducing-gpt4all-780f58a79d85">related article</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*TiJQuMnR4tSppfA7.png" /></figure><p><a href="https://localai.io/">LocalAI</a> is another open-source project designed to facilitate running LLMs locally. Previously introduced in a <a href="https://medium.com/@raphael.semeteys/introducing-localai-0afb34ab6d75">dedicated article</a>, LocalAI leverages llama.cpp and supports GGML/GGUF formats and Hugging Face models, among others. This tool simplifies deploying an open model on a standard computer or within a container, integrating it into a larger, distributed architecture. The <a href="https://medium.com/@raphael.semeteys/from-local-ai-to-enterprise-grade-deployment-with-bionicgpt-2c5d8d436794">BionicGPT</a> open-source project exemplifies its usage.</p><h3>Conclusion</h3><p>The evolution of Generative AI mirrors broader technological advancements, fluctuating between open collaboration and proprietary control. The AI landscape, as illustrated by the rise and diversification of LLMs, stands at a crossroads. On one side, tech giants drive towards commercialization and centralization, leveraging immense AI potential and vast computational resources. On the other, a growing movement champions open AI, emphasizing collaboration, transparency, and democratization.</p><p>The LLaMA project, despite its limited openness, has inspired numerous others, as evident in names like Alpaca, Vicuna, Dolly, Goat, Dalai (a play on Dalai Lama), Redpajama, and more. We may soon see other animal-themed projects joining this AI menagerie, perhaps flying alongside Falcon?</p><p>The range of projects from LLaMA to Falcon, and platforms like Hugging Face, highlight the vitality of the open AI movement. They remind us that while commercial interests are crucial for innovation, the spirit of shared knowledge and collective growth is equally essential. The “Linux moment” of AI beckons a future where openness entails not just access, but also the freedom to innovate, repurpose, and collaborate.</p><p>In our view, the centralization of AI computing power tends to lean towards closed-source solutions, whereas its democratization inherently supports open-source alternatives.</p><p>As AI increasingly permeates our lives, the choices we make now — whether to centralize or democratize, to close or open up will shape not just the future of technology, but the essence of our digital society. This moment of reckoning urges us to contemplate the kind of digital world we wish to create and pass on to future generations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3aee13cec2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAG Tutorial: Exploring AnythingLLM and Vector Admin]]></title>
            <link>https://medium.com/@raphael.semeteys/rag-tutorial-exploring-anythingllm-and-vector-admin-eddb6e738a08?source=rss-14bd2bb449db------2</link>
            <guid isPermaLink="false">https://medium.com/p/eddb6e738a08</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[vector-database]]></category>
            <dc:creator><![CDATA[Raphiki]]></dc:creator>
            <pubDate>Sat, 09 Dec 2023 11:13:11 GMT</pubDate>
            <atom:updated>2023-12-15T08:09:06.770Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*7ppdeIEaKLzRJBSx.png" /></figure><p>This tutorial is designed with a dual purpose in mind. Firstly, it introduces two highly innovative open-source projects from <a href="https://mintplexlabs.com/">Mintplex Labs</a>. These are <a href="https://github.com/Mintplex-Labs/anything-llm">AnythingLLM</a>, an enterprise-grade solution engineered for the creation of custom ChatBots, inclusive of the RAG pattern, and <a href="https://github.com/Mintplex-Labs/vector-admin">Vector Admin</a>, a sophisticated admin GUI for the effective management of multiple vectorstores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*PyULfzWasaU0ZbR_.png" /></figure><p>The second aim of this tutorial is to guide you through the deployment of local models, specifically for text embedding and generation, as well as a vectorstore, all designed to integrate seamlessly with the aforementioned solutions. For this, we’ll be utilizing <a href="https://github.com/mudler/LocalAI">LocalAI</a> in conjunction with <a href="https://github.com/chroma-core/chroma">Chroma</a>.</p><p>So, strap in and let’s embark on this informative journey!</p><h3>Installing the Chroma Vectorstore</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/0*8bM8-qaGwj8pM6ww.png" /></figure><p>The process begins with cloning the official repository and initiating the Docker container.</p><pre>git clone https://github.com/chroma-core/chroma.git<br>cd chroma<br>docker compose up -d --build</pre><p>To verify the availability of the vectorstore, we connect to its API documentation located at: <a href="http://localhost:8000/docs">http://localhost:8000/docs</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*1xrwHO5okiJU8Qjx.png" /></figure><p>Using this API, we proceed to create a new collection, aptly named ‘playground’.</p><pre>curl -X &#39;POST&#39; &#39;http://localhost:8000/api/v1/collections?tenant=default_tenant&amp;database=default_database&#39; <br>  -H &#39;accept: application/json&#39; <br>  -H &#39;Content-Type: application/json&#39; <br>  -d &#39;{ &quot;name&quot;: &quot;playground&quot;, &quot;get_or_create&quot;: false}&#39;</pre><p>Following this, we check the result to ensure proper setup.</p><pre>curl http://localhost:8000/api/v1/collections<br><br>[<br>  {<br>    &quot;name&quot;: &quot;playground&quot;,<br>    &quot;id&quot;: &quot;0072058d-9a5b-4b96-8693-c314657365c6&quot;,<br>    &quot;metadata&quot;: {<br>      &quot;hnsw:space&quot;: &quot;cosine&quot;<br>    },<br>    &quot;tenant&quot;: &quot;default_tenant&quot;,<br>    &quot;database&quot;: &quot;default_database&quot;<br>  }<br>]</pre><h3>Implementation of LocalAI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*87zAWOGqN4OG7NML.png" /></figure><p>Next, our focus shifts to establishing the LocalAI Docker container.</p><pre>git clone https://github.com/go-skynet/LocalAI<br>cd LocalAI<br>docker compose up -d --pull always</pre><p>Once the container is operational, we embark on downloading, installing, and testing two specific models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/127/0*aHb7-ztU4JcdEvSG.png" /></figure><p>Our first model is the sentence-transformers embedding model from Bert: MiniLM L6.</p><pre>curl http://localhost:8080/models/apply <br>  -H &quot;Content-Type: application/json&quot; <br>  -d &#39;{ &quot;id&quot;: &quot;model-gallery@bert-embeddings&quot; }&#39;<br><br>curl http://localhost:8080/v1/embeddings <br>  -H &quot;Content-Type: application/json&quot; <br>  -d &#39;{ &quot;input&quot;: &quot;The food was delicious and the waiter...&quot;,<br>        &quot;model&quot;: &quot;bert-embeddings&quot; }&#39;<br><br>{<br>  &quot;created&quot;: 1702050873,<br>  &quot;object&quot;: &quot;list&quot;,<br>  &quot;id&quot;: &quot;b11eba4b-d65f-46e1-8b50-38d3251e3b52&quot;,<br>  &quot;model&quot;: &quot;bert-embeddings&quot;,<br>  &quot;data&quot;: [<br>    {<br>      &quot;embedding&quot;: [<br>        -0.043848168,<br>        0.067443006,<br>    ...<br>        0.03223838,<br>        0.013112408,<br>        0.06982294,<br>        -0.017132297,<br>        -0.05828256<br>      ],<br>      &quot;index&quot;: 0,<br>      &quot;object&quot;: &quot;embedding&quot;<br>    }<br>  ],<br>  &quot;usage&quot;: {<br>    &quot;prompt_tokens&quot;: 0,<br>    &quot;completion_tokens&quot;: 0,<br>    &quot;total_tokens&quot;: 0<br> }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*dgdbmA7wiejiZg_f.png" /></figure><p>Subsequently, we explore the LLM: Zephyr-7B-β from Hugging Face, a refined version of the foundational Mistral 7B model.</p><pre>curl http://localhost:8080/models/apply <br>  -H &quot;Content-Type: application/json&quot; <br>  -d &#39;{ &quot;id&quot;: &quot;huggingface@thebloke__zephyr-7b-beta-gguf__zephyr-7b-beta.q4_k_s.gguf&quot;, <br>        &quot;name&quot;: &quot;zephyr-7b-beta&quot; }&#39;<br><br>curl http://localhost:8080/v1/chat/completions <br>  -H &quot;Content-Type: application/json&quot; <br>  -d &#39;{ &quot;model&quot;: &quot;zephyr-7b-beta&quot;, <br>        &quot;messages&quot;: [{<br>          &quot;role&quot;: &quot;user&quot;, <br>          &quot;content&quot;: &quot;Why is the Earth round?&quot;}], <br>        &quot;temperature&quot;: 0.9 }&#39;<br><br>{<br>  &quot;created&quot;: 1702050808,<br>  &quot;object&quot;: &quot;chat.completion&quot;,<br>  &quot;id&quot;: &quot;67620f7e-0bc0-4402-9a21-878e4c4035ce&quot;,<br>  &quot;model&quot;: &quot;thebloke__zephyr-7b-beta-gguf__zephyr-7b-beta.q4_k_s.gguf&quot;,<br>  &quot;choices&quot;: [<br>    {<br>      &quot;index&quot;: 0,<br>      &quot;finish_reason&quot;: &quot;stop&quot;,<br>      &quot;message&quot;: {<br>        &quot;role&quot;: &quot;assistant&quot;,<br>        &quot;content&quot;: &quot;\nThe Earth appears round because it is<br>actually a spherical body. This shape is a result of the <br>gravitational forces acting upon it from all directions. The force <br>of gravity pulls matter towards the center of the Earth, causing <br>it to become more compact and round in shape. Additionally, the <br>Earth&#39;s rotation causes it to bulge slightly at the equator, <br>further contributing to its roundness. While the Earth may appear <br>flat from a distance, up close it is clear that our planet is <br>indeed round.&quot;<br>      }<br>    }<br>  ],<br>  &quot;usage&quot;: {<br>    &quot;prompt_tokens&quot;: 0,<br>    &quot;completion_tokens&quot;: 0,<br>    &quot;total_tokens&quot;: 0<br>  }<br>}</pre><h3>Deploying and Setting Up AnythingLLM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/0*oT3rwBRMON8gMsg7.png" /></figure><p>Having successfully installed the models and vectorstore, our next step is to deploy the AnythingLLM application. For this, we will utilize the official Docker image provided by Mintplex Labs.</p><pre>docker pull mintplexlabs/anythingllm:master<br>docker run -p 3001:3001 mintplexlabs/anythingllm:master</pre><p>Access to the application is achieved through navigating to <a href="http://localhost:3001/">http://localhost:3001</a>, where we can begin the configuration process using the intuitive GUI.</p><p>In the configuration, we opt for the LocalAI backend, accessible via the <a href="http://172.17.0.1:8080/v1">http://172.17.0.1:8080/v1</a> URL, and integrate the Zephyr model. It’s noteworthy that AnythingLLM also supports other backends such as OpenAI, Azure OpenAI, Anthropic Claude 2, and the locally available <a href="https://dev.to/worldlinetech/introducing-lm-studio-54f1">LM Studio</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*x08fJClDoQ61_zv8.png" /></figure><p>Following this, we align our embedding model with the same LocalAI backend, ensuring a cohesive system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*pXjs7Ze6ov_x1hL9.png" /></figure><p>Next, we select the Chroma vector database, using the URL <a href="http://172.17.0.1:8000/">http://172.17.0.1:8000</a>. It’s important to mention that AnythingLLM is also compatible with other vectorstores such as Pinecone, QDrant, Weaviate, and LanceDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*s1m1zpYpJKsUxj8Y.png" /></figure><p>Customization options for AnythingLLM include the possibility of adding a logo to personalize the instance. However, for the sake of simplicity in this tutorial, we will skip this step. Similarly, while there are options for configuring user and rights management, we will proceed with a streamlined, single-user setup.</p><p>We then proceed to create a workspace, aptly named “Playground,” reflecting the name of our earlier Chroma collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*iLBUbSJ2vHqS2ZAR.png" /></figure><p>The AnythingLLM start page is designed to offer initial instructions to the user in a chat-like interface, with the flexibility to tailor this content to specific needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*2HVzJTfgZh1EoL0M.png" /></figure><p>From our “Playground” workspace, we can upload documents, further expanding the capabilities of our setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*OP7z3K-kmlYQVpSa.png" /></figure><p>We monitor the logs to confirm that AnythingLLM is effectively inserting the corresponding vectors into Chroma.</p><pre>Adding new vectorized document into namespace playground<br>Chunks created from document: 4<br>Inserting vectorized chunks into Chroma collection.<br>Caching vectorized results of custom-documents/techsquad-3163747c-a2e1-459c-92e4-b9ec8a6de366.json to prevent duplicated embedding.<br>Adding new vectorized document into namespace playground<br>Chunks created from document: 8<br>Inserting vectorized chunks into Chroma collection.<br>Caching vectorized results of custom-documents/techsquad-f8dfa1c0-82d3-48c3-bac4-ceb2693a0fa8.json to prevent duplicated embedding.</pre><p>This functionality enables us to engage in interactive dialogues with the documents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*DZtUVxLnPXDrwStu.png" /></figure><p>An interesting feature of AnythingLLM is its ability to display the content that forms the basis of its responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*c0LY2m_4qM2lQ1eN.png" /></figure><p>In conclusion, AnythingLLM and each workspace within it offer a range of configurable parameters. These include the system prompt, response temperature, chat history, and the threshold for document similarity, among others, allowing for a customized and efficient user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/0*SWR_axWFJ89nyJEb.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*URXf0AbkvEU-k2fL.png" /></figure><h3>Installing and Configuring Vector Admin</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/0*M0q6bAU0r2jvcak4.png" /></figure><p>To complete our architecture, we now focus on installing the Vector Admin GUI, which serves as a powerful tool for visualizing and managing the vectors stored by AnythingLLM in Chroma.</p><p>The installation process involves utilizing Docker containers provided by Mintplex Labs: one for the Vector Admin application and another for a PostgreSQL database, which stores the application’s configuration and chat history.</p><pre>git clone https://github.com/Mintplex-Labs/vector-admin.git<br>cd vector-admin/docker/<br>cp .env.example .env</pre><p>We modify the .env file to adjust the server port from 3001 to 3002, avoiding a conflict with the port already in use by AnythingLLM. On Linux systems, it is also necessary to set the default Docker gateway IP address for the PostgreSQL connection string.</p><pre>SERVER_PORT=3002<br>DATABASE_CONNECTION_STRING=&quot;postgresql://vectoradmin:password@172.17.0.1:5433/vdbms&quot;</pre><p>Additionally, we configure the SYS_EMAIL and SYS_PASSWORD variables to define credentials for the first GUI connection.</p><p>Given the change in the default port, we also reflect this modification in both the docker-compose.yaml and Dockerfile.</p><p>After configuring the backend, we turn our attention to the frontend installation.</p><pre>cd ../frontend/<br>cp .env.example .env.production</pre><p>In the .env.production file, we update the port to align with the Docker gateway.</p><pre>GENERATE_SOURCEMAP=false<br>VITE_API_BASE=&quot;http://172.17.0.1:3002/api&quot;</pre><p>With these settings in place, we build and launch the Docker containers.</p><pre>docker compose up -d --build vector-admin</pre><p>Accessing the GUI is straightforward via <a href="http://localhost:3002/">http://localhost:3002</a>. The initial connection utilizes the SYS_EMAIL and SYS_PASSWORD values specified in the .env file. These credentials are only required for the first login to create a primary admin user from the GUI and start configuring the tool.</p><p>The first step in the GUI is to create an organization, followed by establishing a Vector Database Connection. For the database type, we select Chroma, although Pinecone, QDrant, and Weaviate are also compatible options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*hA5xIBw0gXiWAEvG.png" /></figure><p>After synchronizing workspace data, the documents and vectors stored in the “playground” collection within Chroma become visible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*jDVRWRLEKIOGi8sh.png" /></figure><p>Details of these vectors are also accessible for in-depth analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/0*qJf0bw1Y_UgZ-jxV.png" /></figure><p>A note on functionality: editing vector content directly via Vector Admin is currently limited as it utilizes OpenAI’s embedding model. Since we opted for s-BERT MiniLM, this capability is not available. Had we chosen OpenAI’s model, uploading new documents and embedding vectors directly into Chroma would have been possible.</p><p>Vector Admin also boasts additional features like user management and advanced tools, including automatic drift detection in similarity searches, upcoming snapshots, and migration capabilities between organizations (and, by extension, vectostores).</p><p>This tool is particularly admirable for its capacity to grant full control over vectors, simplifying their management considerably.</p><p>That concludes our exploration for today. As demonstrated, Mintplex Labs’ tools, AnythingLLM and Vector Admin, facilitate the straightforward setup of the RAG pattern, empowering users to interact with documents conversationally. These projects are actively evolving, with new features on the horizon. Therefore, it is worthwhile to regularly check their <a href="https://github.com/orgs/Mintplex-Labs/projects/1/">roadmap</a> and begin leveraging these tools to engage with your files interactively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eddb6e738a08" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>