Open Source AI Optimization Assistant
This tutorial explains how to set up a helper that applies fcmaes to a concrete optimization problem.
-
Pick an optimization algorithm.
-
Learn the basics of how it works.
-
Choose the interface: ask/tell or minimize.
-
Choose the parallelization strategy: parallel restarts or parallel population evaluation.
A general AI such as GPT‑5 or OPUS 4.1 can help with ideas. But it usually does not know the details of fcmaes.
Training a custom AI on fcmaes is possible, but expensive. A simpler approach is to open the fcmaes repository, or any other GitHub project, in an IDE such as VS Code, PyCharm, or IntelliJ and use the Continue plugin. Continue can connect to any AI via the Ollama or OpenAI protocol. In this tutorial, we focus on an open-source model running locally on an AI server in your LAN.
Hardware Options
There are currently two main hardware choices:
-
A standard PC with several GPUs. This gives you a lot of VRAM. The practical limit is the combined GPU memory. For good results, you need at least 48 GB. A relatively cheap option is two Nvidia 3090 cards.
-
A machine built for AI with shared memory (128 GB or more). Examples are Apple M4, AMD 395 AI MAX, or NVIDIA DGX Spark. The advantage is capacity: you can load bigger models and use larger contexts. The disadvantage is speed because memory bandwidth is limited. Execution is around 5× slower than with GPUs.
For the fcmaes expert use case, GPU speed matters more. 48 GB is already enough for good results, and future models of the same size will likely perform even better. Still, AI-specific machines will likely get cheaper and faster soon, so the GPU advantage may not last.
Server Setup
The AI server must expose either the OpenAI API or the Ollama API so other machines in the LAN can connect through the Continue plugin. For IDE use, we need an instruct model variant tuned for tool interaction. If VRAM is limited to 48 GB, a coder model is usually the better choice because it focuses its resources on programming tasks.
At the time of writing, the best model option for our hardware supported by Ollama is Qwen3-Coder-30B-A3B-Instruct-480B-Distill-V2 on Hugging Face. We recommend the 6-bit distilled version. If your machine has less or more VRAM, choose a different bit number that fits your hardware.
First install the Ollama server using:
curl -fsSL https://ollama.com/install.sh | sh
OLLAMA_HOST=0.0.0.0 ollama serve
ollama run hf.co/BasedBase/Qwen3-Coder-30B-A3B-Instruct-480B-Distill-V2:Q6_K
If you are on Windows/macOS, you can download Ollama from https://ollama.com/download and run it with ollama serve.
These alternative model variants also work well:
# smaller model
ollama run hf.co/BasedBase/Qwen3-Coder-30B-A3B-Instruct-480B-Distill-V2:Q4_K_M
# larger model
ollama run hf.co/BasedBase/Qwen3-Coder-30B-A3B-Instruct-480B-Distill-V2:Q8_0
Find your server’s local IP address (ifconfig on Linux). You’ll need this to configure the client.
Alternative: Use vLLM
At the time of writing, the best model option for vLLM is Qwen3-Coder-30B-A3B-Instruct-FP8 on Hugging Face.
First install vLLM using:
pip install vllm
Ideally, do this in a dedicated virtual environment.
Then start the server with the command below.
CUDA_VISIBLE_DEVICES=0,1 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
NCCL_P2P_DISABLE=1 NCCL_IB_DISABLE=1 \
python -m vllm.entrypoints.openai.api_server \
--host 0.0.0.0 --port 8000 \
--model Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8 \
--trust-remote-code \
--dtype float16 \
--tensor-parallel-size 2 \
--max-model-len 8192 \
--gpu-memory-utilization 0.90
-
The first run downloads and caches the model from Hugging Face. Later runs use the local cache.
-
The example command is tuned for two Nvidia 3090 GPUs. Adjust the settings for your own hardware. If you are unsure, ask an LLM (GPT-5, Opus 4.1, Grok, or Gemini Pro) how to configure it.
-
The parameters are set to use all available memory. If you run into memory issues, lower
gpu-memory-utilizationandmax-model-len. -
On a dedicated AI machine with more memory, you can load larger models and increase the context size (
max-model-len).
In our tests, vLLM only worked with a weaker model and a smaller context size. For that reason, we recommend using Ollama instead.
In general, choose between Ollama and vLLM as follows:
-
Need maximum throughput, batching, scheduling controls, or multi‑node? → vLLM. It is built for that and well documented. You can scale up LLM inference by increasing
--tensor-parallel-sizeto shard the model across N GPUs. Pipeline parallel and data parallel are also available. Weights are split across GPUs, and tensor parallelism handles the intra-layer sharding. Limited quantisation support may still force you to choose the other option. -
Want a simpler local stack, mainly to fit larger models across your GPUs, with decent single‑user performance? → Ollama. Recent releases note improved multi‑GPU scheduling and better VRAM allocation with >2 GPUs. If a model does not fit on one GPU, Ollama can spread it across GPUs to increase total effective VRAM. Throughput gains may be modest. The main benefit is capacity.
Client Setup
Install the Continue plugin in your IDE (VS Code, JetBrains, etc.).
Set the configuration in ~/.continue/config.yaml.
models:
- name: Qwen3-Coder
provider: ollama
model: hf.co/BasedBase/Qwen3-Coder-30B-A3B-Instruct-480B-Distill-V2:Q6_K
apiBase: http://<server-ip-address>:11434
defaultCompletionOptions:
maxTokens: 1024
temperature: 0.2
topP: 0.9
roles:
- chat
- edit
- apply
- autocomplete
-
temperature = 0.2→ Low randomness and safer outputs. -
topP = 0.9→ Some diversity, limited to the most likely ~90% of tokens. -
maxTokens = 1024→ Maximum number of tokens for auto-completion. -
apiBase→ The IP address of the server where Ollama is running. Replace<server-ip-address>with the actual IP address of your server. If Ollama is running locally on your machine, usehttp://localhost:11434. -
Add the
tool_usecapability if your model supports Continue’s agent mode. Our recommended model does not.
capabilities:
- tool_use
Switch from Agent Mode to Chat Mode in Continue:
Continue starts in agent mode by default. In this mode, the model tries to act as an autonomous coding agent. It interprets prompts as instructions to search, edit, or run code in your IDE.
The open-source model we use here does not fully support this mode. As a result, requests usually fail with an error message.
Switch to chat mode instead. In chat mode, the model works as a conversational partner: it answers questions, explains code, and discusses optimization strategies without trying to execute IDE actions.
To switch modes in Continue:
-
Open the Continue sidebar in your IDE.
-
At the top you will see the mode selector (set to Agent by default).
-
Change it to Chat.
The model should now respond reliably. If you later use a model that supports agent mode, you can switch back at any time.
There are models that support Continue’s agent mode, but they are all inferior to the models we recommend for this tutorial:
-
Qwen2.5-7B-Instruct Supports function calling and tool use. Lightweight, good for single-GPU setups.
-
Qwen2.5-14B-Instruct Larger variant with stronger reasoning. Also supports function calling.
-
Qwen2.5-32B-Instruct More capable, but VRAM heavy. Works if you have 2×3090 with tensor parallelism.
-
Qwen2.5-72B-Instruct Very large; requires >150 GB VRAM or advanced inference optimizations.
-
Vikhrmodels/Qwen2.5-7B-Instruct-Tool-Planning-v0.1 Fine-tuned for tool planning, enabling multi-tool orchestration.
-
ermiaazarkhalili/Qwen2.5-7B-Instruct_Function_Calling_xLAM Specialized in structured function calling with JSON-like schemas.
But this may change at any time as better agentic models are released.
Clone the fcmaes repository:
Make the fcmaes code available in your project so Continue can inspect it and answer questions about it.
git clone https://github.com/dietmarwo/fast-cma-es.git
Then open the repository as a new project in VS Code or PyCharm, or copy the code into your optimization project.
Example prompts for Continue:
-
@Codebase where is differential evolution implemented? -
Analyse the Python implementation of Differential Evolution. Does it have special properties? -
@cmaes.py explain -
Select code in the IDE and ask:
explain -
What is the difference between CMA-ES and Differential Evolution? -
@cmaes.py How can I parallelize optimization? -
Show an example application of BiteOpt -
@cmaes.py What is the difference between `fminandminimize?` -
@cmaes.py How can I use a custom objective function with bounds?
Alternative: Use vLLM / openai Provider
If you chose vLLM to host your model on the server instead of Ollama, the client configuration needs to be adapted.
Configure the Continue plugin in your IDE (VS Code, JetBrains, etc.) in ~/.continue/config.yaml as follows:
models:
- name: Qwen3-Coder
provider: openai
model: Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8
defaultCompletionOptions:
maxTokens: 1024
temperature: 0.2
topP: 0.9
apiBase: http://<server-ip-address>:8000/v1
roles:
- chat
- edit
- apply
- autocomplete
Everything else stays the same. You can then use Continue to talk to your local model inside the IDE. The smaller context window may become an issue in longer conversations.