Skip to content

[Refactor]: Extract attention-sink trimming rule into named behavior #31

@AashishH15

Description

@AashishH15

Problem

Attention-sink trimming is critical behavior. It’s currently implemented but should be reinforced by naming to prevent accidental removal.

Evidence

assembler.rs (line 69) explains the trimming rule in comments. The rule is important, but the function can carry more of the explanation through names.

Scope & constraints

No response

Proposed approach

Rename/extract helpers like:

  • trim_context_tail_preserving_attention_sink
  • fits_budget
  • preserve_attention_sink_head

Acceptance criteria

  • No behavior change.
  • Policy is encoded in names (self-documenting).

Test plan

  • cargo test llm::assembler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorImprove internal structure without changing behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions