|
1 | | -# Local LLM coding with GitHub Copilot and Qwen3-Coder-30B |
| 1 | +# Local LLM coding with VSCode and Qwen3-Coder-30B |
2 | 2 |
|
3 | | -<!-- Playbook content goes here --> |
| 3 | +## Overview |
| 4 | + |
| 5 | +Coding agents are powerful tools that empower developers through collaboration with AI agents backed by Large Language Models (LLMs). Coding agents are typically embedded into the development environment, such as the terminal or VS Code, allowing seamless integration into a developer's workflow. This integration enables collaboration on complex tasks with unprecedented speed and efficiency. By automating routine tasks and providing intelligent assistance, coding agents free developers to focus on higher-level problem-solving, transforming how software is built. |
| 6 | + |
| 7 | +This tutorial demonstrates how to use Cline, VS Code, and LM Studio to run a coding agent entirely on your local STX Halo™ machine, combining the productivity benefits of coding agents with the cost savings and privacy advantages of local AI compute. |
| 8 | + |
| 9 | +## What You'll Learn |
| 10 | + |
| 11 | +* How to run VS Code with the Cline coding agent to aid in software engineering tasks. |
| 12 | +* How to configure Cline to communicate with LM Studio for local inference of coding agents. |
| 13 | +* How to use local coding agents to solve real-world software engineering tasks. |
| 14 | + |
| 15 | +## Core Dependencies |
| 16 | + |
| 17 | +<!-- @require:lmstudio,vscode --> |
| 18 | + |
| 19 | +## Launch and Configure LM Studio |
| 20 | + |
| 21 | +We are going to use LM Studio to serve the LLM powering the coding agent. Your STX Halo™ comes with LM Studio installed. In the search bar, search for `LM Studio` and launch the application. LM Studio leverages Vulkan to accelerate Large Language Models (LLMs) using the STX Halo™ GPU. You will be greeted by the following page. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +Next, we must load the LLM on the system. We are going to use the `Qwen3-Coder-30B-A3B` model. Click on the search bar on the top of the LM Studio window. For coding agents, the context length will need to be increased before loading. Click the switch `Manually choose model load parameters` and then click on the Qwen3-Coder-30B-A3B model. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +This will bring up the model configuration, change the context length from `4096` to `32768` and click `Load Model` to load the model with the proper configuration. On typical laptops, running a 32k context window on a 30B model would run out of memory. The STX Halo's unified memory allows us to maximize this context for analyzing large codebases locally. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +Check to see if the Server is running. This can be done by going to the Developer tab in LM Studio on the left and to see the Status of `Running`. If it is not running, flip the switch icon to start the server. This is necessary for Cline to be able to communicate with LM Studio. |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +## Launch and Configure VS Code |
| 38 | + |
| 39 | +Your STX Halo™ comes with VS Code installed. In the search bar, search for `VS Code` and launch the application. |
| 40 | + |
| 41 | +The first thing that needs to be done is install the Cline VS Code extension. To do this, click on the `Extensions` icon on the left column of VS Code and search for `Cline`. Then, click the `Install` button. |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +After installation, the left panel will contain the Cline icon. Click on that icon to go into the Cline VS Code extension. On the left, there will be a window asking `How will you use Cline?` As we are going to be using a local LLM running via LM Studio, select `Bring my own API Key` and hit `Continue`. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +Next, we need to configure Cline to communicate with the LM Studio server that we setup. Set the API Provider to `LM Studio` and the model to `Qwen3-Coder-30B-A3B-GGUF`. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +## Creating your first project |
| 54 | + |
| 55 | +Let's use our local agent to create a website! To do this, have VS Code open an empty directory that will contain the source code generated by the agent, To do this, go to `File->Open Folder` on the top-left of VS Code. |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +Now we are ready to prompt the local coding agent. Click on the Cline extension on the left column and enter a prompt to kickoff the agent. As an example, we are using the prompt: `Create a website showcasing the ability to run local large-language models on the AMD STX Halo device.` and hit `Enter`. |
| 60 | + |
| 61 | +The agent will then start to create files according to the prompt. As a user, you can watch the code be generated in VS Code as shown below: |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +After generating the software, the agent is complete and you can run the application. In this case, because we prompted the agent to generate a website, the agent wrote to three files: `index.html`, `script.js`, and `styles.css`. By simply double clicking on the HTML file we can load and interact with the generated website. |
| 66 | + |
| 67 | +## Next Steps |
| 68 | + |
| 69 | +After generating the website, you can continue to work with Cline to improve the website. Two possible improvements are: |
| 70 | + |
| 71 | +* **Documentation:** Prompting the agent with `Add a README` is all that is needed for the agent to generate a `README.md` file that documents the website. |
| 72 | +* **Animation:** Prompt the model with `Add an animation that visually represents a large language model running on a laptop.` to generate an animation to the website. |
| 73 | + |
| 74 | +We encourage the reader to try to generate other applications using this setup. Below are some fun examples we have tried: |
| 75 | + |
| 76 | +* **Retro Arcade Games:** Try some other prompts. It can also be fun for the agent to create retro-style games in Python using the `PyGame` package with the following prompt: |
| 77 | + |
| 78 | +```code |
| 79 | +Create a simple pong game using the PyGame python package. |
| 80 | +``` |
| 81 | + |
| 82 | +* **Data Analysis:** One area where coding agents are particularly useful is that of scripting and data analysis. This is a prompt to showcase the local models ability to generate data analysis software for stock price visualization: |
| 83 | + |
| 84 | +```code |
| 85 | +Write a Python script that fetches daily price data for AMD (ticker: AMD) from an online API (use the yfinance library so no API key is needed). Loads the last 365 calendar days of data into a Pandas DataFrame. Computes 20-day and 50-day simple moving averages of the closing price. Store the data in a sqlite database and when the script is first run check to see if the sqlite database contains the requested data, if not, fetch it from the API. Plots a single matplotlib line chart with: Close, SMA-20, and SMA-50. Include a title, axis labels, and a legend. Saves the figure to amd_price_sma.png in the current directory and prints the path when done. Allow the user to pass in command line arguments for the total time period of data, the time period for the simple moving average to calculate, as well as to provide different tickers. |
| 86 | +``` |
| 87 | + |
| 88 | +## Resources |
| 89 | + |
| 90 | +Below are some additional resources to learn more about Coding Agents, Cline, and running workloads on |
| 91 | + |
| 92 | +* More information about the AMD LM Studio partnership and integration: https://www.amd.com/en/ecosystem/isv/consumer-partners/lm-studio.html |
| 93 | +* AMD Blog walking through running Cline on an AMD STX Halo™: https://www.amd.com/en/blogs/2025/how-to-vibe-coding-locally-with-amd-ryzen-ai-and-radeon.html |
| 94 | +* Cline Blog on running coding agents locally on AI PCs: https://cline.bot/blog/local-models-amd |
0 commit comments