DFilterForge Retrospective 01: Three wrong answers scored full marks

DFilterForge has an LLM write a Wireshark display filter from a plain-English request, then checks it with a pinned tshark on synthetic captures. The first run of the dev split with a real model produced three wrong answers that scored full marks. This post covers the verifier that judges right from wrong: where labels come from, how mutants test the test data itself, why every probe ends with 33 witness packets, and how shortcuts are prevented.

Published
Reading time
20 min read
Category
Retrospectives
Tags
Translated from
the Chinese original
Contents10 sections

This is the first post in the DFilterForge retrospective (series overview).

DFilterForge does this: give an LLM a plain-English request and have it write a Wireshark display filter. A request might be “find all TCP segments with source port 443 and the FIN flag, whether or not ACK is also set.” Then a pinned tshark 4.6.8 runs the filter over several synthetic captures to see whether it selects the right packets.

A filter can be wrong in two ways:

  • One kind fails to compile, or errors out as soon as it runs. tshark rejects it on the spot, so it is easy to catch.
  • The other compiles, runs, and selects some packets — just the wrong ones. The project calls this silent-wrong.

On the frozen test split, the filters written by four hosted models included 971 that compiled and ran, of which 165 were silent-wrong. Everything that follows — counterexample repair and small-model training — rests on being able to reliably identify silent-wrong. So this first post covers the verifier that judges right from wrong.

The title refers to September 23, the first time a real model ran on the dev split, when three wrong answers scored full marks. Below I cover the scoring rules first, then how those three answers slipped through and how that was later fixed, and finally shortcuts. For the engineering boundaries — how tshark safely runs model-written filters, how the field catalog was frozen — see the engineering checklist post. Every number in this post comes from committed records in the repository1.

Scoring rules

The captures used for scoring are called probes, all synthesized by scripts. Each packet is generated from a recipe, such as “a client sends SYN to port 443,” “an AAAA query,” “an mDNS query.”

Which packets each question should select is written by hand against the packet table and the question, then checked with tshark. So each frame’s label depends only on how the packet was built, not on any filter. The reference answer is no exception: at scoring time the reference answer runs first, and it must match the labels exactly on every probe, or the whole scoring run stops.

The dev split and the test split each have three scoring probes, shared by all questions in the same split. The protocol defines eight outcomes in total; the four relevant to this post are (protocol.md):

  • strong exact: all three of the following hold:
    • the frames selected on the three probes match the labels exactly;
    • at least one probe’s labels are not the empty set;
    • no shortcut rule is hit (covered later).
  • silent-wrong: compiles and runs, but on at least one probe it disagrees with the labels.
  • invalid: fails to compile, or fails to run.
  • shortcut: matches on all three probes, but uses fields or constants it should not. It is counted separately and never counts as strong exact.

Models answer under four conditions:

ConditionWhat they writePrompt includes retrieved fields
C1display filterno
C2display filteryes, 16 retrieved from the tshark field catalog
C3typed intent IR (a JSON structure), compiled into a filterno
C4same as C3yes

C3 and C4 answers are typed intents; what this post shows is the filter they compile to. Each question has two phrasings, and each phrasing is an item, numbered like mei-0005 in the dev split and mei-1038 in the test split.

Three wrong answers scored full marks

On September 23, qwen3-32b answered the dev split’s 16 items under all four conditions, 64 requests in total, costing $0.0059.

In an independent audit of that run, every score could be recomputed from the committed files, and the scoring itself had no errors. But three answers had been judged strong exact when they were in fact wrong (first-dev-run.md):

  • C1/mei-0005: the answer was tcp.port == 443 && tcp.flags.ack == 1, using tcp.port == 443 to mean “destined for port 443.” tcp.port matches either endpoint, so packets sent from port 443 would also be selected. But the probes happened to contain no packets sent from port 443.
  • C1/mei-0006: the answer was tcp.ack == 1 and tcp.dstport == 443, using tcp.ack == 1 to mean “has the ACK flag.” This compares the acknowledgment number, not the ACK flag. tshark displays relative sequence numbers by default, so the first ACK-carrying packet in each stream shows an acknowledgment number of 1. And in the probes, every ACK-carrying packet happened to have an acknowledgment number of 1.
  • C4/mei-0013: the question had a condition “SYN with ECE,” and the answer dropped SYN, leaving only “with ECE.” The ECE-carrying packets in the probes all came from the same recipe: SYN packets with both ECE and CWR set.

mei-0005 and mei-0006 are two phrasings of the same question, each wrong in a different place. None of these three are obscure mistakes; they are all common slips when writing Wireshark filters. They scored full marks only because no packet in the probes could separate them from the reference answer. The test split captures had the same gaps.

Testing the probes with mutants

The audit record has a line: these three are not three accidents, but one class of problem. The way to find the whole class is to build wrong answers in reverse.

Step one: take the reference answers (the canonical IR) for all 24 questions, change one thing in each, and generate every single-site mutant:

Mutation typeChangeSurvived (dev / test)
boundarymove a boundary by one6 / 11
field-swapswap in a nearby field, e.g. ip.src replaced with ip.addr2 / 12
subnetchange the network2 / 12
value-domainchange a value range, e.g. DNS query type, response code4 / 4
flag-as-numberwrite a flag as a numeric field, e.g. tcp.ack == 12 / 5
drop-conjunctdrop one condition3 / 2

Step two: run these mutants against the probes. Each mutant is an answer that looks plausible but is wrong. If a mutant selects exactly the same frames as the reference answer on every probe in its split, then this set of probes cannot tell this wrong answer apart, and the mutant “survives.” Of 182 mutants, 65 survived: 19 in the dev split and 46 in the test split.

This is really mutation testing, just turned around:

  • Ordinary mutation testing changes the code and asks whether the tests catch it;
  • here the reference answers are changed, and what is being tested is the test data itself.

A set of probes is adequate only if it can separate the reference answer from each of its near neighbors.

The fix was to add witness packets to every probe. The dev and test splits have six probes in total; each got 31 packets appended after its original last frame, so the original frames’ bytes and numbers are unchanged. Each witness packet exists to break certain classes of mutants, for example:

Witness packetBreaks which wrong answers
an ACK sent from port 443 to the client, followed immediately by a second ACK on the same stream (relative acknowledgment number 5000)field swaps like tcp.port; tcp.ack == 1
an ACK with ECE, an RST with ECEanswers that drop SYN
packets with TTL 0, 2, 63, 128answers that move a TTL boundary by one
an MX query, a SERVFAIL responseanswers that get the DNS query type or response code range wrong
successful DNS responses on unusual ports (53 to 53, 53 to 52, mDNS)answers that drop the port condition or get a port boundary wrong
packets to or from 10.200.3.4; a packet from 192.0.3.9 (right next to TEST-NET-1’s 192.0.2.0/24)answers that change the network

Whether each witness packet should be selected in each question is likewise written by hand against the packet table and the question, then checked with tshark on all six probes.

All of this is checked by scripts/probe_adequacy.py. It requires:

  • the reference answers, the compiled canonical IR, and the error example hand-written in advance for each question all match their labels on the six scoring probes (two feedback probes were added later);
  • every mutant is either killed or has a waiver with a stated reason.

It runs in strict mode in CI. Any label mismatch, any surviving mutant without a waiver, or any waiver that no longer applies fails the build.

The result: surviving mutants dropped from 65 to 4 (6975a66). The remaining 4 are genuinely equivalent phrasings. For example, in the question “either endpoint is a private address,” swapping ip.src for ip.addr in one branch: ip.addr matches when ip.src or ip.dst matches, and the other branch already tests the other endpoint. So for any packet, the two phrasings select the same thing — not just on these probes.

When this dev split run was rescored in place, exactly those three answers changed, from strong exact to silent-wrong. The whole run went from 28 strong exact and 7 silent-wrong to 25 and 10; every other result was unchanged.

The cost: probes grew from 13,306 bytes to 28,498 bytes, and the related code from 754 lines to 1,537 (ablation 005).

There was also a small timing episode. The two timing records were measured in different sessions, and on the surface the new probes’ p50 was 5.2% slower, over the 5% threshold. But the absolute level of the same measurement floated by about 14% between sessions, so comparing that way is meaningless. It was later changed to run the same 900 calls alternately against the two probe sets in the same container. Across three sessions, the two probe sets’ per-call p50 differed by less than 0.4%, and that became the basis for the judgment.

Mistakes were made while adding these packets too; review found three:

  • A draft waiver said that tcp.seq == 0 in some question was “not separable.” A pair of keep-alive-like packets turned out to break it.
  • One witness was originally a SYN with only ECE (0x42). It would mark answers that understand “ECN SYN” per RFC 3168 (ECE and CWR both set) as wrong, so it was replaced with a SYN with CWR.
  • One hand-written error example had labels that no check covered. So the gate began checking those labels too.

One packet also forced the question to be precise:

  1. Breaking one of the mutants required a successful DNS response where neither endpoint was port 53, and the choice at the time was an mDNS response.
  2. So “all DNS responses” had to say whether mDNS was included. Per the reference answer dns.flags.response == 1, it is.
  3. As a result, a phrasing like tcp.flags.fin == 1 || (dns && dns.flags.response == 1) went from full marks to silent-wrong, because tshark parses mDNS as a separate protocol, and the protocol name dns does not match it. Fortunately no committed answer had yet been written that way.

One probe is not enough

This approach had a predecessor. When the benchmark was set up on September 9, three probes per question were compared against one (ablation 003). At the time there were 36 questions, each with one hand-written error example:

Three probesFirst probe only
Error examples killed36 / 3635 / 36 (97.22%)
tshark calls324108
p95 latency91.966 ms91.966 ms

With one probe, the kill rate was still above the 95% threshold. But the one missed was syn-no-ack: its error example and the reference answer differ only on SYN-ACK packets, and the first probe deliberately had no SYN-ACK.

The conclusion was to keep three probes. The two approaches do not behave equivalently; what is lost is one concrete counterexample.

A ratio threshold hides the one counterexample that got away. The later gate does not look at ratios at all: every mutant is either killed or waived with a stated reason.

The gate’s own blind spots

The mutant gate can only find errors expressible in its mutation types. During the September 23 audit of the second dev split run, reading the answers showed two more gaps in the probes that the gate could not find: one had already let a wrong answer score full marks, and the other had not yet been hit by any answer. Both were fixed the next day (dns-off-port-and-fin-ack.md).

The first was in a question asking for “non-DNS UDP packets” with destinations in 10.0.0.0/8:

  • The reference answer is udp && !dns && ip.dst == 10.0.0.0/8.
  • The typed intent C3/mei-0011 produced compiled to udp.port != 53 && ip.dst == 10.0.0.0/8, and scored full marks.
  • In tshark, whether a packet is DNS is decided by the dissector, not by the port number. Its dns_udp heuristic parsing is on by default: when neither endpoint’s port has a registered dissector, DNS packets not on port 53 are still recognized as DNS. But the probes had no such packet.

The second was in a question asking for “TCP FIN packets,” which no answer had yet hit:

  • In a normal connection close, FIN usually appears together with ACK.
  • But the FINs in the probes happened to carry no other flags. So a phrasing requiring FIN and not ACK, or one that understood FIN as the whole flags field equal to 1 and wrote tcp.flags == 1, would select the same packets as the reference answer.

The fix came in two steps.

Step one: add two mutation types to the gate:

  • protocol-as-port: write a protocol test as its usual port, e.g. write dns as udp.port == 53;
  • flag-as-byte: write a flag as the whole flags field equal to that bit.

Step two: add two packets to the probes:

  • an A query from port 6100 to port 52 on 10.2.3.6. Neither port has a registered dissector; only the heuristic recognizes it as DNS.
  • a packet sent from port 443 with both FIN and ACK set.

This took the witnesses from 31 to 33 and the mutants from 182 to 192. Running the 192 mutants against the old probes with only 31 witnesses left 3 survivors with no waiver. Besides the two above, there was tcp.flags == 16 && !(ip.src == 192.0.2.0/24) in the test split, which the record says “no audit had named.” After adding the two packets, no unwaived survivor remained, and the original 4 equivalence waivers stayed as they were (6079cec, a1d3724).

The docs also state plainly that these two mutation types were chosen after the gaps were known:

  • protocol-as-port was written only after reading mei-0011;
  • flag-as-byte repeats error examples from the earliest benchmark, such as using tcp.flags == 2 for SYN. Those examples were hand-written before any model run.

For the published numbers, the effect was that the second run’s C3 went from 8 strong exact to 7: the mei-0011 above became silent-wrong. C4−C3 went from +0.125 [−0.125, 0.438] to +0.188 [0.000, 0.500], with only 2 discordant cases, still inconclusive.

The remaining limits are also written in the docs:

  • near misses that are wrong in two places at once are outside the scope of single-site mutation;
  • the DNS packet depends on heuristic parsing staying on. If a future tshark or configuration turns it off, the decoding test will fail.

All the gate can guarantee is the errors its mutation types can express. The mutation types themselves are a hypothesis about “what errors look like,” and it has to be supplemented by reading real answers.

A packet prepared for a hypothetical error caught a real one

The packet with FIN and ACK was prepared for a hypothetical wrong answer, tcp.flags == 1.

On October 1, the test split requests were sent to models for the first time. Test item mei-1038 asks exactly the opening sentence: all TCP segments with source port 443 and FIN, whether or not ACK is set, ports only. The typed intent qwen3-32b produced under C4 compiled to:

Text
(tcp.srcport == 443 && tcp.completeness.fin == true)

The reference answer is tcp.flags.fin == 1 && tcp.srcport == 443.

tcp.completeness is tshark’s session completeness field; it describes the whole TCP session, not this packet’s own FIN flag. On the frames discussed below, tcp.completeness.fin is false.

Yet among the 16 fields retrieved for the model this time, there was the ACK flag tcp.flags.ack (display name Acknowledgment), but no FIN flag tcp.flags.fin. The only field whose display name is FIN was tcp.completeness.fin, type boolean, right next to tcp.completeness.ack, whose display name is ACK. From the list, it looked like the FIN flag itself.

This answer compiled and ran, but selected no packets on any of the three probes, missing the one frame each probe should select: the FIN+ACK sent from port 443. On semantic-37, it is frame 60.

That frame is exactly the witness packet added later, and also the last packet of every probe. The three test probes have 26, 27, and 33 benchmark frames respectively; with 33 witness packets each, the last frames are 59, 60, and 66.

This question’s labels fall entirely on witness packets. Without them, the set to select on all three probes would be empty. The scorer does not accept all-empty labels, so the question could not be scored at all.

Also, tcp.completeness is derived session state, already on the shortcut rule’s list. Even if it had happened to select correctly, it would only count as a shortcut.

In the repair round, the model saw a counterexample card showing a FIN+ACK frame from another, unscored feedback probe. It changed its answer to (tcp.srcport == 443 && tcp.flags.fin == true), strong exact on all three probes. However, when told only “wrong” with no card, it also fixed it, so this example says nothing about the card’s value. The design of the repair round, and an example that only a card could fix, are in the next post.

This trajectory is on the site’s front page. It was selected by a rule, not by a person; that rule was registered before any test answer existed.

Screenshot of the DFilterForge front page. Small text at top left reads test-qwen3-32b-2026-09-26, pass A; top right reads Condition C4, scored silent-wrong. The headline is 'Frame 60 disproves', with 60 in carmine. Below the headline is the model's answer (tcp.srcport == 443 && tcp.completeness.fin == true), underlined in carmine. Below that is the English request, then an explanation: the reference filter is tcp.flags.fin == 1 && tcp.srcport == 443, and this answer disagrees with it at frame 59 of semantic-31, frame 60 of semantic-37, and frame 66 of semantic-43. Below the explanation are three buttons: Play the sweep, Previous disproof, Next disproof. On the left are three bars for the probes, each with a carmine tick at its end; below them is a ladder diagram of semantic-37, with a vertical line on the left for address 192.0.2.137 and other hosts on the right, one packet per row, each row with an arrow and a summary in the Info column. On the right are a legend and an explanation.
Figure 1: The front page. The red tick at the end of each bar is the frame that disproves this answer.

How much would be lost without these packets

On October 20, the project replayed the 971 runnable answers from four hosted models on the test split against the three test probes with the witness packets removed (Exhibits page):

  • 731 were strong exact. With the witness packets added, 11 of those are silent-wrong.
  • Another answer had already been judged shortcut, and with these packets added it also fails to match.
  • 4 questions have labels that fall entirely on witness packets. The 102 answers to those 4 questions could not be scored without them.

All published scores are the results with witness packets included.

The flipped answers span 6 questions, and 10 of the 33 witness packets caught at least one. A few typical ones:

  • tcp-destination-not-https, 5 answers. The request explicitly says to include return traffic from port 443; the reference answer is tcp.dstport != 443, and one answer was tcp && !tcp.port == 443. tcp.port matches either endpoint, so excluding 443 also excludes packets sent from 443. No benchmark frame is sent from 443, so against benchmark frames alone these answers are all correct.
  • ack-outside-testnet, 3 answers, such as tcp.flags.ack && !ip.src == 192.0.2.0/24. Writing just tcp.flags.ack asks whether the field exists, and every TCP header has this field, so it keeps all TCP segments sent from outside TEST-NET-1. In the benchmark frames, such packets all happened to carry ACK. A witness SYN sent from 443 without ACK broke it.
  • dns-response-not-nxdomain, 1 answer. The request says to include mDNS, and the answer used dns. But tshark parses mDNS as a separate protocol, merely sharing the dns.* fields.

These are all very common Wireshark confusions:

  • whether a field refers to one endpoint or either endpoint;
  • whether the comparison is on the field’s value or the field’s existence;
  • whether a protocol name and a field name are the same thing.
Screenshot of DFilterForge's Exhibits page. A note at the top says all published scores use the witness packets. The headline reads 'Without the witness packets, the verifier passes 731 answers as exact. 11 of them are wrong.', the second sentence in carmine. Below is an explanation: the 3 test probes have 26, 27, and 33 benchmark frames, and the witness packets add 33 packets to each probe; replaying on benchmark frames alone, 731 of the 971 answers from 4 hosted models are strong exact, and with witness packets added 11 of those are wrong; another 102 answers can only be scored thanks to the witness packets. Below that is 'Every answer, one square': one square per runnable answer, one row per model, dark for strong exact, red for silent-wrong, squares with red outlines for answers flipped by witness packets — qwen3-32b has 2, qwen3.5-9b has 7, qwen3.5-122b-a10b has none, deepseek-v4-pro-0813 has 3. The bottom line reads: with witness packets, 804 strong exact, 2 shortcut, 165 silent-wrong.
Figure 2: The Exhibits page. Each square is one answer; the 12 with red outlines are the ones flipped by witness packets.

Shortcut: right packets, wrong reason

There is another kind of answer that matches on all three probes, but for the wrong reason. It might:

  • count frame numbers;
  • read the capture’s clock;
  • follow stream numbers;
  • copy some constant the packet-building script happened to use.

Such a filter is fully correct on these probes, yet says nothing about the request itself. Worse, the repair round’s counterexample cards show the model the raw header field values, and later preference training might reward such answers, so models could easily learn to exploit the gap.

So the protocol defines a separate outcome called shortcut. The rule was committed into the protocol before the code implementing it. Both of the following count as shortcut:

  • Use of these fields:
    • fields whose type in the field catalog is frame number or time;
    • fields starting with frame. (except frame.len, frame.cap_len, frame.protocols), and fields starting with _ws.;
    • stream numbers and derived session state, such as tcp.analysis, tcp.completeness;
    • ip.id, dns.id, checksums, raw sequence numbers.
  • Use of constants not written in the request:
    • a host address;
    • the packet-building script’s ephemeral port range 41000 to 51254;
    • MAC addresses;
    • generated DNS names.

The first implementation was reviewed before any test request went out, and the review found one crash and a string of holes (ablation 006):

  • Crash: ip.ttl <= 01. tshark reads the leading 0 as octal, but the scanning code used Python’s int(text, 0). With base 0, Python does not accept decimal literals with leading zeros; int('01', 0) raises ValueError outright, precisely to avoid octal ambiguity. As the record puts it, one such answer could stop an entire scoring run.
  • Misses: dns.unsolicited slipped through; it is a boolean field that depends on other frames. Binary integers, MACs in dotted form, hostnames in quotes, and generated names without quotes also slipped through.
  • False positives: 65535, and the boundaries of intervals given in the request, were judged shortcut. They are really just restating the question.
  • Too coarse a criterion: “written in the request” was only a substring match.
  • Tests did not guard the guards: deleting the field catalog type lookup, the request text precheck, or the canonical IR precheck entirely still left all tests green.

The fixes:

  • read integers in the bases tshark accepts;
  • revise the rules before any test request;
  • add a unit test for each case;
  • give every guard a test that watches it: now deleting any one of them fails a test.

Ablation 006 also answered a question: is it necessary to check types in the field catalog?

  • The field catalog’s types recognize all 2,470 frame-number and time fields; name rules alone recognize only 21.
  • Of 8 shortcut filters written in advance and not yet run, 6 matched exactly on the probes. Without type information, 3 of them would score full marks. All 3 add one extra condition to the reference answer: !dns.response_in, !(tcp.time_delta > 100), and !dns.response_to.

Take !(tcp.time_delta > 100): each probe spans less than 0.07 seconds, so this condition holds for every packet; but in a real capture, the correct packet on a stream more than 100 seconds after the previous one would be dropped by it.

None of the 264 filters derived from reference answers (reference filters, canonical IR, hand-written error examples, and the 192 mutants) or the 84 committed answers was falsely flagged by this rule. Each answer costs about 0.1 ms extra, against roughly 60 ms per tshark call.

Its limit is that it looks only at names and literals, not meaning. The relative sequence and acknowledgment numbers tshark computes per capture are invisible to it, and can only be handled by paired witness packets.

A few other points

  • Replays must rerun the reference answer too. Deliberately loosening the reference labels to tcp makes a full replay stop after one call with reference_label_mismatch; replaying only the candidate answers would call the candidate fully correct (ablation 004).
  • The last review before freezing changed several questions (e29994e):
    • One test request had 71 retrieval tokens, over the retriever’s limit of 64. When preparing prompts, a split is retrieved in one pass, so no test prompt could be built at all.
    • “between 1 and 64 - 1 and 64 are excluded” could be read with “64 - 1” as 63.
    • A question about direction used mDNS’s port 5353, but both endpoints usually use that port, so direction cannot be told by port.
  • Item numbering changed to blocks. Items were originally numbered in one continuous run: first the directly answerable dev split questions, then the directly answerable test split questions, then all the questions in both splits that could not be answered directly (those needing clarification, and those inexpressible as filters). The dev split’s questions of this kind came after the 80 test items, so any change to the test split shifted their numbers. Before freezing, numbering changed to blocks starting at mei-0001, mei-0501, mei-1001, and mei-1501, so the directly answerable test split items all start at mei-1001 (a883fcf).
  • Requests may not contain field names or operators. A CI test reads all field names from the field catalog. If any request text contains a dotted field name (like tcp.dstport) or operators like ==, &&, the test fails. Requests should describe what to look for in the language of networking; writing a field name gives away part of the answer (ad0a46a).
  • A protocol port hit by coincidence. One benchmark frame’s port number, 41170, happens to be the Manolito protocol’s port in tshark, so frame 28 of semantic-43 is still parsed as a malformed Manolito packet. It predates the witness packets and is documented as a known leftover.

Summary

  • Labels must come from how packets were built, not from any filter; the reference answer must pass the labels first;
  • test data needs testing too. Whether a set of probes can judge wrong answers depends on whether it can separate the reference answer from each of its near neighbors, and mutants are ready-made near neighbors;
  • a ratio threshold hides the counterexample that got away, so every mutant must be accounted for: either killed or waived with a stated reason;
  • the mutation types themselves are a hypothesis about “what errors look like,” and the gate can only guarantee what they can express; the rest has to come from reading real answers;
  • selecting the right packets is not the same as answering the question. Frame numbers, clocks, and build-time constants all need their own defenses.

The next post covers the other half: give the model the packet that disproved its answer, and see whether it can fix it.

Footnotes

  1. The repository is WeiGuang-2099/DFilterForge. The source and docs linked in this post are pinned to the November 9, 2026 commit 09bb537. ↩︎