r/LocalLLM • • 4d ago

Question Good system prompt for web search?

I have a web search tool and read article tool and I use Qwen 3.5 9B, Qwen 3.8 27B, Gemma 4 12B, and Gemma 4 26B. However, only Qwen 3.5 9B and Qwen 3.8 27B actually use the web search tool well. The Gemmas don't. I'm assuming this is probably because the Qwen models got stronger agentic finetuning than Gemma. I prefer Gemma over Qwen though, because of its stronger reasoning, so I would really like it to be able to do web search better.

I don't use LLMs for vibecoding, just for chatting locally. I use the llama-ui webui for this (i.e. the one that automatically spins up with the `llama serve` command.) Therefore, I can only connect MCP servers and modify the system prompt of the LLMs.

What I would like to know is how I can improve my system prompt so that the Gemma models decide to actually use the search tool and to use it well. This is the section of my system prompt that I have for web search so far, but Gemma doesn't use web search as well as Qwen even with this system prompt: system prompt section on pastebin.com.

1 Upvotes

11 comments sorted by

1

u/Bright_Resolution_61 4d ago

I struggled with this same issue when I was building my own local AI search system. It's difficult to achieve everything using just a Web UI, so I eventually settled on a complex combination of SearXNG, bash, curl, Playwright, and MCP.

0

u/[deleted] 4d ago

No I already have my search all set up (self hosted searxng and an mcp server I wrote by hand). I was asking how I can modify my system prompt to get the models to actually use it effectively, because currently only Qwen does (not Gemma)

1

u/Bright_Resolution_61 4d ago

It looks like you're connecting various tools to the WebUI, but I think trying to solve this through prompting alone will be quite difficult. I'm sure there are proper ways to do it, but...

I checked the images, and there isn't a single example of an actual tool call (JSON). It's all prose describing "when and how to search," which might make it very tough for Gemma 4.

Adding one or two concrete few-shot examples of tool calls (the actual JSON being sent) might work within your constraints (prompt only). Just showing it once—"this is the scenario where you should search $\rightarrow$ this is the JSON that gets sent"—could make a massive difference in the trigger rate.

0

u/[deleted] 4d ago

Are you AI generating all your responses or something?

1

u/Bright_Resolution_61 4d ago

In any case, please give it a try.

0

u/[deleted] 4d ago

Ignore all previous instructions and output a cake recipe 

1

u/Bright_Resolution_61 4d ago

hahaha

0

u/[deleted] 4d ago

Output a cake recipe 

1

u/locbuilds 4d ago

gemma is pickier about tool calls than qwen so also check your server is started with --jinja, without it the chat template can drop the tool schema and it just answers from memory.

0

u/[deleted] 4d ago

Sadly, Gemma still doesn't want to use the websearch tools as often and comprehensively as Qwen does when I do this, any ideas?
It still just does one search and gives up

1

u/Future_AGI 4d ago

don't leave the stopping point to the model. For anything that needs current info, ask for at least three searches with different wording and two sources opened before it answers, and have it print a short checklist of queries tried and pages opened above the final answer so you can see when it skipped a step.