Add token scores, input_truncated and usage to EncoderDetector
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
Línea de trabajo
Start with transformer.py at _decode_sample, _predict_single, the batch and predict_prompt truncation paths, and the passage-group path; run the focused pytest command in the issue. Compare token results with the #128 golden output and check usage and truncation behavior, including a log-capture test that verifies counts without input text. The issue is blocked by #149 and asks for a branch from stateless_core.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Parent: #148 · Epic: #126 · Blocked by: #149
Branch from stateless_core; open the PR against it.
Problem
The encoder can show token-level evidence only through the output_format="tokens" dict path, truncation is only logged (and not at all when a passage group still exceeds max_length), and nothing reports which weights ran or how much work a call did.
Current behavior
- Tokens:
transformer.py:163_decode_sample,:241_predict_singlewithoutput_format="tokens"(pred,probkeys). - Truncation warnings:
transformer.py:319-322(batch path, text-free but only logged) and:511-521(predict_prompt, only logged). The passage-group path (:105-125) logs nothing when a group still exceedsmax_length. - No usage.
Steps
include_tokens=True(setsupports_tokens = True) returnsDetection.tokensasTokenScore(token text, offsets into the answer,score= model probability,flagged= oldpred). Same tokens and probabilities as the old"tokens"output; not filtered bymin_score; aggregated over passage groups withmax().- When the tokenized prompt + answer exceed
max_length, or a group still exceeds it, add the warninginput_truncatedto theDetectionand log a WARNING with the code and token counts (never text). - Add
usage: one entry withmodel_id,model_version, unitssources(omitted forPromptInput),source_chars,answer_chars,input_tokens(summed over passage groups).
Acceptance criteria
- Tokens equal the #128 golden
"tokens"output field for field (pred→flagged,prob→score). - A too-long input yields
input_truncated; a log-capture test shows the code and counts and no input text. -
usagehas the listed units;sourcesabsent forPromptInput. - Contract suite still passes; existing tests pass; follows CONTRIBUTING "Errors and logging".
Start here
uv run --extra dev pytest tests/test_inference_pytest.py -q -k "truncat or token"
- Lenguaje dominante
- Python
- Estrellas
- 615
- Forks
- 60
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 12
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de KRLabsOrg/LettuceDetect
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
KRLabsOrg/LettuceDetect#108 ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 Medio día Aptitud para principiantes 70/100
KRLabsOrg/LettuceDetect#104 ·
Los mantenedores suelen responder en 1 día
-
Bugs: One typed detect interface for the detectors packagePosiblemente ocupada @hslev la tomó hace 1 día. Abierto
KRLabsOrg/LettuceDetect#192 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
ready-for-agent
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
KRLabsOrg/LettuceDetect#181 ·
Los mantenedores suelen responder en 1 día
-
ready-for-agent
Dificultad 5/5 Más de una semana Aptitud para principiantes 22/100
KRLabsOrg/LettuceDetect#180 ·
Los mantenedores suelen responder en 1 día
Todos los issues de KRLabsOrg/LettuceDetect
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
django-cms/djangocms-frontend#413 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NanmiCoder/MediaCrawler#1004 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
facebookresearch/xformers#1417 ·
-
question
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
vllm-project/vime#524 ·
Los mantenedores suelen responder en 7 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
FinanceFlash/unvibecode#675 ·
Los mantenedores suelen responder en 1 día