Skip to content

Fix LingBot KV metadata handling and unify KV config construction#3

Open
forLG wants to merge 2 commits into
Tele-AI:mainfrom
forLG:main
Open

Fix LingBot KV metadata handling and unify KV config construction#3
forLG wants to merge 2 commits into
Tele-AI:mainfrom
forLG:main

Conversation

@forLG

@forLG forLG commented Jul 10, 2026

Copy link
Copy Markdown

Summary

This PR fixes TeleFuser LingBot exact-prefix reuse against the current KV runtime metadata layout and simplifies KV config construction.

Changes:

  • Treat global_end_index and local_end_index as scalar metadata instead of array-like values in telefuser_lingbot.py.
  • Preserve full-KV behavior when local_attn_size == -1, which is required by the default LingBot checkpoint.
  • Replace the separate make_full_kv_config() and make_rolling_config() helpers with a unified make_world_kv_config() helper.
  • Update the LingBot exact-prefix reuse E2E example to use the unified config helper.
  • Update tests/test_world_kv_telefuser_binding.py to cover the unified make_world_kv_config() path instead of the removed rolling-config helper.

Motivation

TeleFuser provides LingBot KV metadata such as global_end_index and local_end_index as integers. The previous binding indexed them as array-like values, which breaks compatibility with the current runtime.

The example also initialized a rolling-window KV config even when the runtime uses full KV. This could make cache materialization inconsistent with the pipeline configuration.

Testing

  1. Run pytest -m smoke and get all passed.

  2. Run examples/exact_prefix_reuse/e2e_telefuser_lingbot.py:

    source ~/TeleFuser/.venv/bin/activate
    export ASSETS=~/lingbot-world/examples/00
    export LINGBOT_WORLD_CHECKPOINT_DIR=/public/model_zoo/lingbot-world-base-cam
    python examples/exact_prefix_reuse/e2e_telefuser_lingbot.py 
        --frame-num 42
        --prefix-chunks 2
        --image-path "$ASSETS/image.jpg"
        --action-path "$ASSETS/"
        --out-dir /tmp/worldkv_e2e

    The result is following, all checks passed:

    {
      "checks": {
        "A_cold": true,
        "B_full_hit": true,
        "B_frames_equal_A": true,
        "C_prefix_hit": true,
        "D_cold": true,
        "C_frames_equal_D": true
      },
      "all_pass": true,
      "wall_s": {
        "A": 18.212,
        "B": 5.633,
        "C": 8.193,
        "D": 15.241
      },
      "flush_s": {
        "A": 0.0,
        "B": 0.0,
        "C": 0.0,
        "D": 0.0
      },
      "fast_forward_k": {
        "A": 0,
        "B": 3,
        "C": 2,
        "D": 0
      }
    

forLG added 2 commits July 9, 2026 08:09
- TeleFuser provides `global_end`/`local_end_index` as `int` metadata rather than array-like values. Now LingBot KV binding read and write them as scalars, See `cacheseek/reuse/exact_prefix/telefuser_lingbot.py`.

- default Lingbot checkpoint needs full KV, but `examples/exact_prefix_reuse/e2e_telefuser_lingbot.py` initalize a rolling window config. Now when `local_attn_size=-1`, the config constructor will transfer from `make_rolling_config()` to `make_full_kv_config()`. See `examples/exact_prefix_reuse/e2e_telefuser_lingbot.py`.

Further improvement: use a unified config constructor in `telefuser_lingbot.py`.
see `cacheseek/reuse/exact_reuse/telefuser_lingbot.py`, remove `make_rolling_config` and `make_full_kv_config`, add `make_world_kv_config` to unify them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant