π©πͺ Word Segmentation
Split German compound words character by character β sequence labeling made friendly.
πThe task, in plain English
German glues words together (Donaudampfschiffβ¦). Given a compound word, predict for each character whether a split happens there β binary label per character. 94k training examples provided.
| Input | A word (character sequence) |
|---|---|
| Output | 0/1 per character (split boundary or not) |
| Really tests | Sequence labeling: classify every position, not the whole input |
π§The baseline you're given
A simple per-character classifier using local context windows (the surrounding few characters). Limitations: fixed windows miss longer dependencies; character identity alone ignores learned patterns like common word stems.
πBaseline vs. solution
- Fixed context window per character
- Hand-rolled features
- Character embeddings + a small BiLSTM or 1-D conv over the sequence, sigmoid per position β the textbook sequence-labeling recipe
- With 94k examples, even simple models train well β don't overthink capacity
- Clever classical alternative: a vocabulary of known word parts + dynamic-programming splitting can be shockingly strong (and CPU-fast)
π§Explain it like I'm brand new
Sequence labeling vs classification: classification gives one answer per input ("cat or dog?"); sequence labeling gives one answer per position ("split here? here? here?"). Same training loop, one change: the output has length = input length, and the loss averages over positions. Once you see that, this task is a Week-3 exercise, not a monster.
π¬The Gemma 4 playthrough (2000-token limit)
PyTorch: input padded char-id tensors (B, L), vocab 60. Write ONLY an nn.Module: Embedding(60,32) β BiLSTM(32,64) β Linear(128,1), output (B, L) logits. Code only, max 20 lines.
π―Takeaways & what Day 1 might do with this
- Pattern family: sequence labeling (per-position prediction).
- Big data + simple model beats small data + fancy model at contest time scales.