Learning a SAT Solver from Single-Bit Supervision Daniel Selsam 1 Matthew Lamm 1 unz 1 Benedikt B¨ Percy Liang 1 Leonardo de Moura 2 David L. Dill 1 1 Stanford University 2 Microsoft Research March 22nd, 2018
Setup Train: � � Input: SAT problem P Output: ✶ { P is satisfiable } 2
Setup Train: � � Input: SAT problem P Output: ✶ { P is satisfiable } Test: NeuroSAT unsat P NeuroSAT sat P
Setup Train: � � Input: SAT problem P Output: ✶ { P is satisfiable } Test: NeuroSAT unsat P NeuroSAT sat P solution 2
Background: SAT 3
Background: SAT ◮ A propositional formula can be represented as an AND of ORS. – example: ( x 1 ∨ x 2 ) ∧ ( x 2 ∨ x 1 ) � �� � � �� � c 1 c 2 3
Background: SAT ◮ A propositional formula can be represented as an AND of ORS. – example: ( x 1 ∨ x 2 ) ∧ ( x 2 ∨ x 1 ) � �� � � �� � c 1 c 2 ◮ Jargon: – x 1 , x 1 , x 2 , x 2 are all literals – c 1 , c 2 are both clauses 3
Background: SAT ◮ A propositional formula can be represented as an AND of ORS. – example: ( x 1 ∨ x 2 ) ∧ ( x 2 ∨ x 1 ) � �� � � �� � c 1 c 2 ◮ Jargon: – x 1 , x 1 , x 2 , x 2 are all literals – c 1 , c 2 are both clauses ◮ A formula is satisfiable if there exists a satisfying assignment . – example: formula above is satisfiable ( e.g. 11) 3
Background: SAT ◮ A propositional formula can be represented as an AND of ORS. – example: ( x 1 ∨ x 2 ) ∧ ( x 2 ∨ x 1 ) � �� � � �� � c 1 c 2 ◮ Jargon: – x 1 , x 1 , x 2 , x 2 are all literals – c 1 , c 2 are both clauses ◮ A formula is satisfiable if there exists a satisfying assignment . – example: formula above is satisfiable ( e.g. 11) ◮ The SAT problem : given a formula, – determine if it is satisfiable – if it is, find a satisfying assignment 3
Machine learning for SAT ◮ Goal: train a neural network to predict satisfiability. – (we’ll discuss decoding solutions later) 4
Machine learning for SAT ◮ Goal: train a neural network to predict satisfiability. – (we’ll discuss decoding solutions later) ◮ Two design challenges: 4
Machine learning for SAT ◮ Goal: train a neural network to predict satisfiability. – (we’ll discuss decoding solutions later) ◮ Two design challenges: – what problems do we train on? 4
Machine learning for SAT ◮ Goal: train a neural network to predict satisfiability. – (we’ll discuss decoding solutions later) ◮ Two design challenges: – what problems do we train on? – with what kind of architecture? 4
Training data 5
Training data ◮ Issue: some problem distributions might be easy to classify. – (based on superficial properties) – want: difficult problems to force it to learn something general 5
Training data ◮ Issue: some problem distributions might be easy to classify. – (based on superficial properties) – want: difficult problems to force it to learn something general ◮ We define distribution SR ( n ) over problems such that: – problems come in pairs – one unsat , one sat – they differ by negating a single literal in a single clause 5
Training data ◮ Issue: some problem distributions might be easy to classify. – (based on superficial properties) – want: difficult problems to force it to learn something general ◮ We define distribution SR ( n ) over problems such that: – problems come in pairs – one unsat , one sat – they differ by negating a single literal in a single clause ◮ To sample a pair from SR ( n ): 5
Training data ◮ Issue: some problem distributions might be easy to classify. – (based on superficial properties) – want: difficult problems to force it to learn something general ◮ We define distribution SR ( n ) over problems such that: – problems come in pairs – one unsat , one sat – they differ by negating a single literal in a single clause ◮ To sample a pair from SR ( n ): – keep sampling random clauses until unsat 5
Training data ◮ Issue: some problem distributions might be easy to classify. – (based on superficial properties) – want: difficult problems to force it to learn something general ◮ We define distribution SR ( n ) over problems such that: – problems come in pairs – one unsat , one sat – they differ by negating a single literal in a single clause ◮ To sample a pair from SR ( n ): – keep sampling random clauses until unsat – flip a single literal in the final clause to make it sat 5
Training data ◮ Issue: some problem distributions might be easy to classify. – (based on superficial properties) – want: difficult problems to force it to learn something general ◮ We define distribution SR ( n ) over problems such that: – problems come in pairs – one unsat , one sat – they differ by negating a single literal in a single clause ◮ To sample a pair from SR ( n ): – keep sampling random clauses until unsat – flip a single literal in the final clause to make it sat – return the pair 5
Network architecture 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 x 1 c 1 x 1 x 2 c 2 x 2 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 x 1 c 1 x 1 x 2 c 2 x 2 NeuroSAT: 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 x 1 c 1 x 1 x 2 c 2 x 2 NeuroSAT: ◮ maintain embedding at every node 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 x 1 c 1 x 1 x 2 c 2 x 2 NeuroSAT: ◮ maintain embedding at every node ◮ iteratively pass messages along the edges of the graph 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 x 1 c 1 x 1 x 2 c 2 x 2 NeuroSAT: ◮ maintain embedding at every node ◮ iteratively pass messages along the edges of the graph ◮ after T time steps, map literals into scalar “votes” 6
Network architecture ( x 1 ∨ x 2 ) ∧ ( x 1 ∨ x 2 ) � �� � � �� � c 1 c 2 x 1 c 1 x 1 x 2 c 2 x 2 NeuroSAT: ◮ maintain embedding at every node ◮ iteratively pass messages along the edges of the graph ◮ after T time steps, map literals into scalar “votes” ◮ average votes to compute logit 6
Experiment 7
Experiment ◮ Datasets: – Train: SR ( U (10 , 40)) – Test: SR (40) 7
Experiment ◮ Datasets: – Train: SR ( U (10 , 40)) – Test: SR (40) ◮ SR (40) – 40 variables (a trillion possible assignments) – ≈ 200 clauses – ≈ 1,000 literal occurrences – uniformly random: just a tangled, structureless mess – every problem a single bit away from flipping – (caveat: easy for SOTA) 7
Experiment ◮ Datasets: – Train: SR ( U (10 , 40)) – Test: SR (40) ◮ SR (40) – 40 variables (a trillion possible assignments) – ≈ 200 clauses – ≈ 1,000 literal occurrences – uniformly random: just a tangled, structureless mess – every problem a single bit away from flipping – (caveat: easy for SOTA) ◮ Results: NeuroSAT predicts with 85% accuracy. 7
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
NeuroSAT in action 8
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments 9
Decoding satisfying assignments Percent of satisfiable problems in SR (40) solved: 70% 9
Running for more rounds 10
Scaling to bigger problems 11
Generalizing to other domains ◮ NeuroSAT generalizes to problems from other domains. 12
Generalizing to other domains ◮ NeuroSAT generalizes to problems from other domains. ◮ First we generate random graphs: 12
Generalizing to other domains ◮ NeuroSAT generalizes to problems from other domains. ◮ First we generate random graphs: ◮ For each graph, we generate: – k -coloring problems (3 ≤ k ≤ 5) – k -dominating set problems (2 ≤ k ≤ 4) – k -clique problems (3 ≤ k ≤ 5) – k -cover problems (4 ≤ k ≤ 6) 12
Recommend
More recommend