Skip to content

Commit

Permalink
improve error handling in CFG
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Oct 17, 2024
1 parent 1869942 commit fa8ed97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 3 additions & 0 deletions latex/mwpls2024/presentation_abstract.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Title: Let's wrap this up! Incremental structured decoding with resource constraints

Language models are known to struggle with few-shot constraint satisfaction tasks, such as responding within a fixed number of tokens or without using certain words. These scenarios typically arise in programming-related tasks such as code completion and program repair. We propose a novel incremental approach to constrained sequence generation based on a theory of Brzozowski (1964). Our approach constructs a valid sequence from left-to-right using next-token probabilities from the language model to steer the decoder towards natural solutions. We demonstrate the effectiveness of this technique on the problem of syntax repair, where it enjoys a significant advantage over state-of-the-art neural repair models in terms of precision on blind recovery of human repairs, while ensuring that every valid sequence is generable and every generable sequence is valid.
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,6 @@ fun bijectiveRepair(
return if (parallelize) ::genSeq.parallelize().distinct().asSequence() else genSeq()
}

// This experiment essentially tries every possible combination of fillers in parallel
fun List<Σᐩ>.parallelSolve(fillers: Set<Σᐩ>) =
MDSamplerWithoutReplacement(fillers, count { it == HOLE_MARKER })
.asStream().parallel().map {
fold("" to it) { (a, b), c ->
if (c == HOLE_MARKER) (a + " " + b.first()) to b.drop(1) else ("$a $c") to b
}.first.replace("ε ", "").trim()
}
// .filter { measureTimedValue { it.fastMatch(CFG) }.also { println("Decided ${it.value} in ${it.duration}") }.value }

// This is fairly slow compared to bijective repair, but it's a good baseline for comparison
fun repairInParallel(
prompt: Σᐩ,
Expand Down

0 comments on commit fa8ed97

Please sign in to comment.