aiperf: Weka synth buffer should reset context when truncation deletes emitted segments / aiperf:Weka 合成缓冲区截断删除已发出段时应重置上下文
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 70/100
Línea de trabajo
Start in utils/aiperf/src/aiperf/dataset/loader/weka_synth_buf.py by tracing truncate_synth_buf_at_block() through ConversationReconstructor.advance_turn() and turn_delta(). Add or run unit coverage for zero-LCP and boundary truncation cases, including an un-emitted deletion. Done means previously emitted content triggers a reset with the rebuilt messages, while deletions confined to un-emitted segments remain append-only.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
truncate_synth_buf_at_block() can delete previously emitted Weka synth-buffer segments while returning None, which ConversationReconstructor.turn_delta() interprets as no disturbance. When that happens, the next replay turn may be emitted as an append-only delta with reset_context=False even though the previously sent context was pulled back or fully cleared.
This corrupts Weka trace replay for turns where the hash-id prefix relationship is non-monotonic, especially when the LCP with the previous turn is zero or when truncation lands exactly on a segment boundary and drops later segments.
Affected code
utils/aiperf/src/aiperf/dataset/loader/weka_synth_buf.py
The relevant flow is:
ConversationReconstructor.advance_turn()computeslcp = longest_common_prefix(prev_hash_ids, curr_hash_ids).- It calls
truncate_synth_buf_at_block(..., target_blocks=lcp, ...)and stores the return value in_last_disturbance_at. turn_delta()treats a disturbance as reset-worthy only if_last_disturbance_at is not None and _last_disturbance_at < _emitted_segment_count.- If
_last_disturbance_atisNone,turn_delta()uses the strict append path and returns onlysegments[_emitted_segment_count:]withreset_context=False.
The problem is that truncate_synth_buf_at_block() currently returns None for cases that do delete prior context, for example:
target_blocks <= 0: it clearssegmentsand returnsNone.- Boundary truncation where no surviving segment is modified, but segments after the boundary are deleted.
- Truncation that lands exactly at the start of a segment and deletes that segment and everything after it.
Those are real disturbances if any deleted segment was previously emitted.
Why this is a bug
Weka reconstruction emits per-turn raw_messages as deltas unless reset_context=True. If the synth buffer removes previously emitted content, the downstream session must be reset and sent the full rebuilt context for the current turn.
Returning None from the truncation helper hides that removal. If _emitted_segment_count still points beyond the shortened buffer, the append path can emit an empty delta with reset_context=False. The worker then continues from stale conversation state instead of replaying the current Weka prompt. This silently changes the request stream and can preserve a larger or unrelated prior prompt across a context pull-back.
In cache/prefix-sensitive agentic replay, this is particularly bad because the trace is supposed to reproduce the recorded hash-id structure. A bad non-reset turn changes the actual payload while the trace metadata still reports the intended hash IDs.
Expected behavior
truncate_synth_buf_at_block() should report the earliest deleted or modified segment index whenever truncation removes content that may have already been emitted.
Concretely:
- If
target_blocks <= 0and the buffer was non-empty, clear it and return0. - If a boundary cut deletes segments after the boundary and no in-place strip was already reported, return the first deleted segment index.
- If truncation lands at the start of segment
iand deletes segmentionward, returni. - Continue returning
Noneonly when no surviving or deleted segment represents a disturbance.
Then turn_delta() will take the reset path when deleted content intersects prior emitted content, emit the full rebuilt message list, and set reset_context=True.
Suggested regression coverage
Add unit tests around ConversationReconstructor / truncate_synth_buf_at_block() for:
- A turn with
lcp == 0after at least one prior emitted turn. The nextturn_delta()should returnreset_context=Trueand non-empty rebuilt messages. - Boundary truncation that deletes one or more previously emitted segments without slicing the boundary segment. This should also force
reset_context=True. - Truncation that deletes only segments that have not yet been emitted may remain append-only.
Impact
This affects Weka trace replay correctness. It does not necessarily crash the run; it can silently send the wrong prompt/context for affected turns, which makes latency, token, and prefix-cache measurements untrustworthy for those traces.
中文说明
truncate_synth_buf_at_block() 在删除已发出的 Weka 合成缓冲区段后可能返回 None,导致 turn_delta() 误认为没有发生扰动,从而以仅追加的 delta 模式(reset_context=False)发出下一轮回复,即使先前发出的上下文已被回撤或完全清除。这会破坏 Weka 追踪回放的正确性——在 hash-id 前缀关系非单调的轮次中,下游会话可能基于过期的对话状态继续,静默地改变请求流。修复方案:让截断函数在删除已发出内容时返回最早被删除的段索引,使 turn_delta() 走重置路径并发出完整重建的消息列表。
- Lenguaje dominante
- Python
- Estrellas
- 1.9k
- Forks
- 343
- Merge medio
- 2 d 40 min
- PR fusionados (30 d)
- 431
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 SemiAnalysisAI/InferenceX
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
SemiAnalysisAI/InferenceX#2125 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
SemiAnalysisAI/InferenceX#1587 ·
Los mantenedores suelen responder en 1 día
-
[experimental chore/agentx-v0.2-aiperf-testing branch] agentic build_replay_cmd: missing --tokenizer-trust-remote-code breaks Kimi-K2.5 (and other custom-code tokenizer models) / agentic build_replay_cmd 缺少 --tokenizer-trust-remote-code 导致 Kimi-K2.5 等自定义 tokenizer 模型失败Quizá libre de nuevo @sahil-bhatti-ai la tomó hace 170 días y no hay ningún pull request abierto. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
SemiAnalysisAI/InferenceX#1369 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 76/100
SemiAnalysisAI/InferenceX#1359 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Menos de una hora Aptitud para principiantes 18/100
SemiAnalysisAI/InferenceX#4655 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de SemiAnalysisAI/InferenceX
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Claiming namespace `thejakia1`Abiertonamespace operations
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
EclipseFdn/open-vsx.org#15057 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
FinanceFlash/unvibecode#349 ·
-
Mission statement: why this is free, in the README, Why This Exists and the wiki HomePosiblemente ocupada @ChiefGyk3D la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ChiefGyk3D/Clouds-Against-Humanity#348 ·
Los mantenedores suelen responder en 1 día
-
[Perf] Default --vllm-watermark 0.05 for rollouts (hybrid models re-preempt under KV pressure)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
vllm-project/vime#508 ·
Los mantenedores suelen responder en 4 días