Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 1.15 KB

File metadata and controls

32 lines (19 loc) · 1.15 KB

Logit Processor Specification

Version: v1.2.3 | Status: Active | Last Updated: March 2026

Overview

Provides sampling strategies for language model outputs including temperature scaling, top-k filtering, nucleus (top-p) sampling, and repetition penalty. Implements a composable processor pipeline for token sampling.

Functional Requirements

  1. Temperature scaling for controlling output diversity
  2. Top-k filtering to restrict sampling to the k most likely tokens
  3. Nucleus (top-p) sampling with cumulative probability threshold
  4. Repetition penalty to discourage previously generated tokens

Interface

from codomyrmex.logit_processor import TemperatureProcessor, TopKProcessor, TopPProcessor, LogitProcessorList, sample_token

processors = LogitProcessorList([TemperatureProcessor(0.8), TopKProcessor(50)])
token_id = sample_token(logits, temperature=0.8, top_k=50)

Exports

LogitProcessor, LogitProcessorList, TemperatureProcessor, TopKProcessor, TopPProcessor, RepetitionPenaltyProcessor, greedy_decode, sample_token

Navigation