A. We give a fast algorithm for sampling uniform solutions of general constraint satisfaction problems (CSPs) in a local lemma regime. e expected running time of our algorithm is near-linear in and a fixed polynomial in Δ, where is the number of variables and Δ is the max degree of constraints. Previously, up to similar conditions, sampling algorithms with running time polynomial in both and Δ, only existed for the almost atomic case, where each constraint is violated by a small number of forbidden local configurations.Our sampling approach departs from all previous fast algorithms for sampling LLL, which were based on Markov chains. A crucial step of our algorithm is a recursive marginal sampler that is of independent interests. Within a local lemma regime, this marginal sampler can draw a random value for a variable according to its marginal distribution, at a local cost independent of the size of the CSP.the algorithm terminates within poly( , , Δ)• log time in expectation and outputs an almost uniform sample of satisfying assignments for Φ within total variation distance.e formal statement of the theorem is in eorem 5.1 (for termination and correctness of sampling) and in eorem 6.3 (for efficiency of sampling).e condition in (3) becomes Δ 7+ (1) 1 when ≤ ( ) − (1) , while a typical case is usually given by a much smaller ≤ −Ω ( ) .e previous best bound for sampling general CSP solutions was that 3 Δ 7 < for a small constant , achieved by the deterministic approximate counting based algorithm in [JPV21b] whose running time was ( / ) poly ( ,Δ,log ) .Let be the total number of satisfying assignments for Φ. A ˆ is called an -approximation of if (1 − ) ≤ ˆ ≤ (1 + ) . By routinely going through the non-adaptive annealing process in [FGYZ21], the approximate sampler in eorem 1.1 can be used as a black-box to give for any ∈ (0, 1) an -approximation of in time poly ( , , Δ) • ˜ 2 −2 with high probability.1.1.1. Perfect sampler.e evaluation oracle in Assumption 1 in fact checks the sign of P[¬ | ], the probability that a constraint is violated given a partially specified assignment . If further this probability can be estimated efficiently, then the sampling in eorem 1.1 can be made perfect, where the output sample follows exactly the target distribution.