Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ reason Public

Neural Guided Constraint Logic Programming for Neural Architecture Search

eihli/reason

Repository files navigation

Neural Guided Constraint Logic Programming

An implementation of a system similar to the one described in: Neural Guided Constraint Logic Programming.

What does it do?

Imagine you have some input/output examples:

;; Note: not the real syntax.
(solve
  ((input "Mini Kanren") (output "M. K."))
  ((input "Pro Log")     (output "P. L.")))

This code will find functions that produces those outputs when given those inputs. For example:

;; Note: not the real output.
(lambda (input)
  "Split the input on the space character, 
   take first character of each word, 
   follow that by a period, 
   then join with a space."
  (string-join
    (map 
      (lambda (word)
        (string-append (substring word 0 1) "."))
      (string-split input " "))))

How does it do it?

The input/output examples are "constraints" that get run through a relational/logic programming language called miniKanren (it's similar to Prolog). The logic interpreter tries every possible combination of programs until it finds one that satisfies all of the constraints.

The search space is huge (infinite). What kind of search algorithm will find solutions in a reasonable amount of time?

Breadth first? Depth first? Biased interleaving search? No!

Neural Guided Search!

We train a neural network to pick which paths to explore.

Training and Architecture

TODO: ...

miniKanren Demo

The best way to describe miniKanren (or more generally, a relational programming language) is by example.

Glance over the following code and the output on the last line.

What does it look like this code is doing?

(define-relation (bit-xoro x y result)
  (conde
   ((== 0 x) (== 0 y) (== 0 result))
   ((== 0 x) (== 1 y) (== 1 result))
   ((== 1 x) (== 0 y) (== 1 result))
   ((== 1 x) (== 1 y) (== 0 result))))

(run* (x y) 
  (bit-xoro x y 0))
;; => ((0 0) (1 1))

A typical program would run bit-xor(0, 0) and output 0.

But with relational programming, we can ask the question "What inputs would result in an output of 0?" and the language will return a stream of all possible inputs that result in an output of 0. (We can also ask "What does an input of 0, 0 output?", but that's less interesting since it's what every programming language does.)

In the code above, we're asking what inputs would result in an output of 0 and we get back the list of (0 0) and (1 1), both inputs 0 or both inputs 1 (you can ignore the other text, that's just noise for now).

Links

Related work

About

Neural Guided Constraint Logic Programming for Neural Architecture Search

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published