Goto

Collaborating Authors

 higher-order function


Neural Program Search with Higher-Order Functions and Lambdas

Neural Information Processing Systems

Search is an important technique in program synthesis that allows for adaptive strategies such as focusing on particular search directions based on execution results. Several prior works have demonstrated that neural models are effective at guiding program synthesis searches.


LambdaBeam: Neural Program Search with Higher-Order Functions and Lambdas

Neural Information Processing Systems

Search is an important technique in program synthesis that allows for adaptive strategies such as focusing on particular search directions based on execution results. Several prior works have demonstrated that neural models are effective at guiding program synthesis searches. However, a common drawback of those approaches is the inability to handle iterative loops, higher-order functions, or lambda functions, thus limiting prior neural searches from synthesizing longer and more general programs. We address this gap by designing a search algorithm called LambdaBeam that can construct arbitrary lambda functions that compose operations within a given DSL. We create semantic vector representations of the execution behavior of the lambda functions and train a neural policy network to choose which lambdas to construct during search, and pass them as arguments to higher-order functions to perform looping computations. Our experiments show that LambdaBeam outperforms neural, symbolic, and LLM-based techniques in an integer list manipulation domain.



Higher-Order DisCoCat (Peirce-Lambek-Montague semantics)

Toumi, Alexis, de Felice, Giovanni

arXiv.org Artificial Intelligence

DisCoCat [1, 2] (Categorical Compositional Distributional) models are structure-preserving maps which send grammatical types to vector spaces and grammatical structures to linear maps. Concretely, the meaning of words is given by tensors with shapes induced by their grammatical types; the meaning of sentences is given by contracting the tensor networks induced by their grammatical structure. String diagrams provide an intuitive graphical language to visualise and reason formally about the evaluation of DisCoCat models; which can be formalised in terms of functors F: G Vect from the category generated by a formal grammar G to the monoidal category Vect of vector spaces and linear maps with the tensor product [3, 2.5]. Although this functorial definition applies equally to any kind of formal grammar, most of the DisCoCat literature focuses on pregroup grammars and more generally on categorial grammars such as the Lambek calculus [4, 5] and combinatory categorial grammars (CCG) [6]. In that case, G is a closed monoidal category and the DisCoCat models F: G Vect map grammatical structures to the closed structure of Vect in a canonical way. In practice, this means that once the meaning of each word is computed from a dataset, the meaning of any new grammatical sentence can be computed automatically from its grammatical structure.


LambdaBeam: Neural Program Search with Higher-Order Functions and Lambdas

Shi, Kensen, Dai, Hanjun, Li, Wen-Ding, Ellis, Kevin, Sutton, Charles

arXiv.org Artificial Intelligence

Search is an important technique in program synthesis that allows for adaptive strategies such as focusing on particular search directions based on execution results. Several prior works have demonstrated that neural models are effective at guiding program synthesis searches. However, a common drawback of those approaches is the inability to handle iterative loops, higher-order functions, or lambda functions, thus limiting prior neural searches from synthesizing longer and more general programs. We address this gap by designing a search algorithm called LambdaBeam that can construct arbitrary lambda functions that compose operations within a given DSL. We create semantic vector representations of the execution behavior of the lambda functions and train a neural policy network to choose which lambdas to construct during search, and pass them as arguments to higher-order functions to perform looping computations. Our experiments show that LambdaBeam outperforms neural, symbolic, and LLM-based techniques in an integer list manipulation domain.


HOTGP -- Higher-Order Typed Genetic Programming

Fernandes, Matheus Campos, de França, Fabrício Olivetti, Francesquini, Emilio

arXiv.org Artificial Intelligence

Program synthesis is the process of generating a computer program following a set of specifications, which can be a high-level description of the problem and/or a set of input-output examples. The synthesis can be modeled as a search problem in which the search space is the set of all the programs valid under a grammar. As the search space is vast, brute force is usually not viable and search heuristics, such as genetic programming, also have difficulty navigating it without any guidance. In this paper we present HOTGP, a new genetic programming algorithm that synthesizes pure, typed, and functional programs. HOTGP leverages the knowledge provided by the rich data-types associated with the specification and the built-in grammar to constrain the search space and improve the performance of the synthesis. The grammar is based on Haskell's standard base library (the synthesized code can be directly compiled using any standard Haskell compiler) and includes support for higher-order functions, $\lambda$-functions, and parametric polymorphism. Experimental results show that, when compared to $6$ state-of-the-art algorithms using a standard set of benchmarks, HOTGP is competitive and capable of synthesizing the correct programs more frequently than any other of the evaluated algorithms.


Python Lambda Functions, Explained - KDnuggets

#artificialintelligence

Since the advent of computer programming, functions have played a key role by offering advantages such as reusability, readability, modularity, error reduction, and easy modification. Reusability is considered one of the most useful traits of a function but what if I tell you there are functions that are not reusable but still useful? To find out, read along! A lambda function does not have a name and is an immediately invoked function. It can accept any number of arguments but returns only one expression, unlike regular functions.


Representing Partial Programs with Blended Abstract Semantics

Nye, Maxwell, Pu, Yewen, Bowers, Matthew, Andreas, Jacob, Tenenbaum, Joshua B., Solar-Lezama, Armando

arXiv.org Artificial Intelligence

Synthesizing programs from examples requires searching over a vast, combinatorial space of possible programs. In this search process, a key challenge is representing the behavior of a partially written program before it can be executed, to judge if it is on the right track and predict where to search next. We introduce a general technique for representing partially written programs in a program synthesis engine. We take inspiration from the technique of abstract interpretation, in which an approximate execution model is used to determine if an unfinished program will eventually satisfy a goal specification. Here we learn an approximate execution model implemented as a modular neural network. By constructing compositional program representations that implicitly encode the interpretation semantics of the underlying programming language, we can represent partial programs using a flexible combination of concrete execution state and learned neural representations, using the learned approximate semantics when concrete semantics are not known (in unfinished parts of the program). We show that these hybrid neuro-symbolic representations enable execution-guided synthesizers to use more powerful language constructs, such as loops and higher-order functions, and can be used to synthesize programs more accurately for a given search budget than pure neural approaches in several domains.



Top 10 Scala Libraries For Data Science

#artificialintelligence

Scala or Scalable language is an extension of Java language which runs on Java Virtual Machine (JVM). It is one of the de facto languages when it comes to playing practically with Big Data. This statically-typed language serves as an important tool for the data scientists because it supports both anonymous functions as well as higher-order functions. In this article, we list down 10 Scala Libraries for a data science enthusiast. Breeze is a set of libraries for machine learning and numerical computing and is a part of ScalaNLP umbrella project.