Powered by OpenAIRE graph
Found an issue? Give us feedback
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/ ZENODOarrow_drop_down
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/
ZENODO
Preprint . 2026
License: CC BY
Data sources: ZENODO
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/
ZENODO
Preprint . 2026
License: CC BY
Data sources: ZENODO
ZENODO
Preprint . 2026
License: CC BY
Data sources: Datacite
ZENODO
Preprint . 2026
License: CC BY
Data sources: Datacite
ZENODO
Preprint . 2026
License: CC BY
Data sources: Datacite
versions View all 3 versions
addClaim

Token-Efficient Conversational History Management using Sparse Semantic Patch Memory

Authors: Dubey, Dhruv;

Token-Efficient Conversational History Management using Sparse Semantic Patch Memory

Abstract

Updated version of the Sparse Semantic Patch Memory (SSPM) framework including full architecture, Gemini 2.5 Flash based experimental validation, and extended empirical evaluation demonstrating significant token reduction while preserving reasoning constraints.Large Language Model (LLM) deployments face practical limitations due to restricted context windows, increasing inference costs, and the accumulation of redundant conversational history. Traditional approaches such as token truncation or surface-level compression often discard important constraints and decisions, leading to degraded reasoning continuity. This repository presents Sparse Semantic Patch Memory (SSPM) — a semantics-first conversational memory architecture that represents dialogue history as compact utility-scored semantic patches rather than raw token sequences. Each conversational turn is decomposed into structured units such as entities, constraints, decisions, code snippets, equations, and structural cues, which are extracted using a DeepSeek-style semantic extraction pipeline implemented with Gemini 2.5 Flash. The SSPM framework applies schema-guided extraction, composite utility scoring, and dependency-aware greedy knapsack selection to retain only the most valuable patches under a strict token budget. Selected patches are stored in an indexed sparse memory structure and dynamically composed with the current query to form a compact prompt for downstream reasoning. Empirical evaluation across five multi-turn technical dialogues demonstrates that SSPM achieves an average token reduction of 48.7% while preserving 100% of explicit constraints and decisions, significantly outperforming conventional raw history, truncation, and compression baselines. The system is implemented as a fully modular pipeline consisting of semantic extraction, utility scoring, sparse selection, indexed memory storage, and prompt composition. This design enables scalable, cost-aware conversational memory management and provides a practical foundation for building long-context reasoning systems and agentic LLM architectures.

Keywords

Budget-Aware Reasoning, Conversational Memory Management, Token-Efficient LLM Memory, Sparse Memory Architectures, Token Cost Optimization, Long-Context Modeling, Memory-Constrained AI Systems, Query-Adaptive Retrieval, Semantic Patch Retrieval, Sparse Semantic Patch Memory (SSPM)

  • BIP!
    Impact byBIP!
    selected citations
    These citations are derived from selected sources.
    This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    0
    popularity
    This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
    Average
    influence
    This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    Average
    impulse
    This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
    Average
Powered by OpenAIRE graph
Found an issue? Give us feedback
selected citations
These citations are derived from selected sources.
This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Citations provided by BIP!
popularity
This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
BIP!Popularity provided by BIP!
influence
This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Influence provided by BIP!
impulse
This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
BIP!Impulse provided by BIP!
0
Average
Average
Average
Green