DEV Community

Nerav Doshi
Nerav Doshi

Posted on

Measured the oc-vs-kubectl Bias: Naming OpenShift Fixed the Tool, but Most oc Commands Were Wrong or Invented

Four entries in this series hit the same thing. Entry 03's plain 3b answered a pod question with kubectl. Entry 10's 1B invented OpenShift networking details. In Entry 14 a model answered an oc question with "you can use the kubectl command-line tool" in the same sentence. Entry 02's constrained model used oc but gave a wrong command. The plan for this quarter includes trying a small fine-tune to fix the oc-versus-kubectl bias. Before that, I wanted a number for how big the bias actually is, or there'd be nothing to compare a fine-tune against.

I wrote 24 tasks before running anything. Twenty need an oc subcommand that kubectl doesn't have: creating and switching projects, routes, source-to-image builds, image streams, oc adm work like SCCs, upgrades and must-gather, logging in, the internal registry. Four are generic Kubernetes jobs where kubectl is just as good: scaling, pod logs, a shell in a pod, and granting edit access. Those were counted separately. Each task went to llama3.2:1b, llama3.2:3b and gemma3:12b, once plain and once with Entry 02's oc-mentor system prompt, at temperature 0. The prompt was "On an OpenShift 4 cluster: Give the command."

~/mcp-env/bin/python3 eval_oc_bias.py
Enter fullscreen mode Exit fullscreen mode

The bias barely showed up. Of 144 answers, 143 led with oc. The one kubectl was the 1B, plain, on saving a secret's keys to files.

Whether the command was right was a different story. The script had an automatic check for the expected subcommand, and it turned out to be a poor judge. It scored the 3b at 10 of 20 because the right word appeared, in commands like oc adm upgrade --show-version-upgrades and oc new-app --source-codeurl=..., flags that don't exist. It also marked oc new-app mytemplate -p NAME=demo wrong, and that's valid. So I checked all 144 by hand against one rule: does the first command do what was asked, exactly as written? Where I wasn't sure a flag existed, I checked offline with the local oc client's --help (4.22), without touching a cluster.

Config First command used oc (of 20) Correct, hand-checked (of 20) Generic tasks correct (of 4) Seconds for all 24
1B, plain 19 4 3 32
1B, oc-mentor prompt 20 2 2 7
3B, plain 20 4 2 72
3B, oc-mentor prompt 20 5 2 19
12B, plain 20 6 3 374
12B, oc-mentor prompt 20 5 3 93

The best result was the 12B at 6 of 20 on the oc-specific tasks. Twelve of the twenty tasks were never answered correctly by any model in either mode. Nobody produced oc adm must-gather, oc extract secret/db-creds, oc registry login, oc set triggers, a working oc import-image (the 1B tried, with the wrong arguments), or an edge route with --service. In place of the real commands, the models invented plausible ones: oc s2i build, oc create build, oc image-stream create, oc adm collect diagnostics, oc adm policy add-sca-scope, oc adm upgrade-status, oc project list. Some answers were one flag away. The 12B's oc logs -f bc/app --watch is right except that oc logs has no --watch, and the 3b's oc adm policy add-scc-to-user anyuid builder grants the SCC to a user named builder instead of the service account, because it's missing -z. By the rule, neither counts.

The oc-mentor system prompt didn't make anything more correct. It took the 1B from 4 to 2, the 3b from 4 to 5, and the 12B from 6 to 5. What it did was shorten the answers, which is why those runs were three to five times faster.

That raised a question about the earlier entries. Entries 02 and 03 asked "how do I check the status of pods in my namespace?" without naming OpenShift, and this test always did. So I re-ran the 24 tasks plain, without "On an OpenShift 4 cluster", deciding beforehand to count only which tool each answer reached for. On the four generic tasks, all three models answered with kubectl three times out of four and oc never. On the twenty oc-specific tasks the wording became ambiguous and the models just guessed: oc at most twice, kubectl one to five times, and the rest went to git, docker, gcloud, aws and others. "Create a new project called payments" became git init payments from the 1B.

Some limits. The correctness check is my judgment, under a strict first-command rule, and nothing was run against a cluster. The offline --help check confirms a flag exists, not that the command works end to end. Each task has one wording and one run at temperature 0, so a different phrasing could change individual answers. Twenty tasks means each one is five points. And my task list leans toward oc-only features on purpose, so this measures the hard part of oc, not everyday use.

So the bias from earlier entries is mostly a missing-context problem. Name the platform, and every model reaches for oc. Leave it out, and generic Kubernetes questions get kubectl. The problem that's left is correctness. Even the 12B got the oc-specific command right less than a third of the time, and a system prompt didn't change that. A fine-tune aimed at "say oc, not kubectl" would be fixing the part a single phrase already fixes. The open question for the next step is whether a small fine-tune can teach real oc subcommands, or whether retrieving the oc docs at question time would do more for less.

Top comments (0)