proomt

Search

Search posts, papers, and topics

All posts

Lobstersian erik varatalu7 min readintermediate

Labeled matches: why is this not in every regex engine?

Summary

The author shows how to label tokens (dates, money, emails, etc.) with a single regex pass using extended operators (`&` for intersection, `~` for complement) in the resharp library. A tiny benchmark compares 10 patterns against spaCy’s NER, reporting ~1.9 GB/s (≈4500× faster) on 8 threads. The post lists the concrete patterns and argues that for deterministic, regular‑language entities regex can…

  • Extended regex operators (`&`, `~`) let you express set intersection and complement directly in patterns, enabling precise token categorization without ML.
  • A single pre‑compiled regex can label many entity types in one pass, achieving throughput in the low‑GB/s range on multi‑core CPUs.
  • For strictly regular entities (e.g., ISO dates, fixed‑format money), regex gives 100 % deterministic accuracy, avoiding the uncertainty of statistical NER.
  • The author provides ready‑to‑use patterns for DATE, MONEY, PERCENT, EMAIL, URL, NUM, NAME, VERB, ADJ, ADV, demonstrating practical usage.

When you need high‑throughput, low‑latency text tagging (e.g., log processing, edge services, or resource‑constrained devices), a deterministic regex solution can replace heavyweight NER models, saving CPU, memory, and power while guaranteeing correctness for regular‑language entities.

6/10

Related reading

  1. "Regex for Rows": Simplifying Pattern Detection in SQL with MATCH_RECOGNIZE

    Databricks announces MATCH_RECOGNIZE, a preview‑only SQL clause that lets you write regex‑style patterns over ordered rows. The post walks through four industry‑level use cases (security login‑failure sequences, V‑shaped stock trends, e‑commerce cart abandonment, IoT sensor‑driven failure prediction) and claims the operator replaces complex CTEs, window functions, and self‑joins. No actual syntax…

    Databricksdatabricks.com5 min
  2. tokenizers v1: encode, decode and scaling, measured

    Hugging Face has released `tokenizers` v1, a major performance update that achieves 3-30x faster encoding than v0.23 while maintaining identical output and API compatibility. Key optimizations include a SIMD-accelerated splitter, a thread-local word cache, and an allocation-free BPE merge loop, ensuring tokenization doesn't bottleneck ML workflows.

    Hugging Facehuggingface.co10 min
  3. Register Tokens for Bounded-State Reasoning in Diffusion Language Models

    Register tokens are fixed‑position embeddings that store a compact hidden state across diffusion‑based language model generation chunks, enabling bounded‑state reasoning without retaining all prior text. Post‑training on LLaDA and Dream shows up to +8.5 math and +19.5 code benchmark points versus plain text carry, and RL fine‑tuning further improves long‑horizon tasks.

    Hugging Face Daily Papersarxiv.org1 minpaper
  4. Trajectory as the Teacher: Few-Step Discrete Flow Matching via Energy-Navigated Distillation

    Apple researchers propose Trajectory‑Shaped Discrete Flow Matching (TS‑DFM), a training‑time distillation method that replaces blind stochastic jumps in discrete flow‑matching with an energy‑based compass to select higher‑quality intermediate tokens. On a 170 M‑parameter language model, the 8‑step student outperforms the 1 024‑step teacher by 32 % perplexity while being 128× faster, beating basel…

    Apple Machine Learning Researchapple.com1 minpaper
  5. MoME: Mixture-of-Memory Embeddings for Context-Aware Sparse Lookup

    The paper proposes Mixture of Memory Embeddings (MoME), a context‑aware sparse lookup that replaces each token’s single memory row with a gated mixture of multiple slots. Experiments on Llama‑3, MobileLLM and Qwen3 show MoME outperforms existing memory‑embedding baselines at equal parameter and FLOP budgets and exhibits interpretable routing for polysemous tokens.

    Hugging Face Daily Papersarxiv.org1 minpaper