hpc-labs.ai

AI-boosted software optimizations/refactoring. From code to silicon - measured and verified.

All samples

ParetoStack-soft 1.3.19: five samples to judge before installing

Ces pages d’exemples sont en anglais.

Each sample below ships in the release. The right-hand column is what the released product writes, with one edit: the names the product generated, and any generated comments, were replaced by neutral text (names such as _gen_1). Long generated helper blocks are replaced by a marked line. Nothing else was changed. The patches shown were produced again on 2026-11-29 from the 1.3.19 sources; the timing runs did not keep their patches. The gains come from the recorded timing runs.

These are small example programs written to show the product. They are not a prediction for your code. In the 21-sample run of this release: AWS Graviton3, 16 cores: 19 of 21 verified faster, AMD EPYC 9R14 (AWS c7a.4xlarge): 19 of 21 verified faster, Intel Xeon 8488C (AWS c7i.4xlarge): 19 of 21 verified faster, Apple A18 Pro (Mac): 19 of 21 verified faster.

How a result is accepted

The original and the changed copy are run in alternation on the same machine. A result counts only if the output passes the declared check (identical bytes, or differences within stated numeric limits) and the speed-up is at least 2 % and statistically significant (p < 0.01). The original code is not modified.

1. Word filter (Python)

acceptedoutput identical

Filters a generated word stream against an allow list and a block list held as plain Python lists. Level L2 (data layout and memory); an L1 (loop) item was selected too and leaves no visible change here. This is the largest gain of the 21 samples, not a typical one.

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: main.pyOptimized by the product
unchanged lines not shown
4import sys4import sys
5from pathlib import Path5from pathlib import Path
66
7[ 50 lines of generated helper code not shown here; they are in the real patch ]
57
58
7VOCAB, ALLOWED, BLOCKED, WORDS = 6000, 1500, 400, 6000059VOCAB, ALLOWED, BLOCKED, WORDS = 6000, 1500, 400, 60000
860
961
10def filter_words(words, allowed, blocked):62def filter_words(words, allowed, blocked):
11 kept = []63 kept = []
64 _gen_1 = _gen_2(allowed)
65 _gen_3 = _gen_2(blocked)
12 for w in words:66 for w in words:
13 if w in allowed and w not in blocked:67 if (_gen_1(w)) and (not _gen_3(w)):
14 kept.append(w)68 kept.append(w)
15 return kept69 return kept
1670
1771
18def unique_words(words):72def unique_words(words):
19 seen = []73 seen = []
74 _gen_4 = _gen_5(seen)
20 for w in words:75 for w in words:
21 if w not in seen:76 if (not _gen_4.has(w)):
22 seen.append(w)77 _gen_4.append(w)
23 return seen78 return seen
2479
2580
unchanged lines not shown

Measured gain

MachineDate (UTC)ReleasePythonMeasured result
AWS Graviton3, 16 cores2026-11-291.3.193.12.380.69x faster
AMD EPYC 9R14 (AWS c7a.4xlarge)2026-11-291.3.193.12.373.07x faster
Intel Xeon 8488C (AWS c7i.4xlarge)2026-11-291.3.193.12.365.53x faster
Apple A18 Pro (Mac)2026-11-291.3.193.12.1659.15x faster

Checked by: the output JSON files compared byte for byte.

2. Matrix multiply (C++)

acceptedoutput identical

A textbook triple loop. Levels L2 (memory access order) and L1. The build script of the sample also receives a small loop change (not shown).

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: main.cppOptimized by the product
unchanged lines not shown
6#include <string>6#include <string>
7#include <vector>7#include <vector>
88
9[ 11 lines of generated helper code not shown here; they are in the real patch ]
20
21
9static uint64_t seed = 88172645463325252ULL;22static uint64_t seed = 88172645463325252ULL;
10static double rnd() { seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return (double)(seed % 20001) / 1000.0 - 10.0; }23static double rnd() { seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return (double)(seed % 20001) / 1000.0 - 10.0; }
1124
12void matmul(const double* A, const double* B, double* C, long M, long N, long K) {25void matmul(const double* A, const double* B, double* C, long M, long N, long K) {
13 for (long i = 0; i < M; ++i) {26 if ((M) > 0 && (N) > 0 && (K) > 0 && (K) >= 0 && (N) >= 0 && (N) >= 0 && _gen_1(_gen_2(C, 0), _gen_2(C, ((M) - 1) * (N) + (N)), _gen_2(A, 0), _gen_2(A, ((M) - 1) * (K) + (K))) && _gen_1(_gen_2(C, 0), _gen_2(C, ((M) - 1) * (N) + (N)), _gen_2(B, 0), _gen_2(B, ((K) - 1) * (N) + (N)))) {
27 for (long i = 0; i < (M); ++i) for (long j = 0; j < (N); ++j) C[i * N + j] = 0.0;
28 for (long _gen_3 = 0; _gen_3 < (M); _gen_3 += 32)
29 for (long _gen_4 = 0; _gen_4 < (K); _gen_4 += 128) {
30 long _gen_5 = _gen_3 + 32 < (M) ? _gen_3 + 32 : (M); long _gen_6 = _gen_4 + 128 < (K) ? _gen_4 + 128 : (K);
31 for (long i = _gen_3; i < _gen_5; ++i)
32 for (long k = _gen_4; k < _gen_6; ++k) {
33 const double _gen_7 = A[i * K + k];
34 for (long j = 0; j < (N); ++j) C[i * N + j] += _gen_7 * B[k * N + j];
35 }
36 }
37 } else {
38 for (long i = 0; i < M; ++i) {
14 for (long j = 0; j < N; ++j) {39 for (long j = 0; j < N; ++j) {
15 double sum = 0.0;40 double sum = 0.0;
16 for (long k = 0; k < K; ++k) {41 for (long k = 0; k < K; ++k) {
unchanged lines not shown
18 }43 }
19 C[i * N + j] = sum;44 C[i * N + j] = sum;
20 }45 }
46 }
21 }47 }
22}48}
2349
unchanged lines not shown

Measured gain (computation time; compilation not counted)

MachineDate (UTC)ReleasePythonMeasured result
AWS Graviton3, 16 cores2026-11-291.3.193.12.34.34x faster
AMD EPYC 9R14 (AWS c7a.4xlarge)2026-11-291.3.193.12.34.44x faster
Intel Xeon 8488C (AWS c7i.4xlarge)2026-11-291.3.193.12.32.71x faster
Apple A18 Pro (Mac)2026-11-291.3.193.12.165.14x faster

Checked by: the result arrays compared byte for byte. Whether floating-point C or C++ stays identical after such a change depends on compiler settings; a difference would be reported as a failed check.

3. FIR filter (Python, tolerance contract)

acceptedjudged by tolerance

A direct double-loop convolution. Levels L3 (algorithm change) and L4 (a port of the loop to C), plus L1. The kept change holds both: the compiled path is tried first and the other paths are fallbacks, so which one runs depends on the machine. The compiled path needs a C compiler: at first use the optimized program compiles it and saves the library on disk.

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: main.pyOptimized by the product
1"""FIR filtering written the textbook way: a double loop that adds every input sample times every filter tap into the output (a direct convolution). A long signal and a long filter make it O(n*m);1"""FIR filtering written the textbook way: a double loop that adds every input sample times every filter tap into the output (a direct convolution). A long signal and a long filter make it O(n*m);
2the same result is an FFT away. FFT rounding differs from the direct sum in the last digits, so the output is judged by a tolerance, not byte for byte. NumPy only."""2the same result is an FFT away. FFT rounding differs from the direct sum in the last digits, so the output is judged by a tolerance, not byte for byte. NumPy only."""
3[ 58 lines of generated helper code not shown here; they are in the real patch ]
3import sys61import sys
4from pathlib import Path62from pathlib import Path
563
unchanged lines not shown
866
9def fir(signal, taps):67def fir(signal, taps):
10 out = np.zeros(len(signal) + len(taps) - 1)68 out = np.zeros(len(signal) + len(taps) - 1)
11 for i in range(len(signal)):69 if _gen_1(out, signal, taps, len(signal), len(taps)):
12 for j in range(len(taps)):70 _gen_2(out, signal, taps, len(signal), len(taps))
13 out[i + j] += signal[i] * taps[j]71 else:
72 _gen_3 = range
73 _gen_4 = len
74 for i in range(len(signal)):
75 for j in _gen_3(_gen_4(taps)):
76 out[i + j] += signal[i] * taps[j]
14 return out77 return out
1578
1679
unchanged lines not shown
19 t = np.arange(12000)82 t = np.arange(12000)
20 signal = np.sin(2 * np.pi * t / 97.0) + 0.5 * np.sin(2 * np.pi * t / 13.0) + 0.2 * rng.randn(t.size)83 signal = np.sin(2 * np.pi * t / 97.0) + 0.5 * np.sin(2 * np.pi * t / 13.0) + 0.2 * rng.randn(t.size)
21 results = []84 results = []
85 _gen_5 = np.arange
86 _gen_6 = np.sinc
87 _gen_7 = np.hamming
88 _gen_8 = results.append
89 _gen_9 = fir
22 for n_taps, cutoff in ((301, 0.05), (257, 0.12), (201, 0.2)):90 for n_taps, cutoff in ((301, 0.05), (257, 0.12), (201, 0.2)):
23 k = np.arange(n_taps) - n_taps // 291 k = _gen_5(n_taps) - n_taps // 2
24 taps = np.sinc(2 * cutoff * k) * np.hamming(n_taps) * 2 * cutoff # a windowed-sinc low-pass92 taps = _gen_6(2 * cutoff * k) * _gen_7(n_taps) * 2 * cutoff # a windowed-sinc low-pass
25 results.append(fir(signal, taps))93 _gen_8(_gen_9(signal, taps))
26 out = Path(out_dir)94 out = Path(out_dir)
95 _gen_10 = np.save
27 for i, r in enumerate(results):96 for i, r in enumerate(results):
28 np.save(out / f"filtered_{i}.npy", r)97 _gen_10(out / f"filtered_{i}.npy", r)
2998
3099
31if __name__ == "__main__":100if __name__ == "__main__":
unchanged lines not shown

Measured gain

MachineDate (UTC)ReleasePythonMeasured result
AWS Graviton3, 16 cores2026-11-291.3.193.12.335.66x faster
AMD EPYC 9R14 (AWS c7a.4xlarge)2026-11-291.3.193.12.326.84x faster
Intel Xeon 8488C (AWS c7i.4xlarge)2026-11-291.3.193.12.320.65x faster
Apple A18 Pro (Mac)2026-11-291.3.193.12.1624.05x faster

Checked by: every output value within an absolute difference of 0.000001 of the original (the limit written in the sample). The records report "accuracy kept (1-max_rel = 1.0000)".

4. Rejected: a faster copy that gives other numbers

rejected

A ledger calculation that looks like an ordinary matrix product. Each row holds very large amounts and their exact reversals next to ordinary ones, so the result depends on the order of the additions. A tuned library adds in another order. The sample asks for agreement to about 12 digits (relative 1e-12, absolute 1e-6). This sample was written so that the change should be refused.

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: main.pyOptimized by the product
unchanged lines not shown
2faster, but the amounts hold very large entries that cancel each other (1e16 and -1e16 next to ordinary values), so the result depends on the order in which the terms are2faster, but the amounts hold very large entries that cancel each other (1e16 and -1e16 next to ordinary values), so the result depends on the order in which the terms are
3added: adding 1e16, then 1.0, then -1e16 gives 0.0, while 1e16 - 1e16 + 1.0 gives 1.0. The loop adds them in a fixed order and the downstream check compares against totals made3added: adding 1e16, then 1.0, then -1e16 gives 0.0, while 1e16 - 1e16 + 1.0 gives 1.0. The loop adds them in a fixed order and the downstream check compares against totals made
4that way, to 12 digits. A library adds them in another order (blocks, several running sums), which gives other numbers here. The correct outcome is that the swap is rejected."""4that way, to 12 digits. A library adds them in another order (blocks, several running sums), which gives other numbers here. The correct outcome is that the swap is rejected."""
5[ 16 lines of generated helper code not shown here; they are in the real patch ]
5import sys21import sys
6from pathlib import Path22from pathlib import Path
723
unchanged lines not shown
14 n, p = a.shape30 n, p = a.shape
15 m = b.shape[1]31 m = b.shape[1]
16 c = np.zeros((n, m))32 c = np.zeros((n, m))
17 for i in range(n):33 if _gen_1(c, a, b, n, m, p):
18 for j in range(m):34 _gen_2(c, a, b, n, m, p)
19 for k in range(p):35 else:
20 c[i][j] += a[i][k] * b[k][j]36 _gen_3 = range
37 for i in range(n):
38 for j in _gen_3(m):
39 for k in _gen_3(p):
40 c[i][j] += a[i][k] * b[k][j]
21 return c41 return c
2242
2343
unchanged lines not shown

The verifier's recorded reason

fail_accuracy: accuracy contract not met on totals.npy (absolute and relative limits both exceeded)

Run again with release 1.3.19 on 2026-11-29 (an Arm computer): same verdict. 30,940 of 31,200 values were outside the limits; the largest absolute difference was 77.5 (for example -2516.5 became -2439.0).

Recorded runs of an earlier release:

MachineDate (UTC)ReleaseVerdict
AWS Graviton32026-11-231.3.12rejected: accuracy contract not met on totals.npy (the rejected copy ran 34.2x faster)
AWS Graviton52026-11-231.3.12rejected: accuracy contract not met on totals.npy (the rejected copy ran 27.5x faster)
AMD Ryzen 9 7950X (Windows PC, Linux subsystem)2026-11-231.3.12rejected: accuracy contract not met on totals.npy (the rejected copy ran 5.7x faster)
Apple A18 Pro2026-11-231.3.12rejected: accuracy contract not met on totals.npy (the rejected copy ran 22.3x faster)

The speed of a rejected copy is not a result.

5. No gain: correct output, not faster

not accepted: no gainoutput identical

Word and word-pair counts over generated text. The product found only small loop-level changes (L1).

On a narrow screen, scroll the listing sideways: the optimized version is on the right.

Original: main.pyOptimized by the product
unchanged lines not shown
13def make_corpus(n_sentences, seed):13def make_corpus(n_sentences, seed):
14 rng = random.Random(seed)14 rng = random.Random(seed)
15 sentences = []15 sentences = []
16 _gen_1 = range
16 for _ in range(n_sentences):17 for _ in range(n_sentences):
17 words = []18 words = []
18 for _ in range(rng.randint(6, 16)):19 for _ in _gen_1(rng.randint(6, 16)):
19 words.append(rng.choice(FILLER) if rng.random() < 0.3 else rng.choice(VOCAB))20 words.append(rng.choice(FILLER) if rng.random() < 0.3 else rng.choice(VOCAB))
20 sentences.append(" ".join(words))21 sentences.append(" ".join(words))
21 return sentences22 return sentences
unchanged lines not shown
2728
28def tokenize(sentence):29def tokenize(sentence):
29 tokens = []30 tokens = []
31 _gen_2 = len
30 for raw in sentence.split(" "):32 for raw in sentence.split(" "):
31 w = raw.strip().lower()33 w = raw.strip().lower()
32 if len(w) > 0:34 if _gen_2(w) > 0:
33 tokens.append(w)35 tokens.append(w)
34 return tokens36 return tokens
3537
3638
37def count_words(sentences):39def count_words(sentences):
38 counts = {}40 counts = {}
41 _gen_3 = tokenize
42 _gen_4 = is_stop
39 for s in sentences:43 for s in sentences:
40 for w in tokenize(s):44 for w in _gen_3(s):
41 if not is_stop(w):45 if not _gen_4(w):
42 counts[w] = counts.get(w, 0) + 146 counts[w] = counts.get(w, 0) + 1
43 return counts47 return counts
4448
4549
46def count_bigrams(sentences):50def count_bigrams(sentences):
47 counts = {}51 counts = {}
52 _gen_3 = tokenize
53 _gen_1 = range
54 _gen_2 = len
55 _gen_4 = is_stop
48 for s in sentences:56 for s in sentences:
49 toks = tokenize(s)57 toks = _gen_3(s)
50 for i in range(len(toks) - 1):58 for i in _gen_1(_gen_2(toks) - 1):
51 a, b = toks[i], toks[i + 1]59 a, b = toks[i], toks[i + 1]
52 if not is_stop(a) and not is_stop(b):60 if not _gen_4(a) and not _gen_4(b):
53 key = a + " " + b61 key = a + " " + b
54 counts[key] = counts.get(key, 0) + 162 counts[key] = counts.get(key, 0) + 1
55 return counts63 return counts
unchanged lines not shown
5765
58def length_histogram(sentences):66def length_histogram(sentences):
59 hist = {}67 hist = {}
68 _gen_2 = len
69 _gen_3 = tokenize
60 for s in sentences:70 for s in sentences:
61 n = len(tokenize(s))71 n = _gen_2(_gen_3(s))
62 hist[n] = hist.get(n, 0) + 172 hist[n] = hist.get(n, 0) + 1
63 return hist73 return hist
6474
unchanged lines not shown

Measured

MachineDate (UTC)ReleasePythonMeasured result
AWS Graviton3, 16 cores2026-11-291.3.193.12.3no gain (ratio 1.002x)
AMD EPYC 9R14 (AWS c7a.4xlarge)2026-11-291.3.193.12.3no gain (ratio 1.003x)
Intel Xeon 8488C (AWS c7i.4xlarge)2026-11-291.3.193.12.3no gain (ratio 1.003x)
Apple A18 Pro (Mac)2026-11-291.3.193.12.16no gain (ratio 1.006x)

The recorded reason (Graviton3): "identical output but the speed-up (1.002x, p=0.180) is not significant (needs >= 2 % and p < 0.01)".