<?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 Kevin Vegda on Medium]]></title>
        <description><![CDATA[Stories by Kevin Vegda on Medium]]></description>
        <link>https://medium.com/@kevinvegda?source=rss-9c5f77e78371------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S7Bwmg7m17y8sqRTY0qIHA.jpeg</url>
            <title>Stories by Kevin Vegda on Medium</title>
            <link>https://medium.com/@kevinvegda?source=rss-9c5f77e78371------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 06:53:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kevinvegda/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[Making our very own Agentic AI SWE Interviewer]]></title>
            <link>https://medium.com/@kevinvegda/making-our-very-own-agentic-ai-swe-interviewer-2d6e1589bff4?source=rss-9c5f77e78371------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d6e1589bff4</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[langgraph]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Kevin Vegda]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 20:41:44 GMT</pubDate>
            <atom:updated>2024-12-14T11:52:38.871Z</atom:updated>
            <content:encoded><![CDATA[<p>As part of the <a href="https://llmagents-learning.org/f24">Berkeley agents MOOC</a>, I recently partook in the <a href="https://rdi.berkeley.edu/llm-agents-hackathon/">LLM Agents Hackathon</a> organised by UC Berkeley. The MOOC itself was amazing — 12 weeks of lectures from the who’s who of AI in industry and academia. Most of the academic material that I’ve read on Agents in the past year has been quite beginner level — it usually just goes into what agents are and what they’re used for, and rarely gives more than a cursory look at how to actually make an agent work, its intricacies and pitfalls, etc.</p><p>You can see the current version of what we came up with <a href="https://leetscode.up.railway.app/">here</a>, and in case that deployment is not online, you can access all the code <a href="https://github.com/minki-j/ai-mock-coding-interview-agent">here</a>. (pardon the derivative naming of the app, we’re working on coming up with something better) In the course of working on our submission for the last ~2 months, I had the fortune of experiencing all of these highs and lows. (Thanks to <a href="https://www.linkedin.com/in/minkijung/">Minki</a>, <a href="https://www.linkedin.com/in/abhinit-modi/">Abhinit</a>, and <a href="https://www.linkedin.com/in/yusiye/">Sam</a> for working on this with me — especially Minki for carrying the burden of managing the collaboration between all of us. Minki even presented the project at <a href="https://aitinkerers.org/p/welcome">AI Tinkerers</a> Montreal, where he <a href="https://www.linkedin.com/posts/minkijung_im-so-grateful-to-have-received-the-best-activity-7270097556234199042-frGR?utm_source=share&amp;utm_medium=member_desktop">won</a> the best demo prize for it!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JabMDm_L7NO1iSyqZQ0SA.png" /><figcaption>The current frontend for our AI Interview Agent as of 12/12/24</figcaption></figure><p>We actually started out the hackathon with a completely different project — an Agentic README generator for GitHub repos. After brainstorming on it for a few meetings, we realised that it was not the greatest idea for the hackathon, because of a few reasons: 1) there were many such projects already which did a fine job at the task 2) we had trouble agreeing on the scope of the project because there were i) too many people in the team ii) who had different ideas about what the projects should look like. Subsequently, we ended up losing some of the members from our team and running a leaner operation, which was a boon in disguise because then it was easier to both decide on and to execute a project.</p><p>One of our members (Abhinit) had had experience interviewing candidates for Google and knew that it’d be valuable to have a simulated environment where candidates could practice their interview skills — from explaining their thought process to actually coding out a solution and the sort of back-and-forth that takes place with a real life interviewer. We agreed that this was valuable and so set out to make our own AI interviewer.</p><p>The tech stack was decided fairly quickly, because most of our team members had had some experience working on AI Engineering projects, and already were opinionated about the commonly-used tech therein. (CrewAI is unusable for anything serious, LangChain is abstraction hell, AutoGen is great but maybe a little too needlessly complex sometimes, and LangGraph is where it’s at) We ended up using LangGraph as our agent orchestration framework, since it’s essentially just an AI-based wrapper of sorts for NetworkX which allows you to write AI Agents using the node-and-edge paradigm from Graphs. It’s a fairly low-level network, in that it mostly leaves the programming of the actual logic of how and why the control is transferred from one agent to another to you so that you, the programmer, can actually be sure that your agent behaves a certain way. It might seem counterintuitive because Agents are supposed to be “autonomous” by definition, but it actually works great for production-level projects because it helps you manage the inherently probabilistic nature of generations from LLMs in a (comparatively) predictable manner by treating it as a state machine.</p><p>By the end, this is somewhat of what our interviewer agent’s state machine graph ended up looking like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CEaSUbFnW6yvVwrQ" /><figcaption>Mermaid plot for our AI Interviewer Agent written in LangGraph</figcaption></figure><p>I know, I know, it looks a little complicated, but it’s actually fairly simple. We divided the progress of the interview into different steps — the thought process stage, the coding stage, the feedback stage, etc. The AI Interviewer would talk with the user to get details of their thought process, then usher them onto the coding stage, where it would in the background run the code through a slim container to enumerate the ways in which it might be buggy and it could be fixed. This created a feedback loop between the user and the interviewer that we thought was somewhat akin to how they would interact with a real interviewer in an interview situation.</p><p>Throughout, we tried to improve the UI/UX as well as make the user experience similar to how it would be in front of a real interviewer, like adding voice transcription so that the user could voice out their thought process instead of just typing it out. There were certain pitfalls to this, like coding-related words not being caught by the speech-to-text correctly and the tone of the user not being considered in how the Agent evaluated their description of their thought process. These are all likely features that we’ll end up adding later. But even in the limited length of time that we had to put this together, we’ve used a slew of different tech like LangGraph, networks, containers, LangSmith for tracing, React for the frontend (which I hadn’t used for a few years), and Railway for CI/CD. It’s been quite a learning experience, and I hope we get time to grow this project further!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d6e1589bff4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to work with AI without breaking the bank]]></title>
            <link>https://medium.com/@kevinvegda/how-to-work-with-ai-without-breaking-the-bank-ffd32ccbba6b?source=rss-9c5f77e78371------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffd32ccbba6b</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Kevin Vegda]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 14:03:14 GMT</pubDate>
            <atom:updated>2024-09-25T11:46:25.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbt6mQhYNNtEkEZw6XYX0g.png" /><figcaption>Source: Maxime Labonne’s blog — <a href="https://mlabonne.github.io/blog/">https://mlabonne.github.io/blog/</a></figcaption></figure><p>I’ve been writing AI applications for the past ~half year. I used to work with more traditional Natural Language Processing, but ever since GPT-3.5 hit the scene in December 2022 (funnily enough, the exact time I was writing my Master’s thesis on abstractive summarisation, a vestige of ‘traditional’ NLP, which no one in the industry seems to want to do anymore in spite of NLP knowledge clearly being instrumental to all the breakthroughs we see with LLMs), everything has been about LLMs. It’s <em>‘GenAI’</em> now. OpenAI and other vested interests have done well to position themselves in verdant pastures by limiting people’s imaginations of what constitutes ‘AI’. The meek suffer what they must, and as such, those of us on the consumer software development end of things have to work within the current paradigm.</p><p><strong>Note</strong>: This guide is for people who already know the AI pipeline, be it training your own model or writing applications with LLMs, it’s not a primer on those things. For that, check out Maxime Labonne’s <a href="https://github.com/mlabonne/llm-course">LLM Course.</a></p><p>Given the massive resources required to run training and inference on transformer models of the size that perform as well as the GPTs and the Claudes and the Geminis (it took me 1.5hrs on a higher-end consumer-sized GPU to pre-train a GPT2-sized model, and a whole night for a GPT-3-small sized one. Shoutout to Andrej Karpathy’s <a href="https://github.com/karpathy/nanoGPT">nanoGPT</a>), it’s understandable that a predatory pricing model where they charge you per token and keep you bound to their service was able to gain as much traction as it has.</p><p>From the very start, I was loathe to think that I might have to pay-as-you-go my projects — including prototyping and testing potential ideas. It seems to me like an extremely limiting way to work, even if the costs might come out to be negligible, because I’ve never agreed with a recurring-charge model of subscriptions for anything. Everything is a subscription now. It’s an unnecessary cognitive load added to all the other loads that developers have to bear the burden of anyway, and as any dev worth their salt knows, reducing cognitive load is paramount to an optimal development experience.</p><p>So I’ve spent the last few months trying to figure out what the easiest way might be to make AI application development less exclusionary — to the students, the researchers, and anyone else who doesn’t want to fork out the big bucks. I’ve made it to a point where I’ve explored every step of the LLM pipeline — from pre-training to RLHF, fine-tuning, and the application layer. All of them require different kinds of resources, and I’ll try my best to list out all the options which I think are at least decent in their tradeoff between usability, accessibility, and cost.</p><h3>Pre-training</h3><p>Coming to the first step in an LLM’s lifecycle, if you’re like me, you have a hankering to train some networks of your own just to understand the process better, including the effect of ablations and hyperparam tuning. There’s a limit to what you can train on your own hardware/budget. If you have an RTX 3090/4090 or something in the ballpark, you might be able to train a small GPT2-sized model (~125M) in a couple hours. If you don’t, the easiest way is to either spin up a GPU-compatible instance on a cloud like AWS or Azure, or to use a more competitive service (in terms of price) like <a href="https://www.runpod.io/">Runpod</a>. At the time of writing, you can get an NVidia A40 for ~$0.4/hr and the newer-gen GPUs for a little more. Make sure to use MLFlow, Weights &amp; Biases, or similar solutions to track your training run — you don’t want to waste too much time training a model with hyperparams that don’t work. I’d suggest you do a <a href="https://docs.wandb.ai/guides/sweeps/">hyperparameter sweep</a> with W&amp;B and ascertain what works best before committing to a full training run. Keep checkpointing your model so you can resume training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gWjmUZuuxjQs8x6KBINR2g.png" /><figcaption>Runpod offers GPU pods without the hassle of something like AWS or Azure so you can quickly get started training your models.</figcaption></figure><p>If you’re completely averse to spending any budget on training, with transformers at least, you’re probably better off fine-tuning or prompting something for your specific use case instead. Pre-training models has a diminishing ROI nowadays, with a lot of open weight models available through HuggingFace.</p><h3>Fine-tuning</h3><p>Most use-cases that you may encounter as a sole developer are simple enough to be addressed with fine-tuning. Sure, it’s not as bespoke a solution as pre-training, but there’s no need to reinvent the wheel when someone else has done the work of teaching a language model the <em>language</em> part of the model. (this is also the same rationale for model-merging with <a href="https://github.com/arcee-ai/mergekit">MergeKit</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzM8exMLHpQ1uXMBOkrYKg.png" /><figcaption>Unsloth allows you to fine-tune and preference-tune models on Google Colab</figcaption></figure><p>Luckily for the GPU-poor among us, Parameter-Efficient Fine-tuning (PEFT) has made it extremely easy to fine-tune smaller variants of popular models even in environments like colab with a T4 or TPU. <a href="https://github.com/axolotl-ai-cloud/axolotl">Axolotl</a> and <a href="https://huggingface.co/docs/trl/en/sft_trainer">HuggingFace SFTTrainer</a> have options to load the base model in half-precision. Look out for the option to use <a href="https://github.com/bitsandbytes-foundation/bitsandbytes">bitsandbytes</a> to load the base model in 4bit. (SFTTrainer and other libraries have integrated bitsandbytes now) From there, <a href="https://www.datacamp.com/tutorial/mastering-low-rank-adaptation-lora-enhancing-large-language-models-for-efficient-adaptation">LoRA</a> and QLoRA (quantized LoRA) make it easy to only fine-tune low-rank adapters instead of the whole model. You can even train only the last few layers of the network while freezing the rest, or a combination of these. <a href="https://unsloth.ai/">Unsloth</a> promotes itself as a solution you can use to fine-tune smaller models on colab — and they deliver on it, in my experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*Fh_JMymQY9TT6f-C.png" /><figcaption>Low Rank Adapters. Source: <a href="https://www.anyscale.com/blog/fine-tuning-llms-lora-or-full-parameter-an-in-depth-analysis-with-llama-2">https://www.anyscale.com/blog/fine-tuning-llms-lora-or-full-parameter-an-in-depth-analysis-with-llama-2</a></figcaption></figure><h3>Reinforcement Learning from Human Feedback (RLHF)</h3><p>The next step in the pipeline to having your own model is to align it to behave a certain way — this might be to make it sound more helpful, better at a particular task, or safer to deploy in production. For this, you need RLHF — you can use HF’s TRL, <a href="https://github.com/CarperAI/trlx">TRLX</a>, or <a href="https://github.com/OpenRLHF/OpenRLHF">OpenRLHF</a>. There a few methods to do this, like PPO, DPO, and ORPO.</p><p>These usually require GPUs in the same league as those required for training, so follow the same process to whittle down your options. I’d personally spin up a runpod if running a custom solution with the above frameworks. Once again, <a href="https://colab.research.google.com/drive/11t4njE3c4Lxl-07OD8lJSMKkfyJml3Tn?usp=sharing">Unsloth</a> can help when hardware-constrained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExXUD4tXiVmCSkK63I5lWg.png" /><figcaption>Unsloth to the rescue again!</figcaption></figure><h3>Inference</h3><p>To actually use models once you’ve pre-trained or fine-tuned them, you need inference hardware. While inference doesn’t require the same sort of heavy parallelism that training does, you still do need to keep latency low to serve a lot of use cases.</p><p>If you don’t have a GPU, you can still run inference on a lot of models with <a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a> (faster in some cases) or <a href="https://ollama.com/">Ollama</a> (more user friendly). Look out for model format — some of these frameworks might need your file to be in a specific format like GGUF. <a href="https://github.com/ml-explore/mlx">MLX</a> (this is integrated into Ollama) has also made it possible to train or fine-tune models on macbooks, and you can run inference on them with <a href="https://medium.com/@meirgotroot/bringing-your-fine-tuned-mlx-model-to-life-with-ollama-integration-c54274de6491">Ollama</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zl-rKoXq-EkixHZkHN0zMA.png" /><figcaption>Ollama allows you to run inference on smaller or quantized models locally.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qej0J27PUhYf3UiDR3wP9Q.png" /><figcaption>Ollama’s OpenWebUI interface gives you a playground to chat with your models.</figcaption></figure><p>By default, Ollama will start a docker container (do note that you need <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> installed for this) that hosts a model for you to query. You can run inference on any model with ollama run &lt;model-name&gt; on the command line, or you could use <a href="https://github.com/open-webui/open-webui">Open WebUI</a> to run a ChatGPT-like interface where you can interact with your models. (don’t forget to stop your containers and delete local models not in use to save those precious resources) Another alternative is <a href="https://lmstudio.ai/">LM Studio</a>, which also allows for interacting with your models within a playground or starting a server that will serve the model with OpenAI API-compatible endpoints so that you can simply switch out the OPENAI_API_BASE within your framework of choice and keep the rest of your code same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Un19ZSWw8k5fIyl4ZBAVWQ.png" /><figcaption>LM Studio is a beginner-friendly Ollama alternative</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_t0fpOh_hE0mFN5TXodQ4A.png" /><figcaption>You can start an OpenAI API-compatible server to serve your model</figcaption></figure><p><a href="https://github.com/marketplace/models">Github Models</a> is a new offering that allows for quick prototyping. It essentially seems to be a public-facing version of Azure playground, but it’s completely free and doesn’t require any authentication if you run the models within Github codespaces. If you run them locally, you just need to create a Github <a href="https://github.com/settings/tokens">Personal Access Token</a> and use it as an API key. (you should find these instructions when you press Get Started)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c6rJfKzHQhTw4NCIy4dLOA.png" /><figcaption>Github Models provides a quick and easy way for developers to try out the popular models</figcaption></figure><h3>Application-layer development and Deployment</h3><p>Application-development with AI is no different from application development in any other domain — the only extra element you have to deal with is a language model — either through a web API, a locally hosted API, or a model you load locally with an SDK like the HuggingFace <a href="https://huggingface.co/docs/transformers/en/index">Transformers</a> library.</p><p>You can then deploy the solution on different hardware based on whether it uses an API from providers like OpenAI, Mistral, TogetherAI, AI/ML, etc. or loads a model locally. If you’re calling an API, I’d recommend trying out solutions like TogetherAI/AIML/other providers that host multiple models. This makes switching out models easier. Moreover, the inference service provided by Azure, for example adds a layer on top of the models they host that takes care of content moderation and security so your products aren’t prey to prompt hacking. There’s two ways to do this: if you (or your LLM/agent framework, for example, CrewAI or LangGraph) already use OpenAI API, you can usually just change the OPENAI_API_BASE that you pass to the framework. Otherwise, you can use the Azure Inference SDK (as an example) and it’ll take care of the rest for you. These options provide some free credits, but have paid tiers once you need to deploy something to production/for demonstration purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0y_mLY2w-muK65go8k9yg.png" /><figcaption>HF Spaces allows you to use A100s to run your demos for free with the monthly Pro subscription</figcaption></figure><p>If you don’t want to use a proprietary API and would rather use open source models, your easiest option is to either call the HuggingFace Serverless <a href="https://huggingface.co/docs/api-inference/en/getting-started">Inference API</a> in your code wherever you host it, or to use <a href="https://huggingface.co/spaces">HuggingFace Spaces</a> to host a solution that uses common templates for ML demos, like Gradio or Streamlit, or a custom docker container. Within the space repo, you can use the inference API to call any model from HuggingFace, same as above. The advantage with HF Spaces is that with the pro subscription (which is just $9/month), you can use HF <a href="https://huggingface.co/zero-gpu-explorers">ZeroGPU</a> Spaces — if your demo is running on a Gradio frontend, you’ll get distributed access to NVidia A100s to run your demo. Moreover, you get access to Dev Mode, where your application doesn’t need to reboot every time you update your code — you can simply SSH into the space and develop your solution to see changes in it instantaneously. Not a bad deal if you want to create and host many demos at once, plus the money goes to HuggingFace, which is trying to democratise access to open AI, so a win-win.</p><h3>Conclusion</h3><p>I for sure would’ve loved knowing these things when I started out with AI development a few months ago and I hope it’s useful to those of you looking to develop solutions without making a hole in your pockets. If there’s better options for these tasks, please comment with them below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffd32ccbba6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>