MLCrack

    NATURAL LANGUAGE PROCESSING · INTERVIEW QUESTION

    What is tokenization and why does it matter?

    🟢 beginner · NLP

    Hint: Focus on the decision rule, assumptions, and failure mode behind nlp.

    Answer

    Tokenization maps text into model-consumable units. It affects vocabulary coverage, sequence length, latency, multilingual performance, and how well rare words or code are represented.

    Interview reasoning

    Subword schemes trade vocabulary size against fragmentation. Rare words remain representable, but identifiers and low-resource scripts may consume many pieces.

    Preprocessing must preserve information needed for the task and match the model's training conventions. Tokenization affects sequence length and offsets; normalization can alter identifiers, numbers or negation. Change one step at a time and inspect representative domain inputs before assuming a generic cleanup recipe improves accuracy.

    Worked example. The same text must produce identical model tokens offline and in serving.

    Validation

    Measure tokens per text unit, truncation, and task quality by domain and language.

    Test domain strings, token/character offsets and training-serving parity; ablate transformations on held-out task slices. Include identifiers, numbers, Unicode variants and empty inputs in the fixture set.

    Common pitfalls

    Replacing a tokenizer without compatible embeddings changes the learned representation.

    A shorter or cleaner-looking input is not automatically better. Swapping a tokenizer without compatible pretrained embeddings can break model semantics.

    Likely follow-up: Measure tokens per text unit, truncation, and task quality by domain and language.