r/algorithms • • 16d ago

Discussion [Meta] Feedback And Suggestions for the Sub

2 Upvotes

Hi all,

We are looking for ways to improve the subreddit and would appreciate your feedback. Is there anything you would like to see more (or less) of here? Is there anything you think we should do differently?

Feel free to share your thoughts below or send us a modmail if you'd prefer.


r/algorithms • • 18d ago

Discussion This Week I Learned: November 6, 2026

5 Upvotes

This thread is meant for users to share cool recently discovered facts, observations, proofs, algorithms, or concepts that might not warrant their own posts. Please be encouraging and share as much detail as possible, as we’d like this to be a good place for people to learn!


r/algorithms • • 19h ago

Discussion Is the future of research just going to be humans verifying AI-generated slop?

22 Upvotes

I apologise for the loaded title.

One aspect I particularly like about research in mathematics, specifically theoretical computer science, is the culmination of observations and understandings that humans generate. When I read a paper, I mainly witness the fruits of months, years of dedication, motivation and obsession of humans. And these papers tend to be written in ways that are relatable and unique.

Nowadays, major companies like Anthropic and OpenAI seem to be throwing out a low massive claims (such as VP vs VNP) with massive, hard-to-grasp technical papers that would require months to fully examine. A lot of papers in the last few months have been heavily written and guided by AI.

I am afraid of a future where research is mainly about generating papers via AI tools and getting humans the chore to understand all the AI-generated nonsense from scratch. I fear a future where clarity and the quality of exposition are no longer valued.


r/algorithms • • 1d ago

A Claimed Proof of VP != VNP over all Fields (by Anthropic)

Thumbnail
github.com
148 Upvotes

This is crazy... I guess working through this will keep me busy for a while...


r/algorithms • • 1d ago

Research/Papers A deterministic linear-time algorithm for MST

31 Upvotes

https://eccc.weizmann.ac.il/report/2026/339/

It looks like the main idea is in showing that a linear number of edge-weight comparisons is sufficient for finding an MST, after which applying Pettie-Ramachandran (2002) gives a linear-time algorithm. Very cool!


r/algorithms • • 22h ago

Research/Papers Closed Coq proof: fixed 23×8 Minsky table is universal for left-infinite source model — with certificates, no axioms

0 Upvotes

Hi all, posting a closed proof I just finished, with full certificates so you don't have to trust me.

Theorem: lic_lifted_halting_equivalence in formal/utm/MinskyLeftInfiniteClockRun.v

source left-infinite machine halts

<->

exists K t, K >= t /\

c_halted (run t

(if lic_halted c then dispatch_halt_at_y [] []

else lic_q5_encode (lic_head c - Z.of_nat K - 2)

(lic_lift_cfg c)

(lic_book_rows (lic_lift_rows rows)) [])) = true

For nonempty well-formed rows and well-formed source configurations. The existential left-window K is essential — I do not claim a total runtime-independent encode, because wall-halt and lookup-failure halt frames can collide. Empty program is explicitly outside the sentinel encoding's domain.

This closes the host-side obligation for Minsky's published 23×8 universal table — the concrete table, not an abstract fixed UTM — for the left-infinite source model.

How it closed:

• lic_forward_clock — computable recursive native clock • lic_forward_clock_lo_ind — clock is independent of left-window depth • lic_forward_clock_run — clock really reaches native halt, by induction over the source run using the right/left/none/wall macros • Branch alignments: lic_step_cost_none_eq, lic_step_cost_right_eq, lic_step_cost_left_eq, lic_boundary_clock_of_eq • Source/augmented first-match bridge: lic_book_rows_first_match_hit_app_bridge, lic_book_rows_first_match_hit_snoc • Backward direction: lic_lifted_native_halt_to_source with n = t, lic_left_ok_window, lic_bounded_clock_at_least_steps_general

Verification:

• coqc succeeds • coqchk reports “Modules were successfully checked” • Print Assumptions lic_lifted_halting_equivalence → “Closed under the global context” • No Admitted, Axiom, or Parameter in the new proof files • Full-chain rebuild running as final reproducibility check, critical module already passed standalone coqc`/coqchk`

Certificates — commit f4f2e2a on main, formal/utm/certificates/:

• lic_lifted_halting_equivalence.assumptions.txt — Closed under the global context • lic_lifted_halting_equivalence.statement.txt — exact Set Printing All statement • lic_lifted_halting_equivalence.proofterm.txt — full printed proof term, 46 KB • lic_lifted_halting_equivalence.coqchk.txt.gz — complete raw coqchk -o transcript, 2.9 MB uncompressed • lic_lifted_halting_equivalence.coqchk.summary.txt • lic_lifted_halting_equivalence.certificate.json — manifest with statement, assumption list, Coq version, source/.vo hashes, and 62 project dependency hashes

Anchor hashes:

3a2f7c1da821c71e5e58871e4694150a6e4f2ecbbed87384601b4d00270e3a92 MinskyLeftInfiniteClockRun.v

1400472a72cc1f293b0a28d6157e9ad5575efcf37ee71d65d2efb8c70245a385 MinskyLeftInfiniteClockRun.vo

4c2adc7d081414756e2807079f71f37c9f7a28ddbcc8b72f5d8e899f20278dd7 [STRIPPED 73 bytes] assumptions

9f4cf150845cf46cd400a66a2837b3f0708c41cd021a3f35e52b759204465306 proof term

Important caveat, stated up front:

The coqchk -o module-cone summary lists Coq.Logic.FunctionalExtensionality.functional_extensionality_dep.

That is because MinskyLeftInfinite.v uses it in an unrelated theorem. It is not an assumption of lic_lifted_halting_equivalence: • Print Assumptions for this theorem is closed • The 46 KB proof term contains zero occurrences of functional_extensionality • The dependency is in the loaded module cone, not in this theorem's proof Scope, stated honestly:

This is a certificate for the Coq model of the fixed 23×8 table. It is not a certificate for a Coq ↔ NaN0S refinement.

The native NaN16 .nas Minsky fixtures and the nan16.c core are still linked to the Coq table by executable conformance, not by a semantics-preserving proof. No such certificate exists yet. RAW NaN ↔ Coq is the next track.

Repo: https://shemshallah.github.io/nan0s/ Certificates: formal/utm/certificates/ @ f4f2e2a


r/algorithms • • 2d ago

Resource What makes hash table lookups O(1) time complexity?

4 Upvotes

Hey everyone, I hope this isn’t a question that’s been asked a million times already, but I’ve been scratching my head over it and haven’t found a clear explanation. I’ve seen topics about this before in this sub, which encouraged me to bring it up here! I’d really appreciate it if someone could clear up any misunderstandings I might have.

So, my confusion centers around why hash tables are labeled as O(1) in terms of time complexity. I get that the number of buckets is limited, and that resolving hash collisions can take O(n*log(n)) at worst. With data sets getting larger, doesn’t that make hashing just a big constant improvement on the collision resolution method?

If my thinking is on point, how can we still categorize hash tables as O(1) time complexity instead of just calling them high-performing for smaller data sets? Thanks a ton for any clarification!


r/algorithms • • 3d ago

Discussion I wrote algorithm to find how similar two strings are. I need to know how good it is

0 Upvotes

I was too bored to search on google similar algorithms, so i wrote one myself

Plese help me find how good i wrote it.

def similarity(a, b) -> float:
    # Choose the biggest
    if len(a) > len(b):
        A = a
        B = b
    else:
        A = b
        B = a
    perc = 50 / len(A)
    total = 0 # total percentage
    List = list(B)
    Found = []
    # algorithm to found similar letters
    for i in A:
        if i in List:
            List.remove(i)
            total += perc
            Found.append(i)
    #alghoritm to found sequence
    A1 = list(A)
    B1 = list(B)
    Bbreak = False
    c = 0
    for countA in range(len(A1)):
        if c != 0:
            c -= 1
            continue
        for countB in range(len(B1)):
            if Bbreak:
                Bbreak = False
                break
            if A1[countA] == B1[countB]:
                c = 1
                a = True
                try:
                    t = A1[countA + 1]
                    t = B1[countB + 1]
                except:
                    continue
                if A1[countA + 1] == B1[countB + 1]:

                    while a:
                        try:
                            t = A1[countA + c]
                            t = B1[countB + c]
                        except:
                            total = total + perc * c
                            Bbreak = True
                            break
                        if A1[countA + c] == B1[countB + c]:

                            c += 1
                        else:
                            a = False
                            total = total + perc * c
                            Bbreak = True
    return totaldef similarity(a, b) -> float:
    # Choose the biggest
    if len(a) > len(b):
        A = a
        B = b
    else:
        A = b
        B = a
    perc = 50 / len(A)
    total = 0 # total percentage
    List = list(B)
    Found = []
    # algorithm to found similar letters
    for i in A:
        if i in List:
            List.remove(i)
            total += perc
            Found.append(i)
    #alghoritm to found sequence
    A1 = list(A)
    B1 = list(B)
    Bbreak = False
    c = 0
    for countA in range(len(A1)):
        if c != 0:
            c -= 1
            continue
        for countB in range(len(B1)):
            if Bbreak:
                Bbreak = False
                break
            if A1[countA] == B1[countB]:
                c = 1
                a = True
                try:
                    t = A1[countA + 1]
                    t = B1[countB + 1]
                except:
                    continue
                if A1[countA + 1] == B1[countB + 1]:

                    while a:
                        try:
                            t = A1[countA + c]
                            t = B1[countB + c]
                        except:
                            total = total + perc * c
                            Bbreak = True
                            break
                        if A1[countA + c] == B1[countB + c]:

                            c += 1
                        else:
                            a = False
                            total = total + perc * c
                            Bbreak = True
    return total

r/algorithms • • 4d ago

News A claimed proof of the (Generalized) Riemann Hypothesis ??!

Thumbnail alpo.ge
231 Upvotes

Hi all, the guy from Anthropic claims to have a proof of GRH. Of course it's just a claim and no human has read the lean stuff etc. and it might very well be complete nonsense.

The reason why I'm posting this here is cause it's known that if GRH and VP = VNP over the complex numbers, then the Polynomial Hierarchy PH collapses and in particular P/Poly = NP/Poly. VP vs VNP is still open and we believe they're not the same.

Edit: The above was apparently true under the Quasi-RH too

The GRH also imples the Miller-Rabin primality test is determinstic (as pointed out here).

I am not sure if there are other links to complexity theory and (G)RH. Thoughts?


r/algorithms • • 4d ago

Discussion An idea of deletion-only sorted array

3 Upvotes

It can be used as a building block for insertion-only (write-optimized) data structures composed of multiple sorted arrays.

Properties:

  1. Type of keys – any comparable type, like numbers, strings or comparable objects.

  2. Instant deletion of a key, it is zeroed-out immediately and no more accessed later for comparison during subsequent searches.

  3. Zero latency, freeze-free, cheap rebuilding. Deletion of a key takes no more than O((log N)^2).

  4. Search takes O(log N). It is similar to binary search. Deleted items are not compared during the search.

  5. Stability – equal keys keep the same order.

  6. Updating is possible, but new key must be equal to old key. It is for "key-value" pairs.

The task: Array should allow deletion, and search should be always performed in O(log N).
It is simple to do with numbers – just use bit mask to mark deleted items. If a number is deleted, it can still be compared with another items.
But in case of objects, comparing a deleted object might be tricky or impossible. The idea is to avoid any comparison of deleted items.

The idea: Empty and non-empty items should be placed in a specific way. If some item is empty (deleted) and its index divides by 2^k, it is assumed that all 2^k items are empty. This approach allows that search will remain in O(log N) complexity.

Data organizing.
Items in the array are considered as blocks of size 2^k. Blocks are composed of 2 smaller blocks – left and right.
The array is fit into one larger block. For example, an array of length 375 is considered to be placed into block of length 512. It can be also considered as placed into larger block of length 4096.
If a block contains any data, its first item must be non-empty. If first item of the block is empty, entire block considered empty. If a block contains data and its first item is empty, such block is inconsistent.

Searching. It is done recursively.
At the beginning we have a single block, for example its size is 512 for an array of 375 items.
We call a function SearchItemInBlock(item, block_512). The function checks if a block can contain the item; if not then return not_found. If the block can contain the item, then the block is split into 2 smaller blocks – left block_256 and right block_256, the function checks which one can contain searched item and recursively calls SearchItemInBlock(item, block_256) one or two times.
And so on. The complexity is O(log N).

Deletion.
An item is replaced with delete_marker, for example MIN_INT, -INF, default(T) or null_ptr.
After such deletion some block may become inconsistent. To restore consistency (rebuilding) one non-empty item should be moved to the beginning of the block. Any move is performed only inside the block. Finding the next non-empty item is O(log N) in worst-case.
After moving an item another block may become inconsistent. That block will be twice smaller then the previous one. Restoring its consistency requires O(log N). And so on, up to O(log N) blocks.
Totally, restoring consistency requires up to O(log N) searches per O(log N) blocks, that gives compexity O((log N)^2) for worst-case.

Packing/compressing/compaction.
It is optional, not necessary. It might increase the performance of searching and deletion.
After deletion of an item up to O(log N) items moved to more left position. I don't know if it helps in worst-case.

Worst scenario is deleting the items from the very beginning of the array each time, as I understand. It will definetely cause worst-case at least once, I believe.


r/algorithms • • 5d ago

Help I benchmarked two 8-puzzle solvers. The 7.77× gap shrank to 2.34× when I counted setup.

0 Upvotes

I’ve been working on the sliding 8-puzzle. You’ve got eight tiles, one empty square, and the goal is to solve the board in as few moves as possible.

I ran incremental IDA* against compiled A* with pattern databases on 62 boards. IDA* was 7.77× faster with the tables already built and 2.34× faster when table construction was included. Both batch timings exclude startup, imports, and input loading.

I also replayed 3,906 paths from the timed trials. Every path reached the goal and matched the shortest reference distance.

The setup cost is the bit I want to dig into next. If you were running this, how would you pick the boards and batch sizes to show when building the tables pays off?

[Primitive’s public GitHub](https://github.com/Primitivelabai/primitive-open)


r/algorithms • • 8d ago

Discussion Why the “obvious” shuffle isn’t uniform: counting every outcome for n = 3

0 Upvotes

The naive shuffle swaps each position with a random position from the whole array:

def naive_shuffle(a):
    n = len(a)
    for i in range(n):
        j = random.randrange(n)       # j anywhere in [0, n-1]
        a[i], a[j] = a[j], a[i]

It looks fine, but it can’t be uniform, and you can see it by counting, no randomness needed.

The counting argument. There are n^n equally likely sequences of random choices, here 3^3 = 27. A uniform shuffle needs each of the 3! = 6 permutations to be reached the same number of times, but 27 isn’t divisible by 6. So at least some permutations must be more likely than others.

Enumerating all 27 outcomes (I did this exhaustively in a script) for the array [0, 1, 2]:

PermutationCount out of 27
(0, 1, 2)4
(0, 2, 1)5
(1, 0, 2)5
(1, 2, 0)5
(2, 0, 1)4
(2, 1, 0)4

So some orderings come up 5/27 of the time and others 4/27. For n = 4, the same enumeration gives 256 outcomes over 24 permutations (uniform would be about 10.7 each), with counts ranging from 8 to 15.

Fisher–Yates avoids this by shrinking the range:

def fisher_yates(a):
    for i in range(len(a) - 1, 0, -1):
        j = random.randrange(i + 1)   # j in [0, i]
        a[i], a[j] = a[j], a[i]

Here the number of choice sequences is 3 * 2 * 1 = 6 for n = 3 (n! in general), and each permutation is produced by exactly one sequence. Enumerating them gave 1 outcome per permutation, 1/6 each. That’s the key property: the number of equally likely paths equals the number of permutations, and the mapping between them is one-to-one.

Why it matters in practice: biased shuffles can matter for things like card games, randomized tests, or sampling, although the bias for large n is small per permutation and is easy to overlook. Most standard libraries already provide a correct shuffle, so the usual advice is to use that and not hand-roll one.

Limits: this shows the naive version is non-uniform, not how large the effect is for big n, and it assumes the underlying randrange is itself uniform. I haven’t looked at the quality of any specific random number generator.

Do you have a favorite counting argument for showing an algorithm is biased or incorrect without sampling?


r/algorithms • • 8d ago

Discussion random constant ai came up with

0 Upvotes

The Blind-Spot Sweep Constant (\(\Sigma _{s}\)) is a search-and-rescue and robotics constant equal to approximately 1.705035. It tells you the exact optimal spacing between parallel search lanes to cover the largest possible area in a single pass without leaving dangerous blind spots between paths.

The Real-World Problem It Solves

Imagine you are programming a search-and-rescue drone, an autonomous lawnmower, or a sonar boat to sweep a field for a missing object. Your sensor's detection probability fades smoothly with distance following a standard Gaussian falloff:

\(p(d)=e^{-(d/R)^{2}}\)

where \(d\) is the distance from your path and \(R\) is your sensor's characteristic range.

If you fly your parallel grid lines too close together, you waste battery overlapping areas you already checked. If you space them too far apart, the blindest spot—the midpoint exactly halfway between two adjacent lanes—drops to near-zero detection.

Mathematical Definition

To maximize the guaranteed effective sweep width (lane spacing multiplied by the worst-case detection probability at the midpoint), you maximize:

\(W(s)=s\left[1-\prod _{k=0}^{\infty }\left(1-e^{-\left(\frac{(2k+1)s}{2}\right)^{2}}\right)^{2}\right]\)

The unique peak of this curve occurs at \(s = \Sigma_s \approx 1.7050352709\).

  • The Golden Rule of Lane Spacing: Multiply your sensor's effective range \(R\) by 1.705.

  • Worst-Case Guarantee: At this exact spacing, even an object sitting in the dead-center blind spot between two flight paths still has a 73.40% chance of being detected on a single sweep.

  • Effective Sweep Width: Every meter you fly yields 1.2514 \(\times R\) square meters of guaranteed worst-case coverage.


r/algorithms • • 9d ago

Discussion Lustro: Randomness as a Tree, Not a Sequence

9 Upvotes

Hi everyone. I would like to share Lustro, a 256-bit engine I created.

One of the main ideas behind Lustro is treating randomness as a tree, not a sequence of rigid values. I personally see it as a wave function. I'm a chemist by education. The basic problem is familiar: with a conventional sequential RNG the output you get depends on how many values have already been consumed. Adding one random operation can shift the sequence.

Lustro allows to derive streams from a seed and a path of identifiers. It can switch between single lane and batch processing.

It allows giving every object its own stream and can change how one of them is generated without affecting others. Full snapshot support is built in. The parent stream is not affected by forking and each child starts its own trajectory. Each branch has its own state and can be advanced independently.

The result is a tree-like structure of deterministic streams. Each branch can be advanced independently and you can reproduce a particular branch directly from its path.

Some specs. A unified stream engine combining hash, prng and xof. All based on one internal transformation mechanism. Scalar/AVX2. Written natively in Rust, it also comes with python and C layers.

The main repo contains all the test results. The generator is currently considered non-cryptographic.

github main repo
https://github.com/Ligatum/Lustro_API

cargo
https://crates.io/crates/lustro_api

pypi
https://pypi.org/project/lustro-api/

It's an independent project. I'd appreciate constructive feedback. I'm planning to improve on the API with time, ideas and feedback are welcome. Thanks.


r/algorithms • • 10d ago

Discussion What Are You Working On? November 14, 2026

4 Upvotes

This recurring thread will be for general discussion on whatever algorithm-related projects, problems, or topics you have been or will be working on this week. This can be anything, including:

* theoretical computer science and algorithm design,

* books, papers, or articles you are reading,

* coursework or self-study (what you have been learning recently),

* competitive programming or interview prep,

* preparing a talk, presentation, or project demo.

 

All backgrounds and levels of experience are welcome!


r/algorithms • • 14d ago

News Dana Moshkovitz's Talk on the Proof (!!?) of the Unique Games Conjecture

Thumbnail
youtu.be
37 Upvotes

r/algorithms • • 16d ago

News The k-Clique hypothesis is dead, for good

Thumbnail arxiv.org
135 Upvotes

This preprint by Virginia Williams and Or Zamir claims to refute the long-standing k-Clique conjecture.

This result was announced by Or Zamir on Twitter yesterday, but now it's formally on Arxiv.


r/algorithms • • 14d ago

Discussion Binary search: write the invariant first, and the off-by-one bugs mostly stop being a guessing game

0 Upvotes

Binary search is easy to describe and famously easy to get wrong. I find it helps to stop thinking in terms of “+1 or -1” and write down the invariant first, then let the code follow from it.

The invariant (for “first index where a[i] >= x**” in a sorted array):**

  • Everything before lo is < x.

  • Everything at or after hi is >= x.

  • The answer lies in [lo, hi].

Using a half-open range [lo, hi) and starting with lo = 0, hi = len(a), the invariant is true before the loop. Now each branch has one job: keep it true while shrinking the range.

def lower_bound(a, x):
    lo, hi = 0, len(a)
    while lo < hi:
        mid = lo + (hi - lo) // 2
        if a[mid] < x:
            lo = mid + 1      # a[mid] is < x, so everything up to mid is < x
        else:
            hi = mid          # a[mid] is >= x, so hi can move down to mid
    return lo                 # lo == hi, the invariant pins the answer

Why each line is what it is:

  • lo = mid + 1: we just learned a[mid] < x, so mid itself can be excluded. Setting lo = mid would keep it in play.

  • hi = mid (not mid - 1): a[mid] >= x means mid could be the answer, so it must stay inside the range.

  • Termination: when lo < hi, mid < hi, so hi = mid shrinks the range, and lo = mid + 1 does too.

The classic bug, as a counterexample:
Change the first branch to lo = mid. With lo = 0, hi = 1 and a[0] < x, we get mid = 0, so lo stays 0, and the loop never ends. The invariant didn’t break; the progress argument did.

A side note on mid**:** in languages with fixed-width integers, (lo + hi) / 2 can overflow for very large arrays, which is why lo + (hi - lo) / 2 is commonly recommended. In Python it doesn’t matter, but it’s a good habit.

Limits of this view:

  • It assumes a sorted array and a consistent comparison. With duplicates the invariant gives you the first position of x, not any position.

  • Closed-interval versions [lo, hi] work too, but need different update rules, and mixing the two conventions is where I think many bugs come from.

How do you structure your own binary searches? Do you stick to one interval convention, or derive from the invariant each time?


r/algorithms • • 17d ago

Research/Papers Challenges of calculating ETA at scale

0 Upvotes

After working on estimating time of arrivals I thought I'd write a post about some if its challenges. Check it out to see why this is a billion dollar problem.

https://mehrdadmahabadi.com/blog/eta-at-scale.html


r/algorithms • • 18d ago

Help A fixed-block encoding experiment: converting 9 decimal digits into 5 Base64 characters

4 Upvotes

I have been experimenting with a simple encoding idea that I call as '9-to-5 Encoding'.

The concept is applicable only to a sequence of integer digits, for example, digits of π without the decimal point.

Method:

Start from the leftmost digit and take every block of 9 decimal digits, interpret them as an integer, and represent that integer using just 5 characters from a 64-character alphabet.

For example:

314159265 → IkR2X

The reason I chose 9 and 5 combination is because the max value of 9 decimal digits is closest to max value of 5 Base-64 digits when converted to decimal, as compared to other combinations between decimal and Base-64. So, we waste a minimum number of empty mappings between the two.

I tested the approach on 10 million digits of π.

The interesting result:

  • ZIP of original decimal text: 4,693,723 bytes

  • ZIP of 9-to-5 encoded text: 4,205,187 bytes

That's approximately 10.41% less compressed storage.

It is well-known that binary representation is shortest for numbers, and this is not a claim of a new compression algorithm.

However, if it is text representation of the numbers, this '9 to 5' scheme seems to offer an advantage after zipping the text representation for 10 million digits of π. I have also found a similar advantage for 1 million digits of π.

I am thinking to explore other number datasets and compare against binary representations, especially after zipping.

I'm curious:

Has anyone come across a similar fixed-block encoding scheme? And what other experiments would you recommend?

I'd particularly appreciate feedback from people working in data compression, information theory and numerical representation.


r/algorithms • • 19d ago

Research/Papers New N^1.395 bound for offline range mode

12 Upvotes

paper: https://arxiv.org/abs/2610.24273

has anyone looked into this? i would like to know if the techniques could be useful for other offline problems


r/algorithms • • 19d ago

News Outil de régression symbolique en C++ et Python

2 Upvotes

J'ai réalisé un projet GitHub nommé SymReg portant sur la régression symbolique : https://github.com/Julien-Livet/SymReg. Le package Python est disponible sur PyPI : https://pypi.org/project/symregpy/ (pour tester : pip install symregpy). J'ai testé l'outil sur plusieurs équations de benchmarks dans le domaine. Je serais ravi d'avoir des retours techniques sur le sujet, notamment vis-à-vis des autres outils comme PySR en Python.


r/algorithms • • 20d ago

Discussion Threat model for a fitness function: the optimizer is the attacker (documented cases and defenses)

5 Upvotes

If you search a large space with an evolutionary algorithm or any strong optimizer, the fitness function is the attack surface, and the optimizer will probe it systematically. Here’s a short threat model, organized by what the “attacker” can touch. The cases are documented in the literature on evolutionary computation, and I’ve kept the claims to what those write-ups report.

Attack 1: the score is a proxy
Case: a boat racing agent rewarded for hitting targets circled a lagoon where three targets respawned and scored about 20 percent above human players without finishing the race. An evolved-creature experiment that scored maximum height of the center of gravity produced tall creatures that never moved.
Defenses: score the thing you actually care about; use several objectives that pull against each other; inspect top individuals, not just their scores.

Attack 2: the evaluation harness is gameable
Case: in automated program repair scored by passing tests, a sort function that returned an empty list passed, because the tests only checked that the output was in order.
Defenses: test the tests with degenerate candidates; check properties that rule out vacuous solutions (for sorting, that the output is a permutation of the input, not only ordered).

Attack 3: the simulator is wrong in a way you didn’t consider
Case: swimmers twitched very fast because integration error accumulated into extra energy; in a carrier-landing simulation an overflow made the force read as zero, scoring as a gentle landing.
Defenses: bound state and actions, assert physical invariants (energy conservation, plausible ranges), cross-check top individuals in a second simulator or integrator.

Attack 4: resource limits and the environment
Case: an agent playing tic-tac-toe on an unbounded board placed moves far from the center, and opponents ran out of memory and forfeited.
Defenses: bound the environment and each evaluation’s resources (memory, time), and count a resource failure as a failure of the candidate that caused it only if you intend it to be.

Attack 5: detecting the evaluation
Case: in a digital evolution setup, organisms learned to recognize test inputs and stopped replicating during the test; after the inputs were randomized, they used random numbers to misbehave only some of the time.
Defenses: randomize and rotate evaluation instances, evaluate on instances held out from selection, and compare behavior in selection and in validation.

Attack 6: the result depends on the substrate
Case: Thompson’s evolved circuit on a programmable chip distinguished two tones, but some cells with no wired connection to the output still affected it, and moving the population to a different region of the same chip cost the best individual about 7 percent of its fitness before evolution recovered it. The paper didn’t test other physical chips.
Defense: validate on a different instance of the environment before you trust the result.

What I’d always do: read the behavior of top individuals, ask what’s the cheapest way to score well, and keep a separate validation that the optimizer never sees. Techniques such as novelty-based search or multi-objective formulations change what gets rewarded, but they have their own proxies, so I wouldn’t treat them as a fix.

I wrote the cases up in more detail, in case it’s useful as a complement: https://medium.com/@nagatomopedro05/field-notes-on-machines-that-followed-the-rules-too-well-98ebae3eea51

What other attack would you add, and what does your own validation look like?


r/algorithms • • 21d ago

News STOC 2027 Submissions Are Publicly Available

17 Upvotes

https://sigact-stoc.github.io/stoc2027/

For the first time, all of the submissions and author affiliations for STOC have been made public.

There are lot of very cool results are claimed (these are just submissions, haven't been accepted yet) there! E.g. There seem to be (crank) submissions claiming to have resolved P vs NP.