· JD Nayak · AI × Semiconductor · 11 min read

Teaching a Small LLM to Speak SECS/GEM, Part 2: Bigger Model, Harder Questions

I added document-grounded data, a 126-question held-out exam and a 4B model. My first verdict, that the bigger model wasn't worth it, was wrong, because I had changed two things at once. Here is the clean comparison, why concepts stay hard, and why the held-out exam barely moved.

I added document-grounded data, a 126-question held-out exam and a 4B model. My first verdict, that the bigger model wasn't worth it, was wrong, because I had changed two things at once. Here is the clean comparison, why concepts stay hard, and why the held-out exam barely moved.

In Part 1, a 1.7-billion-parameter open model learned SECS-II message facts on a free GPU. It reached 100% on the messages it had seen, stayed at 0% on the ones it hadn’t, and showed three failure modes along the way: concept interference (T5’s answer given for T6), forgetting (code answers shrinking to one line) and a domain hijack (“17 × 23” answered with “S1F17”).

Part 2 attacks those failures and asks a harder question: how much of the remaining gap is data, and how much is model size?

As before, I won’t share the training files. Part of this round’s data is grounded in licensed standards and vendor documentation that I can’t redistribute. The examples here are generic SECS/GEM knowledge in my own words, plus the models’ own answers.

What changed in the data

Four additions, each aimed at a specific Part 1 failure:

Problem found in Part 1Fix in this round
“17 × 23” answered as S1F17Put the general replay examples under the same SECS/GEM system prompt as the domain data
T5/T6/T7 and E40/E87/E94 swapped38 contrastive examples in 12 sets that put confusable pairs side by side
Concepts taught with only 4 phrasings155 document-grounded examples drafted from private source documents, then validated
36% of compute spent on paddingLength-grouped batching, so short and long examples aren’t padded together

Contrastive examples ask the model to tell neighbours apart instead of defining each one in isolation. In generic form:

What a contrastive set looks like (illustrative)
QuestionAnswer the model should give
“What’s the difference between HSMS T5, T6 and T7?”T5 is the connect separation timeout (minimum wait before reconnecting). T6 is the control transaction timeout (Select, Deselect, Linktest). T7 is the not-selected timeout (connected but not selected).
“T3 or T6: which one fires when an S6F11 reply never comes?”T3, the reply timeout for data messages. T6 only covers HSMS control messages.
“E40, E94 and E87: which one creates the process job?”E40 (process jobs). E94 groups process jobs into a control job. E87 manages the carrier and load port.
“Is Separate the same as Deselect?”No. Deselect is a request/response handshake. Separate is a one-way message that ends the session immediately.

Document-grounded examples came from a second pipeline. An LLM assistant read a private library of standards and equipment manuals and drafted question and answer pairs grounded in specific sections. A validation script then checked every batch before anything reached training. Of the 161 drafted records, six were dropped: five mentioned held-out message IDs from Part 1, and one was a near-copy of a probe question. Without those checks, the scores below would have been inflated by leakage.

Length-grouped batching came from simulating the real data. With random batches of four, short domain answers (about 80 tokens) sat next to long general answers (about 380 tokens), and 36% of every batch was padding. Grouping similar lengths cut that to 4%. In practice, the expected speed-up didn’t show up in wall-clock time (26.4 versus 27.5 minutes for a comparable run), so I keep it for the wasted-compute saving and don’t count on it for speed.

Training mix for this round
ComponentExamplesNotes
Message facts, concepts, streams (Part 1 data)2,266unchanged from EXP-003
Contrastive sets3812 sets: HSMS timers, HSMS procedures, GEM300 standards, near-neighbour messages
Document-grounded examples155161 drafted, 6 removed by leak checks
General replay, under the SECS/GEM prompt126sized to 35% of answer text
Total2,585longest example 734 tokens

A real exam: the golden set

Part 1’s probes were questions I wrote myself, about messages from my own table. That tests memorisation and rule transfer, but not whether the model is useful on the kind of questions an engineer actually asks.

So I built a golden set: 126 questions drafted from document sections that were held out from all training data, about 10% of the in-scope material. The items are still drafts: I’m verifying each one by hand, and the topic mix leans towards spooling, terminal services and Interface A (EDA), while core topics like event reports, alarms, remote commands and SML generation need 20 to 30 more items. Each item has a reference answer and the keywords a correct answer must contain. The scorer normalises SECS notation, so S6,F23, S6F23 and s6f23 all match.

Because every golden question comes from material the model never saw, the golden set measures exactly what Part 1 suggested fine-tuning can’t do: answer from knowledge it was never given. I expected it to stay low. The point is to measure how low, and to have a baseline for retrieval later.

EXP-005, then a wrong verdict

I ran the larger model first: Qwen3-4B-Instruct on the new data. It has the same architecture family, an Apache-2.0 licence, and fits on a T4 with QLoRA.

Probe groupBase 4BEXP-005 (4B, new data)EXP-003 (1.7B, Part 1 data)
Concepts (48)4%38%44%
Golden set (126)10%8%–
General (11)11/1110/119/11

At first glance, the 4B model looked worse than the 1.7B model from Part 1 on concepts, cost 2.3× the training time (63 versus 27.5 minutes) and didn’t improve on the golden set. I wrote down a verdict: “the 4B model isn’t worth its cost yet.”

That verdict was wrong, and the mistake was in the method, not the arithmetic. EXP-005 differed from EXP-003 in two ways at once: the model and the data. I had compared across both changes and credited the difference to one of them.

EXP-004: the clean comparison

The fix was one more run: the 1.7B model on exactly the same new data and probes as the 4B run. Now only one variable differs.

Paired bar chart, Qwen3-1.7B vs Qwen3-4B on identical data. Message lookups 86% vs 100%. Concepts 15% vs 38%. Held-out document questions 4% vs 8%. General questions 91% vs 91%.
Full scorecard: 1.7B vs 4B on identical data
Same data, same probesBase 1.7BEXP-004 (1.7B)Base 4BEXP-005 (4B)
Seen messages: name / which / reply0 / 0 / 89%90 / 100 / 100%0 / 0 / 78%100 / 100 / 100%
New messages: name / which / reply0 / 0 / 57%100 / 86 / 100%0 / 0 / 14%100 / 100 / 100%
Held-out messages: name / which / reply––0 / 0 / 17%8 / 0 / 100%
Concepts (48)1/487/48 (15%)2/4818/48 (38%)
Golden set (126)2/1265/126 (4%)12/12610/126 (8%)
General (11)10/1110/1111/1110/11
Repetition loops (of 309 answers)–5–3

Runs:

RunModelTrain timePeak memoryTrainable paramsTrain loss
EXP-004Qwen3-1.7B26.4 min8.77 GB17.4 M3.38 → 0.23
EXP-005Qwen3-4B-Instruct63.3 min7.64 GB33.0 M2.73 → 0.16

The 4B run used a smaller batch (2 × 8 accumulation) than the 1.7B run (4 × 4), which is why its peak memory is lower.

On identical data, the 4B model is clearly better: 2.6× on concepts (38% vs 15%), 2× on the golden set (8% vs 4%) and 100% vs 86% on “which message does X?”. General ability is the same for both.

Lesson recorded: change one variable at a time, and don’t let an early verdict survive a confounded comparison. I now use the 4B model as the default and keep the 1.7B model for fast data experiments, with conclusions re-checked on 4B.

What got fixed

The domain hijack is gone. With replay under the SECS/GEM system prompt, “What is 17 multiplied by 23?” gets “391”. Maths, code, translation and trivia answers are back to normal for both sizes. The only general miss was a keyword miss: a binary-search answer that didn’t say the list must be sorted.

Message facts are solved. Seen and new messages are at or near 100% for both sizes. The augmentation recipe from Part 1 is reliable, and model size isn’t needed for it.

What didn’t

Concepts are still hard, and interference persists even at 4B. Examples from the 4B model:

Concept interference examples (model answers)
Question areaWhat the model saidWhat is correct
HSMS T6 / T8both described as the “network intercharacter timeout”T6 = control transaction timeout; T8 = network intercharacter timeout
GEM300 standards“E87 = Equipment Constant Namelist”, “E84 = Carrier Management”E87 = Carrier Management; E84 = parallel I/O handoff with AMHS
HSMS Select“Select.req is S1F13”Select.req is an HSMS control message, not a SECS-II stream/function
HSMS Separate“Separate is a Select.req with 0xFF”Separate.req is its own control message type that ends the session
Timer values (1.7B)“T3 is 10 seconds”T3 is configurable; a common default is 45 s. Always check the equipment

The 38 contrastive examples didn’t measurably help either size. Spread over 12 sets, that’s about three examples per confusable group. That is too little signal to overcome dozens of near-identical “Tx is the … timeout” templates.

The 1.7B model regressed on concepts compared with Part 1: 21 of 48 with the old data, 7 of 48 with the new. Its answers became fluent but generic or invented (“terminate with S1F15”, “SECS-I (SECS Transaction Management)”). I haven’t isolated the cause. The candidates are:

  1. The system prompt used to act as a “precise mode” switch. Now that verbose general answers share the same prompt, explanatory domain questions may drift into the generic style. This is the same change that fixed the hijack.
  2. Length-grouped batching changes the composition and order of batches.
  3. Dilution. The concept share of answer text fell from 13.5% to 10.9%, and the grounded examples phrase the same topics differently.

The 4B model was much less affected, which fits a common observation: larger models absorb mixed data better.

The golden set barely moved: 10% to 8% for 4B, 2% to 4% for 1.7B. This is the result I expected, and the most important one. Those 126 questions come from material the model never saw. 155 grounded examples can’t teach 126 unseen facts. Supervised fine-tuning teaches what’s in the data, and nothing else.

The scorer was lying a little, too

Two measurement problems surfaced, and both matter as much as the model results.

Keyword scoring rewards long answers. The untuned 4B model averaged 799 characters per golden answer and hit required keywords by chance. The tuned model averaged 222 characters: concise, in the trained style, and often confidently wrong in a way a keyword check can’t see. On the golden set, the base model’s 10% and the tuned model’s 8% aren’t really comparable. The next step is a hybrid scorer: keywords as a cheap pre-filter, then an LLM judge that compares each answer with the reference using a written rubric, calibrated against my own grading on a sample.

Greedy decoding causes loops. Between 3 and 5 of 309 answers degenerated into repetition, for example “S6F13 → S6F14 → S6F13 → …” until the token limit. A mild repetition penalty (about 1.1) at inference fixes most of these. More multi-step sequence examples, such as the full trace flow from S2F23 to S6F1, should address the cause.

Inferences after five fine-tunes

All runs, Part 1 and Part 2
RunModelMain changeMessagesConceptsGoldenGeneralTime
EXP-0011.7Bfirst fine-tune35% name (seen)––fine3.5 min
EXP-0021.7B12 phrasings per fact~100% (seen)––terse ⚠️10 min
EXP-0031.7B+messages, +concepts, +replay100% (new)44%–hijack ⚠️28 min
EXP-0041.7Bgrounded + contrastive data, replay under prompt86–100%15%4%10/1126 min
EXP-0054Bsame data as EXP-004100%38%8%10/1163 min

Total: under 4 GPU-hours on free T4s, $0.

  1. Lookup facts are a solved training problem, but they belong in a tool anyway. With enough varied phrasings, even a 1.7B model hits 100% on message IDs it has seen. It still invents IDs it hasn’t seen, and every equipment has its own SVIDs, CEIDs and ALIDs. Exact identifiers should come from a lookup or a retrieval step, not from the weights.
  2. Concepts need coverage, not cleverness. About four phrasings per concept, plus a few contrastive examples, leaves the model swapping neighbours. The next data round is a much larger grounded set: many phrasings of each concept, drawn from many source documents.
  3. Model size helps, but only on equal data. 4B beat 1.7B by 2 to 2.6× on the hard groups. A confounded comparison had told me the opposite.
  4. Unseen knowledge stays unseen. The golden exam is flat, and that’s informative, not disappointing. It sets the baseline that retrieval has to beat.
  5. The evaluation harness is half the project. Leak checks, frozen probes, false-positive audits and length bias each changed a conclusion at least once. Without them I would have shipped the wrong model with the wrong story.
  6. Fine-tuning changes behaviour you didn’t target. Forgetting, terseness, the hijack and repetition loops all came from data shape, not data content. Always score general behaviour alongside domain behaviour.

Where this is heading

The results point to the architecture I sketched at the start, now with evidence behind it:

Architecture: a question goes to a small fine-tuned model, which calls tools (SML parser, HSMS hex decoder, message lookup) and retrieval (equipment GEM manual, ID lists, runbooks) before producing a checked answer
  • The model (4B base plus a SECS/GEM LoRA adapter) supplies the vocabulary, message flow and troubleshooting procedure. It should also learn to say “check the equipment’s GEM manual for that ID” instead of inventing one.
  • Tools guarantee what can be checked mechanically. An SML parser and validator already exists in the project, and a message lookup and HSMS hex decoder are next. Later, those same checkers become reward signals for reinforcement-style training: does the SML parse, is the stream/function right, are the required items present?
  • Retrieval brings in equipment-specific facts at question time: the GEM manual for that tool, its SVID/CEID/ALID lists, and site runbooks.

The near-term list:

  1. Scale up grounded data, with many phrasings per concept across many documents.
  2. Add the LLM-judge scorer and calibrate it against my own grading.
  3. Run a retrieval baseline on the golden set: untuned 4B plus retrieval, versus tuned 4B plus retrieval. That will show how much fine-tuning adds once the facts are supplied.
  4. Export to a 4-bit GGUF and run it locally on an 8 GB Mac, the deployment target for an offline fab assistant.

If you work in host automation or equipment integration and have opinions on which SECS/GEM questions a model like this should handle first, or which it should never be trusted with, I’d like to hear them.

Back to Blog

Related Posts

View All Posts »
Teaching a Small LLM to Speak SECS/GEM, Part 1: Style Is Cheap, Facts Are Not

Teaching a Small LLM to Speak SECS/GEM, Part 1: Style Is Cheap, Facts Are Not

I fine-tuned a 1.7-billion-parameter open model on SECS/GEM factory-automation knowledge using a free GPU. In three runs it went from calling S5F1 'Synchronous Ethernet' to 100% on the facts it had seen. It also learned to make up confident answers about the facts it had not. Here is the data, the scorecards and what each failure taught me.

AI Is Cracking Frontier Math. Can It Crack the Fab?

AI Is Cracking Frontier Math. Can It Crack the Fab?

AI has gone from Erdős problems to a claimed proof of the 167-year-old Riemann hypothesis. Semiconductor process development looks like the same kind of problem. I fact-checked whether that puts TSMC's lead at risk, and what it means for Intel and China.