Elamur Research⌕
☰
home / papers / 2004 / Efficient Parsing of Highly Ambiguous Context-Free Grammars with Bit Vectors

Efficient Parsing of Highly Ambiguous Context-Free Grammars with Bit Vectors

Summary

Treebank-derived context-free grammars give good coverage but are massively ambiguous. Ordinary chart parsers often exhaust memory or time on them, especially when every analysis is needed and not only the single best one. Schmid presents BitPar, a CKY-style parser that keeps the number of edges and instead makes each edge cheap to store and build. The chart is a dense bit array. The core step, joining two adjacent constituents under a binary rule, is done with bitwise AND over whole vectors of split points rather than one position at a time. Parsing runs in separate passes. A recogniser first fills the chart. A top-down pass then rebuilds a compact parse forest. For Viterbi parsing, filtering, probability computation and best-tree extraction follow the recogniser. Tested on a large annotated Penn treebank grammar, BitPar beat the earlier LoPar parser at every sentence length and used far less memory. Its measured growth with sentence length stayed below cubic. The parser suits tasks that need the whole analysis set, and its Viterbi mode returns the exact best parse without any tuning.

Key points

  • Grammar and hardware: 65,855 rules and 4,444 categories, extracted from a Penn treebank version enriched with features similar to Klein and Manning (2003b). Average rule length was 3.7. Tests ran on a Sun Blade 1000 (750 MHz, 4 GB).
  • Parse times: 1000 random sentences (24,595 tokens) were parsed.
    • Viterbi parsing took 27,596 s, about 1.14 s per word.
    • Parse-forest generation took 26,840 s, about 1.09 s per word.
  • Growth with length: Runtime grew with an exponent of roughly 2.6 for sentences of 4–50 words. The author attributes this to bit-vector operations becoming more effective as vectors get longer.
  • Memory:
    • At length 22, LoPar needed about 1 GB, while BitPar used 180 MB for the forest and 55 MB for Viterbi.
    • At length 55, BitPar needed 113 MB for Viterbi and 3,185 MB for the forest. LoPar could not parse sentences that long.
  • Viterbi time breakdown: chart building took about 15%, filtering 28%, probability computation 57%, and best-parse extraction was negligible.

Interesting ideas

  • I1. Recognise first, analyse later. The first pass only records whether a constituent exists, so it can stop at the first successful derivation. Full analyses are built afterwards, and only for constituents that belong to a complete parse. Separating cheap existence checks from expensive structure building could help any search over dense candidate spaces.
  • I2. Precomputed closure vectors. For each category, the parser stores a bit vector of everything reachable from it through chain (unary) rules. Adding a constituent then inserts all its unary ancestors with a single OR. Precomputed transitive closures used as bitmasks would also work in type hierarchies or tag-set expansions.
  • I3. Memory layout matched to the hot loop. The chart is kept twice, in two bit orderings. This lets the left-child and right-child vectors each be copied out in contiguous blocks, at the price of slower insertion. Trading duplicated storage for fast access in the dominant operation is a broadly reusable engineering choice.
  • I4. Cheap adaptive ordering. Rules are tried in order of how often they have succeeded, with counts gathered online during parsing. Categories that unlock many chain-rule derivations are processed first. This makes early exits happen sooner, and the same trick applies to any search that stops at the first success.
  • I5. Greedy frequency-based binarisation. Following Eisele's method, the most frequent adjacent symbol pair is repeatedly replaced by a new non-terminal. This keeps the binarised grammar small and resembles BPE-style merging, so it may suit other grammar or sequence compression tasks.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

Fields: Natural language processing

Topics: Syntax & grammar formalisms

Institutions

Cite

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{schmid2004efficient,
  title = {{Efficient Parsing of Highly Ambiguous Context-Free Grammars with Bit Vectors}},
  author = {Schmid, Helmut},
  booktitle = {COLING 2004: Proceedings of the 20th International Conference on Computational Linguistics},
  year = {2004},
  doi = {10.3115/1220355.1220379},
  url = {https://doi.org/10.3115/1220355.1220379}
}

References

7 references, 1 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Charniak, E., Goldwater, S., and Johnson, M. (1998). edge-based best-first chart parsing. In Proceedings of the Sixth Workshop on Very Larger Corpora, pages 127–133. Morgan Kaufmann. find
  2. Graham, S., Harrison, M., and Ruzzo, W. (1980). An improved context-free recognizer. ACM Transactions on Programming Languages and Systems, 2(3):415–462. find
  3. Kasami, T. (1965). An efficient recognition and syntax analysis algorithm for context-free languages. Technical Report AFCRL-65-758, Air Force Cambridge Research Laboratory. find
  4. Klein, D. and Manning, C. D. (2003a). A* parsing: Fast exact viterbi parse selection. In Proceedings of HLT-NAACL 03. find
  5. Klein, D. and Manning, C. D. (2003b). Accurate unlexicalized parsing. In Proceedings of the 41st Annual Meeting of the Association for Computational Linguistics. find our card
  6. Schmid, H. (2000). LoPar: Design and Implementation. Number 149 in Arbeitspapiere des Sonderforschungsbereiches 340. Institute for Computational Linguistics, University of Stuttgart. find
  7. Younger, D. H. (1967). Recognition of context-free languages in time . Information and Control, 10:189–208. %'& find

This page in Markdown → https://md.research.elamur.ai/free/en/papers/schmid-2004-efficient-parsing-highly-ambiguous-context/