{"categories":[{"label":"Artificial Intelligence","url":"https://skillfed.io/packages/category/scientific-engineering-artificial-intelligence/5"}],"enrichment":{"capability":"Converts chat messages to token IDs for LLM inference and training, with deterministic parsing of model responses and multi-turn conversation extension that preserves token identity across turns.","skillfed_tags":["llm-training","token-alignment","chat-templates"],"use_cases":["RL training pipelines where token identity between sampler and trainer must be preserved across multi-turn rollouts","Building deterministic chat interfaces that parse tool calls and reasoning tokens without re-rendering history","Extending conversations in inference systems (transformers, vLLM, SGLang) while maintaining token alignment with training","Testing and debugging chat template behavior by inspecting token-to-message attribution and round-trip consistency","Pooling tokenizer instances across concurrent rendering tasks to amortize model loading overhead"],"what_it_does":"Renderers is a library for deterministic conversion between chat messages and token IDs, designed to preserve token identity across multi-turn LLM conversations. It wraps model-specific chat templates as Python objects that can render messages to token IDs, parse model-generated token sequences back into structured responses (including tool calls and reasoning content), and extend conversations without re-rendering prior history. The core problem it solves is token drift\u2014when inference engines apply templates, parse outputs, and re-render full history each turn, subtle differences in whitespace, BPE boundaries, and boolean formatting accumulate, causing training samples to diverge from what the model actually saw.\n\nThe library ships hand-coded renderers for popular models (Qwen, GLM, DeepSeek, Llama, Nemotron, and others) and falls back to a generic wrapper for unknown architectures. Its key contract is `bridge_to_next_turn`, which extends a conversation by appending new messages to the previous prompt and completion token streams without re-rendering, proving byte-for-byte identity. This is critical for RL training, where the trainer must see exact token sequences the sampler produced. Dependencies include jinja2, numpy, openai, tiktoken, transformers, and two proprietary packages (openai-harmony, prime-pydantic-config).","worth_installing":"Yes, if you are building RL training systems or multi-turn inference pipelines where token identity matters. The library solves a real problem\u2014token drift from re-rendering\u2014with empirical evidence (64 vs 77 training samples from 64 rollouts on a benchmark). Install friction is low. The main caveat is dependency on two proprietary packages (openai-harmony, prime-pydantic-config) whose availability and licensing should be verified before committing to the stack."},"id":"renderers","links":{"html":"https://skillfed.io/packages/renderers","md":"https://skillfed.io/packages/renderers.md","pypi":"https://pypi.org/project/renderers/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-08-07","license_spdx":"Apache-2.0","license_treatment":"permissive","name":"renderers","python_support":"supports_current","summary":"Chat template renderers \u2014 deterministic message-to-token conversion for LLM training"},"popularity":{"monthly_downloads":477643,"position":6442,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.1.9"}
