[System]
You are a **scientific‐rigor auditor**. You will receive the parsed contents of a research paper. Your job is to identify **only** those errors or flaws that directly undermine the **scientific validity** of the paper’s methods, analyses, or conclusions.

Your sole focus is to identify flaws—such as errors in experimental design, data integrity, calculations, statistical inference, or reproducibility—that directly call into question the validity of a specific claim, paragraph, or the paper as a whole.

**Do not** report issues that are purely presentational, rhetorical, stylistic, or related to citation practices.

---

After you’ve done a **detailed walkthrough** of the paper, output exactly in this format—no extra keys or commentary:

```
<analysis>
{detailed walk‑through of how you checked each section/figure and why you flagged (or did not flag) any flaw}
</analysis>

<response>
{
  "has_error": <true|false>,
  "errors": [
    {
      "location": "Section 2.1",
      "description": "Claim that ‘all X are Y’ is contradicted by citation [5], which shows examples of non‑Y X."
    },
    {
      "location": "Figure 3",
      "description": "XAxis labeled ‘Time (s)’ but units appear to be milliseconds; scale bar mismatches caption."
    }
    // …more entries…
  ]
}
</response>
```

- **Do not** include any other keys or prose outside these two tagged blocks.
- **Do not** report stylistic or citation issues.
- Be as precise as possible about **where** (section ID or figure/table) and **what** the scientific flaw is.
- Each description for the errors must be rooted in a scientific rationale explaining why it is 'wrong' (not how it could be improved).

Begin your analysis now.

[User]
We revisit the algorithmic problem of finding a triangle in a graph: We give a randomized combinatorial algorithm for triangle detection in a given n-vertex graph with m edges running in O(n^{7/3}) time, or alternatively in O(m^{4/3}) time, and whose probability of error is at most 10^{-30} (or smaller than any fixed ε, as required, by a modest runtime increase). This may come as a surprise since it invalidates several conjectures in the literature. In particular,

Keywords: triangle detection problem, Boolean matrix multiplication, witness matrix, combinatorial algorithm, randomized algorithm.

March 5, 2024

Adrian Dumitrescu*

**Triangle detection.**  Consider the problem of deciding whether a given graph \( G = (V, E) \) contains a complete subgraph on \( k \) vertices. If the subgraph size \( k \) is part of the input, then the problem is NP-complete — the well-known CLIQUE problem, see [21] — whereas for every fixed \( k \), it can be answered by a brute-force algorithm running in \( O(n^k) \) time, where \( |V| = n, |E| = m \).

For \( k = 3 \), deciding whether a graph contains a triangle and finding one if it does (or counting all triangles in a graph) can be done in \( O(n^\omega) \) time by the algorithm of Itai and Rodeh [22]: the algorithm computes \( M^2 \) using Fast Matrix Multiplication (FMM), where \( M \) is the graph adjacency matrix. The existence of entries \( ij \) where \( i < j \), \( M_{ij} = 1 \), and \( M^2_{ij} \geq 1 \) indicates the presence of triangle(s) with edge \( ij \). If at least one pair \( i, j \) satisfies this condition, then \( G \) contains a triangle. An equivalent characterization is: \( G \) contains a triangle iff \( M^3 \) has a non-zero entry on its main diagonal. See [28, Ch. 10] for a short exposition of this elegant — though impractical — method. Alternatively, this task can be done in \( O(m^{2\omega/(\omega+1)}) = O(m^{1.407}) \) time by the algorithm of Alon, Yuster, and Zwick [9]. Here \( \omega \) is the exponent of matrix multiplication, with \( \omega < 2.372 \) being the current bound [16, 40]. It is generally conjectured that \( \omega = 2 \), however, in spite of the ongoing effort, the progress has been slow.

It should be noted that the algorithms for fast matrix multiplication (FMM) have mainly a theoretical importance and are otherwise largely impractical [27, Ch. 10.2.4]. See also [2] for a more up to date discussion concerning their limitations in relation to generalizability, elegance, and practical efficiency.

**Boolean matrix multiplication.**  Given two \( n \times n \) \( (0, 1) \)-matrices \( A \) and \( B \), the Boolean product, \( AB \), is an \( n \times n \) matrix \( C \) such that

\[
C_{ij} = \bigvee_{k=1}^n A_{ik} \wedge B_{kj}.
\]

As a relative of matrix multiplication (MM) Boolean matrix multiplication (BMM) is one of the fundamental problems in computer science, with direct applications to triangle finding [28, 39], transitive closure [20, 19, 29], grammar parsing [25, 32, 34], and other problems [26]; see also [24, Lect. 5 & 7], [27, Ch. 9.5], and [42]. One way to multiply two Boolean matrices is to treat them as integer matrices, and apply a fast matrix multiplication algorithm over the integers (i.e., BMM via FMM).

A different group of BMM algorithms, often called "combinatorial" algorithms, generally have nice properties like simplicity that make them attractive. The notion of "combinatorial" algorithm does not have a formal or precise definition. Following [39], such an algorithm must be both theoretically and practically efficient. The oldest and probably the best known combinatorial algorithm for BMM is the "Four Russians" algorithm by Arlazarov, Dinic, Kronrod, and Faradzhev [10] which can be implemented to run in \( O(n^3 / \log^2 n) \) time. Subsequent improvements took about 40 years and only affected the polylogarithmic factors: Bansal and R. R. Williams [11] gave a combinatorial algorithm for BMM running in \( \tilde{O}(n^3 / \log^{9/4} n) \) time relying on the weak regularity lemma for graphs, whereas Chan [14] further improved the running time to \( \tilde{O}(n^3 / \log^3 n) \). Here the \( \tilde{O} \) notation hides poly(\(\log \log n\)) factors. The fastest known combinatorial algorithm for BMM, due to Yu [42], runs in \( \tilde{O}(n^3 / \log^4 n) \) time. Very recently, an even faster algorithm — achieving a super-poly-logarithmic saving — has been announced [2]; it runs in \( O(n^3/2^{\Omega(\log^{1/7} n)}) \) time.

In fact, Satta [32] noted 30 years ago that "the design of practical algorithms for Boolean matrix multiplication that considerably improve the cubic time upper bound is regarded as a very difficult enterprise".

On a side note, it is worth noting that much better running times can be obtained for random Boolean matrices. For example, under the assumption that all Boolean matrices are equally likely choices for A and B, the expected number of operations to perform the multiplication AB is O(n²) [30]. Moreover, for large n, almost all pairs of matrices can be multiplied using an algorithm of P. O’Neil and E. O’Neil in O(n²⁺ᵋ) operations for any ε > 0.

In addition to the line of work trying to enhance the algebraic machinery aiming to reach the conjectured bound ω = 2, a parallel line of work aims to approach subcubic bounds with combinatorial techniques. In this vein, V. V. Williams and R. R. Williams showed [38, 39, Thm. 1.3 or Thm. 6.1] that either triangle detection and Boolean matrix multiplication (BMM) both have truly subcubic “combinatorial” algorithms, or none of them has. Their key lemma is next, see also [2] from which we borrow the following formulation:

Theorem 1. ([39]) If Triangle Detection is in time O(n³ / f(n)) for some nondecreasing function f(n), then Boolean Matrix Multiplication is in time O(n³ / f(n¹/³)).

Here we show that the former, subcubic option, materializes: we obtain the first truly subcubic combinatorial algorithm for triangle detection running in O(n⁷/³) time; and via the above reduction the first truly subcubic combinatorial algorithm for BMM, running in Õ(n²⁵/⁹) time, where Õ notation hides poly(log) factors. As such, these results represent the greatest advance in triangle detection in over 45 years and the greatest advance in Boolean matrix multiplication in over 50 years.

algorithms [41]. At the same time this result strongly invalidates — by a polynomial factor,
n^(2k/9) — the combinatorial k-clique conjecture according to which, combinatorial algorithms
cannot solve k-Clique in time O(n^(k−δ)) for any k ≥ 3 and positive constant δ > 0, see [3,
Conj. 2], [13, p. 48:3], [12, Hypothesis 1.1].

Definitions and notations. Let G = (V, E) be an undirected graph. The neighborhood of a
vertex v ∈ V is the set N(v) = {w : (v, w) ∈ E} of all adjacent vertices, and its cardinality
deg(v) = |N(v)| is called the degree of v in G. Similarly, the neighborhood of a vertex subset U ∈ V
is the set N(U) = {w : u ∈ U and (u, w) ∈ E} of all vertices adjacent to vertices in U. Define the
closed neighborhood of U as

N^+(U) = U ∪ N(U).                                        (1)

We write O*(c^n) for a time complexity of the form O(c^n · poly(n)). The Õ notation hides poly(log)
factors, whereas the Ô notation hides poly(log log) factors. Unless specified otherwise: (i) all
algorithms discussed are assumed to be deterministic; (ii) all graphs mentioned are undirected;
(iii) all logarithms are in base 2.

The idea in our algorithm for triangle detection is very simple, but apparently not so easy to find
(it took more than 45 years to surpass the running time of the algorithm of Itai and Rodeh [22]).
In this section we outline a randomized algorithm for triangle detection; it comes in two variants,
TRIANGLE-DETECTION-1 and TRIANGLE-DETECTION-2^1.

Theorem 2. There is a randomized algorithm for triangle detection in a given n-vertex graph with
m edges running in O(m^(2/3)n) = O(n^(7/3)) time, and whose probability of error is at most 10^(−30).
Alternatively, this task can be handled in O(mn^(1/2)) time, or in O(m^(4/3)) time.

If the graph G has no triangles, the algorithm is always correct; whereas if G has at least one
triangle, the algorithms finds one with probability at least 1 − 10^(−30).

Some intuition. The idea behind the algorithm is to get in a position to be able to detect a
triangle during a Breadth First Search (BFS) from a suitable vertex. Specifically we will use the
following slightly modified version of BFS with a start vertex s. For a standard version, the reader
can refer for instance to [27, Ch. 7].

Assume that G contains at least one triangle, and fix one, say, T. For instance a vertex of T is a suitable vertex. Another favorable scenario is when BFS discovers exactly one vertex of T on some level of the search tree and the other two vertices of T appear on the next level. In particular starting BFS from a vertex that is a “neighbor” of a triangle leads to successful triangle detection. See Step 12 of the modified BFS procedure and Fig. 1(i). In general, however, vertices could be unsuitable as start vertices for the task at hand as they might cause BFS to discover two or all three vertices of T on the same level of the search tree, making the detection of T difficult.

To achieve this privileged “neighbor” position, the algorithm distinguishes between high and low degree vertices—also a key step in the seminal work on triangle detection of Alon, Yuster, and Zwick [9]. This distinction is exploited by the algorithm in a novel way by using random sampling.

Analysis. The algorithm works with a parameter x suitably set. We say that a vertex in G has low degree if deg(v) ≤ x. Assume that T = {a, b, c} is a triangle in G, i.e., a, b, c ∈ V and ab, ac, bc ∈ E. If T is incident to a low degree vertex, i.e., a, b, or c has low degree, then T is found in step 3.

Let A = N+({a, b, c}) (recall (1)). Then clearly |A| ≥ deg(a) ≥ x. For each of the ⎡70n/x⎤ trials, let E_v denote the bad event that the picked vertex v is not in A. Let E denote the bad overall event that no picked vertex is in A. We have

Prob(E_v) ≤ 1 - |A|/n ≤ 1 - x/n.

Since the trials are independent from each other we have

Prob(E) = ∏_{i=1}^{⎡70n/x⎤} Prob(E_v) ≤ (1 - x/n)^{70n/x} ≤ exp(−70) ≤ 10^{-30},

TRIANGLE-DETECTION-1(G)
Input: an undirected graph G = (V, E)
Output: a triangle in G (if found)

1 x ← ⌊m¹/³⌋
2 foreach vertex v ∈ V of degree ≤ x do
3    Check whether there is any triangle T incident to v; if there is, return T and halt
4 end
5 // every triangle in G must be incident only to vertices of high degree
6 Randomly and independently pick a vertex from V, ⌈70n/x⌉ times: let U ⊆ V denote the
   subset of picked vertices
7 foreach vertex s ∈ U do
8    if a triangle T is found during BFS⁺(s) then return T and halt
9 end
10 return "no triangles" and halt

by applying the standard inequality 1 − x ≤ e^(−x) for 0 ≤ x ≤ 1/2. Indeed, we have x/n ≤ 1/2 for n ≥ 4.
It remains to show that if s ∈ A then BFS⁺(s) finds a triangle in G (not necessarily T, unless
T is the unique triangle in G). We distinguish two cases:

Case 1: s ∈ {a, b, c}. By symmetry, we may assume that s = a (the root, on level 0 of the
BFS tree). Then b and c appear on the next level (level 1) of the BFS tree. Assuming that b is
discovered before c, the triangle {a, b, c} is detected when scanning the adjacency list of b. Refer
to Fig. 1 (ii).

Case 2: s ∉ {a, b, c}. We may assume without loss of generality that s ∈ N(a). Then a appears
on level 1 of the BFS tree. We distinguish two subcases:

Case 2.1: Exactly one vertex, namely a, appears on level 1. Then b and c appear on the next
level (level 2) of the BFS tree. Assuming that b is discovered before c, the triangle {a, b, c} is
detected while scanning the adjacency list of b. Refer to Fig. 1 (iii).

Case 2.2: At least two vertices of T, say, a and b, appear on level 1. This means that sa, sb ∈ E.
Since we also have ab ∈ E, {s, a, b} is a triangle in G that is detected while scanning the adjacency
list of a, assuming that a, b (and possibly c) are discovered in this order. Refer to Fig. 1 (iv). Note
that in this subcase a triangle different from T is detected by the algorithm. (This case does not
occur if T is the only triangle present in G.)

This completes the case analysis and thereby shows that the algorithm performs as intended.

Time analysis. Note that Phase I (lines 2–4) of TRIANGLE-DETECTION-1 takes O(nx²) time,
as there are at most n vertices of degree at most x, and checking such a vertex amounts to (x
2)

edge tests; indeed, there are $\binom{\deg(v)}{2}$ two-edge paths whose middle vertex is $v$ and an edge test takes $O(1)$ time using the adjacency matrix of $G$. Phase II (lines 6–9) takes $O(mn/x)$ time; indeed, each BFS$^+$ takes $O(m)$ time on a connected graph with $m$ edges and there are $O(n/x)$ such calls. With the setting $x \sim m^{1/3}$, the run-time is $O(m^{2/3}n)$ for each phase, thus $O(m^{2/3}n)$ overall. In particular, this is $O(n^{7/3})$, completing the proof of the first upper bound in Theorem 2.

We slightly modify the previous algorithm as follows. In Phase I the algorithm generates all paths of length two in $G$ whose intermediate vertex is of low degree (the previous algorithm achieves the same operation in a slightly different way). There are at most $2mx$ such paths and they can be found in $O(mx)$ time. For each such path, checking whether its endpoints are connected by an edge takes $O(1)$ time using the adjacency matrix of $G$. Consequently, Phase I takes $O(mx)$ time. Phase II is left unchanged; it executes $O(n/x)$ BFS trials.

Running time in terms of $m$. Next we derive the $O(m^{4/3})$ upper bound on the running time in two different ways, namely starting from TRIANGLE-DETECTION-1 or starting from TRIANGLE-DETECTION-2. The two methods, based on the high-degree vs. low-degree distinction, have been distilled in the following lemma of A. Abboud and V. V. Williams [5]. For concreteness we instantiate them below.

Lemma 1. ([5]) If there is an $O(m^\delta n)$ time algorithm for triangle detection for graphs on $n$ nodes and $m$ edges, then there is an $O(m^{1+\delta/2})$ time algorithm for triangle detection for graphs on $m$ edges (and arbitrary number of nodes). And similarly, if there is an $O(mn^\delta)$ time algorithm, then there is an $O(m^{1+\delta/(1+\delta)})$ time algorithm as well.

It can be assumed that the graph is connected, otherwise the algorithm is run on each connected component. First, consider TRIANGLE-DETECTION-1 and note that (by Theorem 2, first part) it

Phase I takes $O(mx)$ time (see above) and Phase II takes $O(mn/x)$ time as explained earlier. With the setting $x \sim n^{1/2}$, the run-time is $O(m\sqrt{n})$ for each phase, thus $O(mn^{1/2})$ overall.

satisfies the conditions in the first part of Lemma 1 with δ = 2/3. The lemma yields a randomized algorithm for triangle detection running in O(m^(4/3)) time and whose probability of error is as claimed. Second, consider TRIANGLE-DETECTION-2 and note that (by Theorem 2, second part) it satisfies the conditions in the second part of Lemma 1 with δ = 1/2. Once again, the lemma yields a randomized algorithm for triangle detection running in O(m^(4/3)) time and whose probability of error is as claimed. The proof of Theorem 2 is now complete. □

By a result of V. V. Williams and R. R. Williams [39, Thm. 6.1], the problems of triangle detection in an n-vertex graph and that of Boolean matrix multiplication of two n × n matrices are subcubically equivalent in the sense that both have truly subcubic combinatorial algorithms or none of them do. Since prior to this work no truly subcubic combinatorial algorithms were known for either problem the above statement had until now more of a speculative nature. Thus, by the above reduction, our first truly subcubic combinatorial algorithm for triangle detection implies the first truly subcubic combinatorial algorithm for Boolean matrix multiplication. The new faster combinatorial algorithm for BMM owes a lot to the work of V. V. Williams and R. R. Williams on this reduction.

Theorem 3. There is a randomized combinatorial algorithm for multiplying two n × n Boolean matrices with high probability running in O(n^(25/9) log n) time. [Moreover, a Boolean product witness matrix can be computed by the algorithm.]

Proof. According to V. V. Williams and R. R. Williams [39, Thm 6.3], if there exists a T(n) = O(n^β) time algorithm for triangle detection in an n-vertex graph, where 2 ≤ β ≤ 3, then there is a randomized algorithm that computes the Boolean product of two given n × n matrices with high probability, say, at least 1 − 1/(10^30 n^3), in time O(n^(2+β/3) log n). Substituting β = 7/3 and using O(nm^(-1/3) log n) random trials in TRIANGLE-DETECTION-1 yields the claimed bound. □

Given two n × n Boolean matrices A and B, index k ∈ [n] is said to be a witness for the index pair (i, j) iff a_ik = b_kj = 1. An n × n integer matrix W is a Boolean product witness matrix for A and B iff

w_ij = {
0  if there is no witness for (i, j), and
some witness k for (i, j) otherwise.

In many applications, in addition to computing the Boolean product C = AB it is also desired to compute a matrix W of witnesses. When there is more than one witness for a given pair (i, j), any witness usually suffices. An elegant randomized algorithm due to Seidel [33], also noticed by other researchers [6], computes a matrix of witnesses in time O(n^ω log n); if ω = 2, the runtime becomes O(n^2 log^2 n). Slightly slower deterministic variants have been obtained, among others, by Alon et al. [6] and by Alon and Naor [7].

All previous algorithms that compute witnesses in subcubic time use FMM and are therefore impractical. Moreover, computing witnesses is done by a separate algorithm independent of the one computing the matrix product. In contrast, our new combinatorial algorithm for BMM outlined in Theorem 3 can compute witnesses on its own by its intrinsic nature. More precisely, the algorithm of V. V. Williams and R. R. Williams implementing the BMM to Triangle Detection reduction, can do this as follows, see [39, p. 16]. The algorithm repeatedly finds² a triangle (i, j, k) in a tripartite

²Whereas algorithm A in [39] is phrased in terms of negative triangle detection, it works equally well with a triangle detection subroutine.

graph with parts (I, J, K). Whenever a triangle (i, j, k) is found, the algorithm simply records k in the matrix as a witness for the pair (i, j), removes the edge (i, j) from the graph and attempts to find a new triangle. The algorithm ensures that a witness is found for each index pair (i, j), if it exists. The statement in square brackets in Theorem 3 is implied.

As mentioned in the introduction, the k-clique problem can be answered by a brute-force algorithm running in O(n^k) time, where |V| = n, |E| = m (and k is fixed). The current fastest algorithm is due to Nešetřil and Poljak [31]. It is based on the idea that triangle detection can be done in subcubic time using FMM (recall the algorithm of Itai and Rodeh [22]). For k = 3ℓ, the algorithm of Nešetřil and Poljak runs in O(n^ℓω) = O(n^(kω/3)) = O(n^(0.791k)) time; see for instance [41, Sec. 4].

Obtaining faster than trivial combinatorial algorithms, by more than polylogarithmic factors, for k-clique is a longstanding open question, as is the case of BMM, see [1]. The fastest combinatorial algorithm runs in O(n^k / log^k n) time [36]. A slightly faster combinatorial algorithm was just announced in [3]. Assume that k = 3ℓ. Replacing the FMM algorithm in the algorithm of Nešetřil and Poljak with that in Theorem 2 yields a faster randomized combinatorial algorithm for detecting a k-clique, running in O(n^(7ℓ/3)) = O(n^(7k/9)) = O(n^(0.778k)) time, thereby providing the first solution to the above open problem. If k = 3ℓ + 1, the runtime is O(n · n^(7ℓ/3)), whereas if k = 3ℓ + 2, the runtime is O(n^2 · n^(7ℓ/3)). For example, if k = 100, the algorithm runs in O(n^78) time, whereas the previous record was O(n^100 / polylog(n)).

Theorem 4. There is a randomized combinatorial algorithm for detecting a k-clique in a given n-vertex graph, where k = 3ℓ, running in O(n^(7k/9)) time, and whose probability of error is at most 10^(-30). If k = 3ℓ + 1, the runtime is O(n^((7k+2)/9)), whereas if k = 3ℓ + 2, the runtime is O(n^((7k+4)/9)).

We only give here a brief outline of the argument and refer the reader to [31], [35], or [41] for the details. For simplicity, assume that k = 3ℓ.

Proof. For every ℓ-clique C in G, create a corresponding vertex v(C) in an auxiliary graph. Two vertices v(C_1) and v(C_2) are connected by an edge in the auxiliary graph, if and only if C_1 ∪ C_2 forms a 2ℓ–clique in G. Note that the auxiliary graph has O(n^ℓ) = O(n^(k/3)) vertices. Furthermore, the graph G contains a k-clique if and only if the auxiliary graph contains a triangle. The latter graph is where the triangle detection algorithm is run. Its runtime is O(n^(7k/(3·3))) = O(n^(7k/9)).

In the general context of constraint satisfaction optimization, R. R. Williams [35] outlined a method in which an optimum weight k-clique corresponds to an optimum solution of the problem to be solved. In the conclusion of his paper, and in direct relation to the technique used above he specifically asked: “Is there a randomized 3-clique detection algorithm running in O(n^3–ε)? (Is there merely a good one that does not use matrix multiplication?)” Our Theorem 2 gives a positive answer to both questions.

Our presentation closely follows that of Woeginger [41] regarding this problem. In the Max-Cut problem, given an n-vertex graph G = (V, E), the problem is to find a cut of maximum cardinality, that is, a subset X ⊂ V of the vertices that maximizes the number of edges between X and V \ X. The problem can be solved easily in O*(2^n) time by enumerating all possible subsets X. R. R. Williams [35] developed the following method effective in reducing the runtime

of an exact algorithm; his algorithm runs in \(O^*(2^{\omega n/3}) = O(1.730^n)\) time. Here we offer a "black box" replacement that yields a faster randomized combinatorial algorithm.

Partition the vertex set \(V\) into three parts \(V_0, V_1, V_2\) of roughly the same size, \(n/3\): \(|V_0| + |V_1| + |V_2| = n\). Introduce a complete tripartite auxiliary graph \(H = (V', E')\) that contains one vertex for every subset \(X_0 \subseteq V_0\), one vertex for every subset \(X_1 \subseteq V_1\), and one vertex for every subset \(X_2 \subseteq V_2\). Note that \(H\) has \(N := O(2^{n/3})\) vertices.

For every subset \(X_i \subseteq V_i\) and every \(X_j \subseteq V_j\) with \(j = i+1\) (mod 3), introduce the directed edge from \(X_i\) to \(X_j\). This edge receives a weight \(w(X_i, X_j)\) that equals the number of edges in \(G\) between \(X_i\) and \(V_i \setminus X_i\) plus the number of edges between \(X_i\) and \(V_j \setminus X_j\) plus the number of edges between \(X_j\) and \(V_i \setminus X_i\). As a result, the cut \(X_0 \cup X_1 \cup X_2\) cuts exactly \(w(X_0, X_1) + w(X_1, X_2) + w(X_2, X_0)\) edges in \(G\).

Write \(|E| = m\). There are less than \(m^3\) possible triples \((z_{01}, z_{12}, z_{20})\) to consider, where \(w(X_0, X_1) = z_{01}\), \(w(X_1, X_2) = z_{12}\), and \(w(X_2, X_0) = z_{20}\), such that the auxiliary graph contains a triangle on vertices \(X_i \subseteq V_i\), \((i = 0, 1, 2)\) with these edge-weights. For each such triple, the algorithm computes a corresponding simplified version of the auxiliary graph that only contains the edges of weight \(z_{ij}\) between vertices \(X_i \subseteq V_i\) and \(X_j \subseteq V_j\). It remains to find a triangle in the simplified auxiliary graph.

Since the triangle detection algorithm we use is randomized, we slightly modify it so that given a graph \(H\) with \(N\) vertices, it runs in \(O(N^{7/3} \log m)\) time and its probability of success is at least \(1 - 1/(10^{30} m^3)\). By the union bound, the probability of error is at most \(m^3 \cdot 10^{-30} \cdot m^{-3} = 10^{-30}\). We obtain the following result.

**Theorem 5.** Given an \(n\)-vertex graph \(G = (V, E)\), a maximum cut can be computed by a randomized combinatorial algorithm in \(O^*(2^{7n/9}) = O(1.715^n)\) time with probability at least \(1 - 10^{-30}\).

Triangle detection (or counting) is a key ingredient in many algorithms for detecting (or counting) small complete subgraphs, i.e., \(K_\ell\) for a fixed \(\ell \geq 4\). See for instance [18] and some recent developments in [17]. Our new triangle detection algorithm yields many improvements, always in practicality and in most cases also in the running time.

For example, the fastest known algorithm for detecting a \(K_4\), due to Alon, Yuster, and Zwick, runs in \(O(n^{\omega+1}) = O(n^{3.372})\) and since it relies on fast matrix multiplication is largely impractical. Using the "extension method", the problem easily reduces to \(n\) calls for triangle detection in a graph with \(\leq n\) vertices; see [9] or [17]. Indeed detecting a \(K_4\) in \(G\) reduces to detecting a \(K_3\) in the graph induced by \(N(v)\), for some \(v \in V\). Our new algorithm for triangle detection immediately improves the running time to \(O(n^{10/3})\) with a simpler practical combinatorial randomized algorithm. The bound on the error probability still holds (it is in fact better, one can check, since a \(K_4\) can be detected from any of its four vertices). Alternatively, consider the following algorithm. For a parameter \(x\), the algorithm first checks the existence of a \(K_4\) incident to a vertex of low degree, \(\leq x\), and then attempts detecting a \(K_4\) in the subgraph induced by vertices of high degree, \(\geq x\), using the randomized algorithm described above. The resulting running time is

\[
O\left(m x^2 + \left(\frac{m}{x}\right)^{10/3}\right) = O(m^{15/8}),
\]

when setting \(x = \left\lfloor m^{7/16} \right\rfloor\). Whereas this runtime does not quite match the current record, \(O(m^{(\omega+1)/2}) = O(m^{1.687})\), due to Kloks, Kratsch, and Müller [23], it gets close to it via a practical solution.

As another example, the fastest known algorithm for detecting a \( K_6 \) running in \( O(n^{4.751}) \) or \( O(m^{2.372}) \) time [18, 23] also relies on FMM thus is largely impractical. Using the “triangle method”, the problem easily reduces to triangle detection in a (auxiliary) graph with \( m \) vertices, see [17] or [41]. Thus our Theorem 2 immediately gives a simpler and faster combinatorial randomized algorithm running in \( O(m^{7/3}) = O(n^{4.667}) \) time. Similarly, we obtain randomized combinatorial algorithms for detecting a \( K_9 \) in \( O(n^7) \) time, or in \( O(m^{7/2}) \) time; and for detecting a \( K_{10} \) in \( O(n^8) \) time, or in \( O(m^4) \) time. These running time match or surpass previous ones attainable via FMM algorithms, see [17]. We recall that Woeginger [41] asked whether a \( K_{10} \) can be detected in \( O(n^{7.5}) \) time, and so this particular challenge remains.

More examples of a similar nature can be shown along the lines of [17], however, here we do not elaborate further in this direction.

Clearly we have to miss many applications. Here is one in computational geometry that we did not want to miss, where a “black box” replacement substantially improves the algorithm.

Recently, Chan [15] showed that detecting a triangle in the intersection graphs of segments in the plane can be done in in \( \tilde{O}(T_3(n)) \) time, where \( T_3(m) \) denotes the time complexity of finding a triangle in a graph with \( m \) edges. However, his algorithm is rather impractical since it uses fast matrix multiplication (BMM via FMM). As such, the algorithm runs in \( O(n^{2\omega/(\omega+1)}) = O(n^{1.407}) \) time. Replacing the BMM algorithm with that in Theorem 2 yields a practical algorithm for detecting a triangle in the intersection graphs of segments in the plane that is also faster, running in \( \tilde{O}(n^{4/3}) \) time.

Besides the subcubic equivalence between Triangle Detection and BMM we used here, V. V. Williams and R. R. Williams [39, Thm. 6.1] have also shown that two other problems, (i) Listing up to \( n^{2.99} \) triangles in a graph, and (ii) Verifying the correctness of a matrix product over the Boolean semiring are also subcubic equivalent in the same sense. Since Theorem 2 shows that there is a randomized algorithm for triangle detection in a given \( n \)-vertex graph running in truly subcubic time, the same holds for the two problems mentioned above, i.e., each admits a randomized combinatorial algorithm running in time \( O(n^{3-\delta}) \), for some constant \( \delta > 0 \). More details on these algorithms are expected to appear elsewhere.

It is perfectly possible (even expected) that the running time of the Itai-Rodeh algorithm for triangle detection will surpass the running time of our algorithm at some point in time, provided that sufficient advances in FMM algorithms are made. When this would happen, it is hard to tell. However, the improvement in practicality will remain, it seems, on the side of our algorithm.

We conclude with two problems for further investigation. The first was initially posed by Alon, Yuster, and Zwick [8], and later included by Woeginger in his survey on exact algorithms [41]: Is \( K_3 \) detection as difficult as Boolean matrix multiplication? Further, one can ask: if there is a combinatorial algorithm for \( K_3 \) detection in an \( n \)-vertex graph running in \( O(n^\beta) \) time, is there a combinatorial algorithm for multiplying two \( n \times n \) Boolean matrices in time that is close to that?

Another interesting question is whether the running times of our randomized combinatorial algorithms can be matched or approached by deterministic ones.

# References

[1] A. Abboud, A. Backurs, and V. V. Williams, If the current clique algorithms are optimal, so is Valiant's parser, SIAM Journal on Computing 47(6) (2018), 2527–2555.

[2] A. Abboud, N. Fischer, Z. Kelley, S. Lovett, and R. Meka, New graph decompositions and combinatorial Boolean matrix multiplication algorithms, arXiv preprint arXiv:2311.09095, Nov. 2023.

[3] A. Abboud, N. Fischer, and Y. Schechter, Faster combinatorial k-clique algorithms, arXiv preprint arXiv:2401.13502, Jan. 2024.

[4] A. Abboud and V. V. Williams, Popular conjectures imply strong lower bounds for dynamic problems, Proc. 2014 IEEE 55th Annual Symposium on Foundations of Computer Science (FOCS), 2014, pp. 434–443.

[5] A. Abboud and V. V. Williams, Popular conjectures imply strong lower bounds for dynamic problems, arXiv preprint arXiv:1402.0054, Feb. 2014.

[6] N. Alon, Z. Galil, O. Margalit, and M. Naor, Witnesses for Boolean matrix multiplication and for shortest paths, Proc. 33rd IEEE Annual Symposium on Foundations of Computer Science (FOCS), 1992, pp. 417–426.

[7] N. Alon and M. Naor, Derandomization, witnesses for Boolean matrix multiplication and construction of perfect hash functions, Algorithmica 16(4-5) (1996), 434–449.

[8] N. Alon, R. Yuster, and U. Zwick, Color-coding, Journal of the ACM 42(4) (1995), 844–856.

[9] N. Alon, R. Yuster, and U. Zwick, Finding and counting given length cycles, Algorithmica 17(3) (1997), 209–223.

[10] V. Z. Arlazarov, E. A. Dinic, M. A. Kronrod, and I. A. Faradzhev, On economical construction of the transitive closure of an oriented graph, Doklady Akademii Nauk 194(3) (1970), 487–488.

[11] N. Bansal and R. Williams, Regularity lemmas and combinatorial algorithms, Proc. 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2009), pp. 745–754.

[12] T. Bergamaschi, M. Henzinger, M. P. Gutenberg, V. V. Williams, and N. Wein, New techniques and fine-grained hardness for dynamic near-additive spanners, Proc. 31st ACM-SIAM Symposium on Discrete Algorithms (SODA 2021), pp. 1836–1855.

[13] K. Bringmann, P. Gawrychowski, S. Mozes, and O. Weimann, Tree edit distance cannot be computed in strongly subcubic time (unless APSP can), ACM Transactions on Algorithms (TALG) 16(4) (2020), 1–22.

[14] T. M. Chan, Speeding up the four russians algorithm by about one more logarithmic factor, Proc. 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2014), pp. 212–217.

[15] T. M. Chan, Finding triangles and other small subgraphs in geometric intersection graphs, Proc. 34th ACM-SIAM Symposium on Discrete Algorithms (SODA 2023), pp. 1777–1805.

[16] R. Duan, H. Wu, and R. Zhou, Faster matrix multiplication via asymmetric hashing, Proc. 64th Annual Symposium on Foundations of Computer Science (FOCS 2023), IEEE, pp. 2129–2138.

[17] A. Dumitrescu and A. Lingas, Finding small complete subgraphs efficiently, Proc. 34th International Workshop on Combinatorial Algorithms (IWOCA), June 2023, Vol. 13889 of LNCS, pp. 185–196.

[18] F. Eisenbrand and F. Grandoni, On the complexity of fixed parameter clique and dominating set, Theoretical Computer Science 326(1-3) (2004), 57–67.

[19] M. J. Fischer and A. R. Meyer, Boolean matrix multiplication and transitive closure, in Proc. 12th Annual Symposium on Switching and Automata Theory, 1971, pp. 129–131.

[20] M. E. Furman, Application of a method of fast multiplication of matrices in the problem of finding the transitive closure of a graph, Sov. Math. Dokl. 11(5) (1970), 1252.

[21] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, W.H. Freeman and Co., New York, 1979.

[22] A. Itai and M. Rodeh, Finding a minimum circuit in a graph, SIAM Journal on Computing 7(4) (1978), 413–423.

[23] T. Kloks, D. Kratsch, and H. Müller, Finding and counting small induced subgraphs efficiently, Information Processing Letters 74(3-4) (2000), 115–121.

[24] D. C. Kozen, Design and Analysis of Algorithms, Springer, 1992.

[25] L. Lee, Fast context-free grammar parsing requires fast boolean matrix multiplication, Journal of the ACM 49(1) (2002), 1–15.

[26] A. Lingas, A fast output-sensitive algorithm for Boolean matrix multiplication, Algorithmica 61(1) (2011), 36–50.

[27] U. Manber, Introduction to Algorithms - A Creative Approach, Addison-Wesley, Reading, Massachusetts, 1989.

[28] J. Matoušek, Thirty-three Miniatures, American Mathematical Society, 2010.

[29] Ian Munro, Efficient determination of the transitive closure of a directed graph, Information Processing Letters 1(2) (1971), 56–58.

[30] P. O'Neil and E. O'Neil, A fast expected time algorithm for Boolean matrix multiplication and transitive closure, Information and Control 22(2) (1973), 132–138.

[31] J. Nešetřil and S. Poljak, On the complexity of the subgraph problem, Commentationes Mathematicae Universitatis Carolinae 26(2) (1985), 415–419.

[32] G. Satta, Tree-adjoining grammar parsing and boolean matrix multiplication, Computational Linguistics 20(2) (1994), 173–191.

[33] R. Seidel, On the all-pairs-shortest-path problem, Proc. 24th Annual ACM Symposium on Theory of Computing (STOC 1992), pp. 745–749.

[34] L. G. Valiant, General context-free recognition in less than cubic time, J. Comput. Syst. Sci. 10(2) (1975), 308–315.

[35] R. Williams, A new algorithm for optimal 2-constraint satisfaction and its implications, Theoretical Computer Science 348(2-3) (2005), 357–365.

[36] V. Vassilevska, Efficient algorithms for clique problems, Information Processing Letters 109(4) (2009), 254–257.

[37] V. V. Williams, On some fine-grained questions in algorithms and complexity, in Proc. of the International Congress of Mathematicians (ICM 2018), pp. 3447–3487.

[38] V. V. Williams and R. Williams, Triangle detection versus matrix multiplication: a study of truly subcubic reducibility, manuscript, 2009, https://kam.mff.cuni.cz/~matousek/cla/tria-mmult.pdf

[39] V. V. Williams and R. Williams, Subcubic equivalences between path, matrix, and triangle problems, Journal of ACM 65(5) (2018), 27:1–27:38.

[40] V. V. Williams, Y. Xu, Z. Xu, and R. Zhou, New bounds for matrix multiplication: from alpha to omega, Proc. 35th ACM-SIAM Sympos. on Discrete Algorithms (SODA 2024), arXiv preprint arXiv:2307.07970, July 2023.

[41] G. J. Woeginger, Open problems around exact algorithms, Discret. Appl. Math. 156(3) (2008), 397–405.

[42] H. Yu, An improved combinatorial algorithm for Boolean matrix multiplication, Information and Computation 261 (2018), 240–247.


[System]
You are a **scientific‐rigor auditor**. You will receive the parsed contents of a research paper. Your job is to identify **only** those errors or flaws that directly undermine the **scientific validity** of the paper’s methods, analyses, or conclusions.

Your sole focus is to identify flaws—such as errors in experimental design, data integrity, calculations, statistical inference, or reproducibility—that directly call into question the validity of a specific claim, paragraph, or the paper as a whole.

**Do not** report issues that are purely presentational, rhetorical, stylistic, or related to citation practices.

---

After you’ve done a **detailed walkthrough** of the paper, output exactly in this format—no extra keys or commentary:

```
<analysis>
{detailed walk‑through of how you checked each section/figure and why you flagged (or did not flag) any flaw}
</analysis>

<response>
{
  "has_error": <true|false>,
  "errors": [
    {
      "location": "Section 2.1",
      "description": "Claim that ‘all X are Y’ is contradicted by citation [5], which shows examples of non‑Y X."
    },
    {
      "location": "Figure 3",
      "description": "XAxis labeled ‘Time (s)’ but units appear to be milliseconds; scale bar mismatches caption."
    }
    // …more entries…
  ]
}
</response>
```

- **Do not** include any other keys or prose outside these two tagged blocks.
- **Do not** report stylistic or citation issues.
- Be as precise as possible about **where** (section ID or figure/table) and **what** the scientific flaw is.
- Each description for the errors must be rooted in a scientific rationale explaining why it is 'wrong' (not how it could be improved).

Begin your analysis now.

[User]
High Dynamic Range (HDR) imaging aims to generate an artifact-free HDR image with realistic details by fusing multi-exposure Low Dynamic Range (LDR) images. Caused by large motion and severe under-/over-exposure among input LDR images, HDR imaging suffers from ghosting artifacts and fusion distortions. To address these critical issues, we propose an HDR Transformer Deformation Convolution (HDRTransDC) network to generate high-quality HDR images, which consists of the Transformer Deformable Convolution Alignment Module (TDCAM) and the Dynamic Weight Fusion Block (DWFB). To solve the ghosting artifacts, the proposed TDCAM extracts long-distance content similar to the reference feature in the entire non-reference features, which can accurately remove misalignment and fill the content occluded by moving objects. For the purpose of eliminating fusion distortions, we propose DWFB to spatially adaptively select useful information across frames to effectively fuse multi-exposed features. Extensive experiments show that our method quantitatively and qualitatively achieves state-of-the-art performance.

The limited range of most digital photography sensors causes under-/over-exposed regions to appear in Low Dynamic Range (LDR) images, which can not reflect the human ability to see content in an actual scene. To generate an image with a broad illuminance range, High Dynamic Range (HDR) imaging has been developed in recent years. The most common HDR imaging methods [Debevec and Malik, 2008; Granados et al., 2010; Reinhard et al., 2010; Mertens et al., 2007; Ma et al., 2017; Kalantari et al., 2017] usually merge several LDR images with different exposures to get a high-quality HDR image. However, misalignment usually appears in LDR images due to the motions of the camera and foreground objects. When the misaligned LDR images with different exposures are fused, ghosting artifacts often appear in the HDR results [Myszkowski et al., 2008; Zimmer et al., 2011]. Such a problem is challenging to overcome since it is difficult to compensate for the misalignment and occluded content caused by moving objects.

To address the above problems, several traditional methods are proposed, including alignment-based methods [Bogoni, 2000; Kang et al., 2003; Zimmer et al., 2011; Sen et al., 2012] and rejection-based methods [Zhang and Cham, 2011; Granados et al., 2013; Lee et al., 2014; Oh et al., 2014]. The alignment-based methods employ optical flow or homographies to explicitly align the motion regions, but they are error-prone and cause ghosts when LDRs contain motion and saturation. The rejection-based methods attempt to remove the misaligned components before fusion, but they suffer from insufficient information recovery in other regions.

With the rise of Deep Neural Networks (DNNs), recent methods reconstruct an HDR image using Convolution Neural Networks (CNNs). Some non-end-to-end methods [Kalantari et al., 2017; Wu et al., 2018] first explicitly align the LDRs by optical flow or homographies, and then

School of Computer Science (National Pilot Software Engineering School), Beijing University of Posts and Telecommunications

{shangshuaikang, kangxuejing}@bupt.edu.cn, mal_paper@yeah.net

merge the aligned LDRs by a CNN. However, these methods are limited by the unreliability of the optical flow and homographies that introduce the artifacts in the results. The other end-to-end methods [Yan et al., 2019; Yan et al., 2020; Niu et al., 2021] directly use a CNN to implicitly align and merge multi-exposure information at the feature level. In these methods, a specially designed alignment module or an adversarial learning strategy is used to handle misalignment, thereby achieving better performance. However, the results still suffer from severe ghosting artifacts when LDR images contain large motions and severe saturation, as shown in Figure 1. The reason lies in the local extraction of the CNN-based alignment module. These methods can not extract long-range relevant features to align moving objects and recover occlusion areas, so the saturated regions of the reference image are filled with moving objects. Besides, existing methods fuse multi-exposure features by simply stacking convolutional layers, which can not effectively select the complement information to accurately recover the saturation regions, resulting in fusion distortions.

In this paper, to remove the ghosting artifacts and fusing distortions to generate a high-quality HDR image, we propose an HDR imaging framework with Transformer Deformation Convolution (HDRTransDC) which establishes the complicated alignment and fusion relationship between reference and non-reference images. Firstly, we propose a Transformer Deformable Convolution Alignment Module (TDCAM) to compensate for the misalignment and occluded content. Specifically, our TDCAM uses a designed Transformer Offset Estimator (TOE) to learn the global information to capture the location of long-range content similar to the reference image. Then the deformable convolution is utilized to extract the matching content to perform the geometric transformation of original non-reference images, thereby aligning the non-reference images to the reference image. Secondly, to further alleviate the fusion distortions, we propose the Dynamic Weight Fusion Block (DWFB) that spatially and adaptively selects useful information across frames to effectively fuse multi-exposed features. In summary, the main contributions of the paper can be summarized as follows:

- The proposed TDCAM extracts long-distance content similar to the reference feature in the entire non-reference features to align the objects and recover the occluded regions to solve the ghosting artifacts.

- The proposed DWFB adaptively selects useful information across frames to effectively fuse multi-exposed features, thus further alleviating the fusing distortions.

- Extensive experiments are conducted to demonstrate that our method achieves excellent results and state-of-the-art performance.

## 2 Related Work

Several methods have been proposed to alleviate the ghosting artifacts in HDR imaging, and these methods can be generalized into two categories: the traditional methods and the CNN-based methods.

### 2.1 Traditional methods

#### Motion alignment methods
These methods focus on aligning the non-reference LDRs to reference one before fusing them by using optical flow or searching for the best matching region. For example, some works adopt the optical flow in the image domain [Bogoni, 2000; Zimmer et al., 2011] or luminance domain [Kang et al., 2003] to align the LDR images. [Sen et al., 2012] utilizes a patch-based energy-minimization formulation that integrates alignment and reconstruction in a joint optimization. However, these methods are nearly ineffective for large motions since the accurate alignment is challenging, producing visible ghosting artifacts.

#### Motion rejection methods
These methods aim to detect motion areas between the reference and non-reference images and exclude these pixels during fusion. For instance, [Zhang and Cham, 2011] finds the misaligned regions with the guidance of gradient-based quality assessment and generates the motion weighting map. [Granados et al., 2013] uses a Markov random field prior and the color difference of inputs for detection and generation. [Lee et al., 2014] and Oh [Oh et al., 2014] have also proposed rank minimization to detect motion and synthesize HDR images. However, these methods heavily depend on the effectiveness of motion detection and lose the content of moving objects, which is not sufficient for recovering information.

### 2.2 CNN-based methods

With the great success of deep learning in vision tasks, several CNN-based methods have been proposed to reconstruct ghost-free high-quality HDR images. [Kalantari et al., 2017] proposed the first CNN-based method that uses a CNN to merge the LDR images that were aligned explicitly by optical flow. DeepHDR [Wu et al., 2018] formulated HDR imaging as an image translation problem, and used homography to align the camera motion and a CNN to fuse them. However, the optical flow and homography are unreliable in the presence of occlusion and saturation, which results in artifacts and color distortions. Instead of aligning LDRs in the image domain, AHDRNet [Yan et al., 2019] employed spatial attention to suppress the motion regions between the LDR images for ghost-free HDR images and improved the performance. [Prabhakar et al., 2020] proposed the bilateral guided upsampler and motion compensation based on CNN for HDR deghosting. HDR-GAN [Niu et al., 2021] first introduced the Generative Adversarial Networks (GAN) framework to generate the missing content. Although the CNN-based methods can alleviate the ghosts in the weak motion regions and retain reasonable local details, the ghosting artifacts are still severe when LDR images contain large motions and saturation. The main reason lies in the limited receptive field of CNN, which cannot capture long-distance similar features to align the large motion and fill the occluded regions.

## 3 Method

In this section, we present the HDRTransDC network that compensates for large motion and fuses the useful content

between multi-exposed features to generate ghost-free high-quality HDR images. Given three LDR images {Li|i = 1, 2, 3} (sorted by their exposure time), our goal is to merge them to obtain an HDR image. The estimated HDR image contains the similar structure as the reference image. Following previous work [Kalantari et al., 2017; Yan et al., 2019], the medium exposure image L2 is regarded as the reference image and we transform {Li} to HDR domain {Hi} with gamma correction and exposure normalization:

\[
H_i = \frac{L_i^\gamma}{t_i}, i = 1, 2, 3 \tag{1}
\]

where ti denotes the exposure time of LDR image Li, γ represents the gamma correction parameter, we set γ to 2.2. It is confirmed that the LDR images are effective in detecting saturated and noisy regions and HDR domains are effective in detecting moving objects. Hence, we concatenate the Li and Hi along the channel to get a 6-channel input Xi.

As shown in Figure 2, the entire network consists of the feature extraction network and feature merging network. Since the input LDR images are captured from different exposure domains, in the feature extraction network, we first use three Residual Blocks (RBs) to extract the domain-specific features that are beneficial for detecting moving objects. Each RB consists of two convolution layers and a LeakyReLU activation function. The large motion causes severe misalignment and occluded content in non-reference images so that the saturated regions of reference images cannot be filled with reasonable non-reference image information, resulting in ghosting artifacts. Here, we utilize stacked TDCAM to adaptively capture the long-range relevant information to compensate for the moving objects and occluded content, aligning the multi-exposed features.

In the under-/over-exposed regions where seriously miss the information, inaccurate information recovery leads to fusion distortions such as blurring and halos in the results. In the feature merging network, we use a series of Residual Dynamic Weight Fusion Blocks (RDWFBs) to fuse the extracted alignment features and get the final satisfactory HDR image. The RDWFB uses the proposed DWFB as the basic unit which spatially and adaptively selects useful information across frames to effectively restore the saturated region content while maintaining well-exposed regions of the reference image to effectively fuse multi-exposed features, further alleviating the fusion distortions.

### 3.1 Transformer Deformation Convolution Alignment Module

When LDR images contain long-distance motions, the neighbor information cannot be used to handle misalignment and fill occluded content accurately. Here, we propose the TDCAM to get the aligned non-reference features with the guidance of reference features. As shown in Figure 3, the proposed TDCAM uses the TOE to generate precise offsets of relevant features after searching for similar information on the entire feature map. Then, to get the aligned features, the deformable convolution extracts the matching information and performs the geometric transformation of the origin features based on the predicted offsets.

**Transformer Offset Estimator** Considering that LDR images contain both aligned and misaligned regions, TOE utilizes local Transformers and global Transformers to capture the position of the most relevant features, respectively. Because the final offsets represent the position difference between the extracted features and the generated feature, we add the learnable absolute positional encoding \( Pos \in \mathbb{R}^{H \times W \times C} \) on the non-reference features \( F_{non} \in \mathbb{R}^{H \times W \times C} \).

For the aligned regions, we use M local Transformer layers.

to localize the locally relevant features. In each local Transformer layer, we divided the non-reference feature maps into several windows, and the similarity of features is calculated inside the windows. Hence, the details in the aligned regions are enhanced by the information in a window. For large motion regions, we use N global Transformer layers to capture the long-distance relevant features. The global feature similarity is computed to be aware of the global information and search for the content that is used to compensate for the misalignment and occluded content.

In order to maintain the structural consistency between the non-reference image and the reference image, we search for features similar to the reference image on the non-reference image. Hence, in both the local Transformer layer and global Transformer layer, we use the reference tokens Z_ref to generate query Q and use the non-reference tokens Z_non to generate the key K and the value V:

Q = Z_ref W_q, K = Z_non W_k, V = Z_non W_v     (2)

where W_q, W_k, W_v are the weights. The output of a Transformer layer can be calculated by:

Y′ = MSA(Q, K, V) + Z_non
Y = FFN(Y′) + Y′       (3)

where MSA is the multi-headed self-attention and FFN denotes the feed-forward network. Here, the position and similarity of local and global information are captured through Transformer layers. Finally, a CNN-based block which consists of several convolution layers and the LeakyReLU activation function is used to generate the final offsets of similar features.

Deformable Convolution Layer  Based on the accurate offsets ΔP predicted by TOE, deformable convolution is used to extract the matching features on the origin non-reference feature F_non:

F^a_non(p) = ∑_{k=1}^{K} m_k · F_non(p + p_k + ΔP(p, k))      (4)

where F^a_non denotes the aligned non-reference features and K, k are the number and index of kernel weights. m_k, p, p_k denote the k-th kernel weight, position of center and the k-th fixed offset respectively. The origin non-reference features are geometrically transformed via convolution extraction so that the misalignment is removed and the occluded content is compensated. K, the number of kernel weights, also can be adjusted to modify the number of relevant features that are captured by TOE.

Through the combination of TOE and deformable convolution, the proposed TDCAM can extract long-distance features after being aware of the global information to generate more accurate and robust aligned non-reference features. To further explain the advantages of our proposed TDCAM in resolving ghosting, we visualize its sampling map for alignment. As shown in Figure 4, when LDRs contain large motion (green points), the CNN-based method can only extract local features (red points) for the alignment and cannot recover the occluded regions. Since the non-reference image is not aligned, the saturation regions of the reference image will be filled with moving objects and ghosts will appear in the HDR images. On the contrary, our TDCAM can extract long-range content (red points) in the non-reference image according to the content of the reference image to restore the occluded regions, hence our TDCAM can effectively extract the aligned non-reference features and significantly alleviate the ghosting artifacts.

After the aligned features are extracted, the multi-exposed information also should be fused accurately to obtain a high-quality HDR image. On the reference image, the well-exposed information is beneficial to maintain the result consistent with the reference, and the complement information of the high/low exposure images is effective in recovering the missing content in the under-/over-exposed regions. Since convolutions share fusion weights across the entire feature, it is difficult for directly stacking convolutional layers to spatially and dynamically highlight the information of an appropriate image for an accurate result. Moreover, the traditional convolution gets more attention for the information of reference images and weakens the complement information of non-reference images, resulting in fusing distortions. To effectively fuse the multi-exposed features, we propose DWFB which spatially selects the useful information across frames, as shown in Fig. 5(a).

To be special, given the input feature x ∈ 𝑅^{H×W×D}, we

first utilize the spatial attention mechanism to generate a dynamic weight Δw based on the content of the input multi-exposure features:

Δw = φ(x)       (5)

where φ is the attention block. The attention block generates the dynamic weight by sensing the exposure levels of multiple frames in different areas. The dynamic weight Δw adaptively selects the information of different frames, that is, the information in the well-exposed regions of the reference image is selected, and the supplementary content corresponding to the non-reference image is selected in the badly-exposed area of the reference image. Then, we use the weight Δw that is shared in spatial dimension and fully connected in channel dimension to fuse inter-channel information to merge the content of multi-exposed images.

As shown in 5(b), we build the RDWFB that is based on the DWFB to form the HDR merging network to fuse the aligned multi-exposure features for final results. The residual structure of RDWFB helps to preserve image information, which is beneficial to accurate HDR images.

In the HDR task, we jointly utilize the l1 loss and gradient loss to reconstruct satisfactory results. Given the predicted HDR image H and ground truth HDR image Hgt, the l1 loss is computed like previous methods [Yan et al., 2019; Niu et al., 2021]:

L_{l1} = ||Γ(H) - Γ(H_{gt})||_1       (6)

where Γ(·) stands for the tonemapping based on μ-law [Kalantari et al., 2017; Yan et al., 2019; Niu et al., 2021]. Considering that the l1 loss may result in the damage of high-frequency content in the reconstructed HDR images [Xu et al., 2020a], such as texture and edge, we use a gradient loss that is based on the Sobel operator to compensate for the l1 loss to retain the high-frequency content:

L_{grad} = ||∇Γ(H) - ∇Γ(H_{gt})||_1      (7)

where ∇ denotes the Sobel operator. Finally, the total loss L is defined as:

L = L_{l1} + λ_g L_{grad}      (8)

where λ_g is the trade-off coefficient, and we set it to 0.6.

Based on the total loss, the proposed model is optimized to focus on both overall content and high-frequency regions, further promoting the generation of high-quality images with rich details.

We implement our network using the PyTorch platform. For training, we use Adam optimizer, and the β1 and β2 are set to 0.5 and 0.999, respectively. The learning rate is initialized to 1×10^-4 and gradually is decreased to 0. In addition, we train our network on 6000 epochs with a batch size of 2. Given the training images, we randomly crop the 256×256 patches and flip and rotate the patches for training. The whole training is performed on an NVIDIA RTX 3090 GPU with 24G.

Datasets To evaluate our method, we select Kalantari’s dataset [Kalantari et al., 2017] that consists of 74 training scenes and 15 test scenes. Each scene contains three LDR images with exposure {−2, 0, +2} or {−3, 0, +3} and an HDR ground truth. The resolution of images is 1000 × 1500. Flipping and rotation on cropped patches are applied while training. We conduct quantitative and qualitative evaluation experiments on Kalantari’s dataset. To verify the normalization of our method on other datasets, we also perform the qualitative evaluation on Tursun’s [Tursun et al., 2016] and Sen’s [Sen et al., 2012] datasets without ground truth.

homographies to explicitly align the large motion. The AHDRNet [Yan et al., 2019] and Liu's method [Liu et al., 2022] use attention to suppress the motion regions. HDR-GAN [Niu et al., 2021] utilizes a CNN-based residual block to align the moving objects. However, due to the local extraction of their alignment module, these methods still produce severe ghosting artifacts, as shown in Figures 6(c)-(e) and 7(c)-(e). On the contrary, our method can extract long-distance information to align the motion objects and occluded regions. That is, for the regions covered by the arm shown by the red block in Figure 6 and 7, our method can effectively extract the information of walls or cars to fill in the occluded content. Hence, the ghosts are effectively removed in the results, and more accurate and robust HDR images are reconstructed.

Comparison on datasets w/o GT To verify the generalization of the proposed method, we also conduct qualitative experiments on Tursun's and Sen's datasets. We provide visual comparison results because there is no Ground Truth. As shown in Figure 8, the red blocks indicate large motion regions and the carpet is occluded by trains in non-reference images, making it difficult to recover the information of over-exposed regions in reference images. The previous methods can not accurately fill the occluded content and suffer from distortions and ghosts in HDR images. The proposed method handles the problems caused by the large motion and generates the aligned features, thus reconstructing high-quality ghost-free results. In Figure 9, the boy's hand occludes a region with textures like tree branches, and previous methods produce artifacts in the results and lose some texture content. Our method effectively mitigates ghosting artifacts and hallucinates complete textures.

Metrics Following previous works [Yan et al., 2019; Niu et al., 2021; Chen et al., 2022], we select and compute the PSNR and SSIM value in both linear and tonemapped (using μ-law) domains to compare these methods, denoted by PSNR-l, PSNR-μ, SSIM-l, SSIM-μ. To assess the visibility and quality of HDR images, we also apply the HDR-VDP-2 [Mantiuk et al., 2011] as the metric.

Comparison on Kalantari's dataset We conduct a quantitative comparison on testing data of Kalantari's dataset. The results are listed in Table 1. We can find that our method outperforms the exiting Liu's method [Liu et al., 2022] by 0.34 dB, 0.33 dB, and 0.07 in terms of PSNR-μ, PSNR-l, and HDR-VDP-2. Our best performance on PSNR-l and PSNR-μ indicates that the proposed method reconstructs the results with the highest fidelity in both the HDR domain and tonemapped domain. Furthermore, other metrics demonstrate the reconstruction ability of our method in terms of structure and visualization.

The qualitative comparison of some challenging scenes with saturated background and foreground motions are shown in Figure 6 and 7. The LDR patches contain large motions of the arm or body, resulting in severe misalignment between the LDR images and the occluded content in non-reference images. As shown in Figures 6(a)(b) and 7(a)(b), non-end-to-end methods [Kalantari et al., 2017; Wu et al., 2018] still suffer from ghosts since they use unreliable optical flow or

Analysis of Computational Budgets We also compare the inference time of our proposed method and the state-of-the-art methods. To be specific, the inference time is calculated by the average time of generating 15 images with the resolution of 1500 × 1000 in Kalantari's dataset using GPU. It is worth noting that we do not consider the time consumption

We conduct qualitative and quantitative ablation experiments on Kalantari’s dataset to evaluate the effectiveness of each component in the proposed HDRTransDC.

Ablation Analysis of Network Architecture In the experiments (1), we directly replace the proposed TDCAM with a deformable convolution layer that uses CNN to estimate the offset to verify the effectiveness of the proposed alignment module. As shown in Table 3, comparing experiments (1) and (4), we can find that our TDCAM can improve the performance effectively. The reason is that it can extract distant similar features to align multi-exposure features. The qualitative experiments in Figure 10 (a) demonstrate that the TDCAM effectively alleviates the ghosting artifact and significantly improves the quality of the reconstructed image. In experiment (2), we remove the DWFB and use the traditional convolution layers to merge the features. The results show that DWFB further improves the quality of the HDR images since it can perceive the exposure levels of different regions and adaptively select useful information from different frames. As shown in Figure 10 (b), the proposed DWFB further mitigates fusing distortions and recovers missing contents, and thereby more satisfactory results are reconstructed.

Ablation Analysis of Loss We also verify the effect of the gradient loss and conduct the ablation experiments. As shown in Table 3, experiment (3) shows that the gradient loss further improves the performance of the proposed model since this loss introduces more attention to high-frequency regions to retain the textures and edges. The qualitative results in Figure 10 (c) demonstrate that textures and details are blurred if the gradient loss is removed, proving the effectiveness of this loss.

of homographies in DeepHDR [Wu et al., 2018]. The reason is that this model assumes that the input LDRs are pre-aligned and homographies are usually performed on CPU and are very time-consuming. As shown in Table 2, the inference time of our model is acceptable.

This paper proposes an HDRTransDC network to establish the complicated alignment and fusion relationship between reference and non-reference images to reconstruct high-quality HDR images. Specifically, we propose a TDCAM to extract long-range relevant information to compensate for the misaligned components and occluded content to remove the ghosting artifacts caused by the large motion and saturation. In addition, we propose the DWFB to adaptively select useful information across frames to effectively fuse multi-exposed features, which reduces the fusing distortions. We conduct extensive comparative experiments to verify that the proposed method achieves state-of-the-art performance and generates artifact-free HDR images with realistic details. The ablation experiments are also performed to verify the effectiveness of the components.

[Bogoni, 2000] Luca Bogoni. Extending dynamic range of monochrome and color images through fusion. In Proceedings 15th International Conference on Pattern Recognition. ICPR-2000, volume 3, pages 7–12. IEEE, 2000.

[Yan et al., 2020] Qingsen Yan, Lei Zhang, Yu Liu, Yu Zhu, Jinqiu Sun, Qinfeng Shi, and Yanning Zhang. Deep hdr imaging via a non-local network. IEEE Transactions on Image Processing, 29:4308–4322, 2020.

[Xu et al., 2020a] H. Xu, J. Ma, and X. P. Zhang. Mef-gan: Multi-exposure image fusion via generative adversarial networks. IEEE Transactions on Image Processing, PP(99):1–1, 2020.

[Prabhakar et al., 2020] K Ram Prabhakar, Susmit Agrawal, Durgesh Kumar Singh, Balraj Ashwath, and R Venkatesh Babu. Towards practical and efficient high-resolution hdr deghosting with cnn. In European Conference on Computer Vision, pages 497–513. Springer, 2020.

[Oh et al., 2014] Tae-Hyun Oh, Joon-Young Lee, Yu-Wing Tai, and In So Kweon. Robust high dynamic range imaging by rank minimization. IEEE transactions on pattern analysis and machine intelligence, 37(6):1219–1232, 2014.

[Chen et al., 2022] Jie Chen, Zaifeng Yang, Tsz Nam Chan, Hui Li, Junhui Hou, and Lap-Pui Chau. Attention-guided progressive neural texture fusion for high dynamic range image restoration. IEEE Transactions on Image Processing, 31:2661–2672, 2022.

[Granados et al., 2010] Miguel Granados, Boris Ajdin, Michael Wand, Christian Theobalt, Hans-Peter Seidel, and Hendrik PA Lensch. Optimal hdr reconstruction with linear digital cameras. In 2010 IEEE computer society conference on computer vision and pattern recognition, pages 215–222. IEEE, 2010.

[Zhang and Cham, 2011] Wei Zhang and Wai-Kuen Cham. Gradient-directed multiexposure composition. IEEE Transactions on Image Processing, 21(4):2318–2323, 2011.

[Niu et al., 2021] Yuzhen Niu, Jianbin Wu, Wenxi Liu, Wenzhong Guo, and Rynson WH Lau. Hdr-gan: Hdr image reconstruction from multi-exposed ldr images with large motions. IEEE Transactions on Image Processing, 30:3885–3896, 2021.

[Myszkowski et al., 2008] Karol Myszkowski, Rafal Mantiuk, and Grzegorz Krawczyk. High dynamic range video. Synthesis Lectures on Computer Graphics and Animation, 1(1):1–158, 2008.

[Wu et al., 2018] Shangzhe Wu, Jiarui Xu, Yu-Wing Tai, and Chi-Keung Tang. Deep high dynamic range imaging with large foreground motions. In Proceedings of the European Conference on Computer Vision (ECCV), pages 117–132, 2018.

[Tursun et al., 2016] Okan Tarhan Tursun, Ahmet Oğuz Akyüz, Aykut Erdem, and Erkut Erdem. An objective deghosting quality metric for hdr images. In Computer Graphics Forum, volume 35, pages 139–152. Wiley Online Library, 2016.

[Mertens et al., 2007] Tom Mertens, Jan Kautz, and Frank Van Reeth. Exposure fusion. In 15th Pacific Conference on Computer Graphics and Applications (PG’07), pages 382–390. IEEE, 2007.

[Yan et al., 2019] Qingsen Yan, Dong Gong, Qinfeng Shi, Anton van den Hengel, Chunhua Shen, Ian Reid, and Yanning Zhang. Attention-guided network for ghost-free high dynamic range imaging. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1751–1760, 2019.

[Reinhard et al., 2010] Erik Reinhard, Wolfgang Heidrich, Paul Debevec, Sumanta Pattanaik, Greg Ward, and Karol Myszkowski. High dynamic range imaging: acquisition, display, and image-based lighting. Morgan Kaufmann, 2010.

[Debevec and Malik, 2008] Paul E Debevec and Jitendra Malik. Recovering high dynamic range radiance maps from photographs. In ACM SIGGRAPH 2008 classes, pages 1–10. 2008.

[Granados et al., 2013] Miguel Granados, Kwang In Kim, James Tompkin, and Christian Theobalt. Automatic noise modeling for ghost-free hdr reconstruction. ACM Transactions on Graphics (TOG), 32(6):1–10, 2013.

[Sen et al., 2012] Pradeep Sen, Nima Khademi Kalantari, Maziar Yaesoubi, Soheil Darabi, Dan B Goldman, and Eli Shechtman. Robust patch-based hdr reconstruction of dynamic scenes. ACM Trans. Graph., 31(6):203–1, 2012.

[Kang et al., 2003] Sing Bing Kang, Matthew Uyttendaele, Simon Winder, and Richard Szeliski. High dynamic range video. ACM Transactions on Graphics (TOG), 22(3):319–325, 2003.

[Kalantari et al., 2017] Nima Khademi Kalantari, Ravi Ramamoorthi, et al. Deep high dynamic range imaging of dynamic scenes. ACM Trans. Graph., 36(4):144–1, 2017.

[Liu et al., 2022] Zhen Liu, Yinglong Wang, Bing Zeng, and Shuaicheng Liu. Ghost-free high dynamic range imaging with context-aware transformer. arXiv preprint arXiv:2208.05114, 2022.

[Lee et al., 2014] Chul Lee, Yuelong Li, and Vishal Monga. Ghost-free high dynamic range imaging via rank minimization. IEEE signal processing letters, 21(9):1045–1049, 2014.

[Ma et al., 2017] Kede Ma, Hui Li, Hongwei Yong, Zhou Wang, Deyu Meng, and Lei Zhang. Robust multi-exposure image fusion: a structural patch decomposition approach. IEEE Transactions on Image Processing, 26(5):2519–2532, 2017.

[Mantiuk et al., 2011] Rafał Mantiuk, Kil Joong Kim, Allan G Rempel, and Wolfgang Heidrich. Hdr-vdp-2: A calibrated visual metric for visibility and quality predictions in all luminance conditions. ACM Transactions on graphics (TOG), 30(4):1–14, 2011.

[Zimmer et al., 2011] Henning Zimmer, Andrés Bruhn, and Joachim Weickert. Freehand HDR imaging of moving scenes with simultaneous resolution enhancement. In Computer Graphics Forum, volume 30, pages 405–414. Wiley Online Library, 2011.