Recent models generate sewing patterns from images or text, and program-based representations make these patterns executable. These systems produce a finished pattern and do not model how a patternmaker turns one pattern into another. In practice a new style is made by editing an existing pattern: lengthening the bodice, moving a dart, swapping a sleeve. Pattern archives record the results of such edits and none of the steps. We observe that the steps can be recovered by searching over editing actions until one pattern becomes the other. A deterministic compiler makes the recovered steps checkable. To this end, we present SemDraft, the first framework that learns to search for executable patternmaking programs from paired before-and-after sewing patterns without recorded editing steps. Specifically, a bounded search recovers a program of editing actions and certifies it only after three checks: it recompiles from scratch, every pair of its actions is classified as ordered or interchangeable, and an independent replay reaches the same pattern. The certified programs then train a model that ranks candidate actions inside the same search. On two frozen draws of 80 order-sensitive cases, with every other search component fixed, the learned ranker certifies 63 and 64 cases within 1,000 search executions, against at most 53 and 52 for non-learned rankers.
Figures & tables
Figure 1: Overview of SemDraft on one case of the development corpus. (a) The input is a base pattern and a target pattern; the editing steps between them are not recorded. Red marks the changes, numbered by the step that makes them. (b) A bounded search over nine editing actions, executed by a deterministic compiler, recovers a program, and three checks certify it; the certificate classifies every pair of actions as ordered or interchangeable, which here admits three orders. (c) Certified programs train a model that ranks candidate actions (P). It is compared with the teacher heuristic (H), a random order (R) and a template lookup (T) inside one bounded search with the same candidates, beam, stopping rule, certifier and budget; bars: certified main-test cases of 80 at beam 4.
Figure 2: In the case of Fig. 1 , the sleeve attachment has to follow the length adjustment, because the compiler sets a sleeve’s width to the combined length of the front and back armholes it is sewn to. Compiled front bodice and right sleeve at one scale, without the darts, which end up identical in both orders; solid outlines show the state when the sleeve is attached. (a) In the certified order the sleeve matches the target. (b) Attached first, the sleeve is sized from the 18.0 cm armhole and keeps that size after the bodice is lengthened (dotted), so the program misses the target (Appendix E ).
Figure 3: Matched-condition comparison on the 80 Tier-C main-test cases. (a) Certified cases per ranking signal at beam 1 (light) and beam 4 (dark) within 1,000 search executions, the 5% budget; hatching marks the linear-imitation variant of the prior. (b) Certified cases against search executions at beam 4, read off the same runs; dotted lines mark 200 and 400 executions (1% and 2% of the cap).
Figure 4: Paired gain of the prior (P-DAG) over the teacher heuristic (H) at beam 4 within 1,000 search executions, in percentage points; bars show the case-bootstrap range of each gain. The last row applies beam de-duplication to both. The right column gives the gain and both counts.
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
Ranker
beam
tight
certified
cert. at 1%
at 2%
search exec.
cert. exec.
wall (s)
H: teacher heuristic
1
52
51
49
51
103
43
117
R: random ( × 3)
1
18
17.7
17.7
17.7
15
51
14
T: template lookup
1
36
27
27
27
14
40
17
P: prior, linear
1
41
35
35
35
14
43
17
P: prior, DAG ( × 2)
1
41
35
35
35
14
43
17
H: teacher heuristic
4
52
51
4
29
351
43
349
Appendix
Table 1: Main comparison on the 80 Tier-C main-test cases (frozen evaluation set). All conditions use the same candidates, beam width, public-metric stopping rule, certifier and execution budget (5% of the tier cap, 1,000 executions); only the ranking signal differs. R is the mean over three seeds and P-DAG over two training seeds. Search executions: median engine executions to the first tight state over successful cases; certification executions: median over certified cases; wall clock: median seconds per case including certification. Certified at 1% / 2%: the same runs truncated at 200 / 400 executions.
main test (80)
replication (80)
parameter shift (20)
template shift (20)
Ranker
b. 1
b. 4
b. 1
b. 4
b. 1
b. 4
b. 1
b. 4
H: teacher heuristic
51
51
52
52
11
11
10
10
R: random ( × 3)
17.7
37.7
16.3
37.3
1.7
9.7
3.3
9.3
T: template lookup
27
53
33
51
7
9
6
10
P: prior, linear
35
61
47
64
10
11
10
13
P: prior, DAG ( × 2)
35
63
46
64
10
13
9
14
Appendix
Table 2: Robustness of the main comparison: certified cases at the 5% budget on the main test, on an independent replication draw from the same generator (80 further Tier-C cases, protocol frozen before the run), and under two distribution shifts (20 cases each). Same conditions as Table 1 ; the prior is not retrained. Table 3 gives the paired gains.
Set (cases)
Comparison
Gain (cases)
Gain (points)
Range (points)
Main test (80)
P over H
12
15.0
3.8 to 27.5
P over T
10
12.5
3.1 to 21.9
P over R
25.3
31.7
21.0 to 42.3
P with linear imitation over H
10
12.5
1.3 to 25.0
Replication (80)
P over H
12
15.0
6.3 to 25.0
P over T
13
16.3
8.8 to 25.0
Appendix
Table 3: Paired gains in certified success at beam 4 within 1,000 search executions, in cases and in percentage points of each set. P is the prior with DAG supervision averaged over its two seeds, except where linear imitation is named. The range spans the 2.5th to 97.5th percentiles of 2,000 bootstrap resamples of the cases.
main test
replication
Family
depth 6
depth 7
depth 8
all (20)
depth 6
depth 7
depth 8
all (20)
tee
7 / 3 / 7
7 / 6 / 1
2.5 / 3 / 0
16.5 / 12 / 8
7 / 6 / 7
7 / 5 / 1
2 / 1 / 0
16 / 12 / 8
skirt
7 / 7 / 7
7 / 7 / 7
6 / 1 / 6
20 / 15 / 20
7 / 7 / 7
7 / 7 / 7
6 / 1 / 6
20 / 15 / 20
pants
7 / 7 / 7
4 / 5 / 7
0 / 0 / 4
11 / 12 / 18
7 / 7 / 7
7 / 5 / 7
0 / 0 / 3
14 / 12 / 17
dress
7 / 7 / 4
7 / 6 / 1
1.5 / 1 / 0
15.5 / 14 / 5
7 / 6 / 6
7 / 6 / 1
0 / 0 / 0
14 / 12 / 7
all
28 / 24 / 25
25 / 24 / 16
10 / 5 / 10
63 / 53 / 51
28 / 26 / 27
28 / 23 / 16
8 / 2 / 9
64 / 51 / 52
Appendix
Table 4: Certified cases by family and target depth at beam 4 within 1,000 search executions, as P-DAG (mean of two seeds) / T / H. Depth-6 and depth-7 cells have seven cases and depth-8 cells six. Resampling the twelve family-by-depth cells instead of the cases widens the bootstrap range of the gain of 15 points over H to −10 to 40 points on the main test and to −4 to 37 points on the replication draw.
Ranker
A (15)
B (10)
C (11)
all (36)
exec. med / max
certified
Policy, DAG supervision, greedy
15
10
10
35
14 / 30
35/35
Policy, DAG supervision, beam 4
15
10
11
36
56 / 278
–
Policy, linear imitation, greedy
15
10
10
35
14 / 30
–
Random ranker (control)
14
10
2
26
10 / 30
–
Appendix
Table 5: Rollouts on the random held-out split with 5% of the teacher’s per-tier execution cap. Success is the public tight criterion. Executions are the median and maximum engine executions of successful episodes. Certified: the successful programs re-verified with the teacher’s full certification.
Figure 5: Policy rollouts. (a) Random held-out split: the policy matters only on Tier C, where a random ranker over the same legal candidates fails. (b) Held-out family: the policy is below the random control on three of four families. (c) The 23 Tier-C cases the teacher could not solve: the policy-guided beam of four certifies seven of them with about 300 executions each.
Teacher-failed Tier C (23)
tight
certified
Generalisation split
policy
random
Policy, greedy, 5% budget
4
4
family tee (37; C 14)
20 (C 0)
24 (C 3)
Policy, beam 4, 20% budget
9
7
family skirt (60; C 20)
54 (C 16)
39 (C 6)
Random ranker, 5% budget
0
0
family pants (52; C 14)
29 (C 0)
46 (C 9)
family dress (36; C 9)
25 (C 0)
27 (C 0)
composition (57 Tier C)
0
20
Appendix
Table 6: Rollouts on the 23 Tier-C cases the teacher failed (no training data from these cases) and on the generalisation splits. Family: the policy is trained on the other three families; random control uses the same candidates and budget. Composition: trained on Tiers A and B only, tested on all 57 certified Tier-C cases.
Figure 6: Teacher on the held-out positions of the development corpus: tight and certified rates per tier.
Mechanism
cases
families
evidence in the trace
Beam collapse
16
tee 6, pants 1, dress 9
44–96 prefixes but 1–2 distinct states; no lookahead landing (11) or landed but displaced (5 dress)
Wall-clock limited
3
pants 3
depth 5 of 8, 7 distinct states, best Chamfer 0.002
Mixed
4
pants 2, dress 2
3–4 states or empty frontier at deadline
of which result-write timeout
5
tee 1, dress 4
search finished; killed 19–41 s past the hard stop while writing the result
Appendix
Table 7: Trace-level classification of the 23 non-certified Tier-C held-out cases. Beam collapse: the beam fills with reorderings of the same actions. Distinct states is the number of different pattern states among the surviving beam prefixes at the last completed depth.
overall (of 80)
certified per family
Tier (protocol)
tight
certified
search failed
write timeout
tee
skirt
pants
dress
A (v9)
80
77
0
0
–
–
–
–
B (v9)
69
51
11
0
–
–
–
–
B (v10.4.1)
79
70
1
0
19
20
20
11
C (v10.4.1)
57
57
18
5
14
20
14
9
Appendix
Table 8: Teacher results on the held-out positions of the development corpus (80 cases per tier); these are oracle-informed development results (Sec. 3.2 ). Tight is the public endpoint criterion; certified additionally passes recompilation, the order check and the independent replay. Tier A was run under protocol v9; Tiers B and C under v10.4.1 (Sec. 3.2 ). Per-family counts are certified cases out of 20.
Reference failure mode
n
H
R
T
P-DAG
tight, not certified
5
5
3.7
4
5
search envelope exhausted
27
10
7.3
16
20
result-write overrun after search
18
6
3
9
9
all
50
21 (21)
14 (5.7)
29 (10)
34 (14)
Appendix
Table 9: Beyond the teacher: certified cases within 1,000 executions on the 50 main-test cases that the teacher’s reference configuration misses, by its failure mode (beam 4; beam 1 in parentheses). R is the mean over three seeds, P-DAG the count certified by both training seeds. The reference configuration itself certifies 30 cases (17 of 28 at depth 6, 10 of 28 at depth 7 and 3 of 24 at depth 8), with a median of 1,320 executions and 1,373 s each. On these 30 cases, P-DAG certifies 27 with both seeds, T 24 and H 30.
Supervision
type
majority
anchor
joint
STOP
amount MAE / mean pred. (mm)
DAG (seed 1)
0.919
0.488
0.990
0.911
1.000
4.9 / 10.9
DAG (seed 2)
0.917
0.488
0.990
0.909
1.000
4.9 / 10.9
Linear imitation
0.919
0.446
0.986
0.909
1.000
5.8 / 11.6
Appendix
Table 10: Teacher-forced next-action accuracy on the random held-out split (36 cases, 529 states). Majority-class baselines and a mean predictor for the millimetre amount are shown for calibration. Two seeds of DAG supervision differ by 0.2 points.
Figure 7: A certified trajectory replayed in Seamly2D: base state with the target overlaid as dashed contours (left) and the certified endpoint (right).
Inference-time search uses extra computation at deployment to explore, score, and select candidate reasoning paths or actions without retraining a model.