Attempts to solve traditional LLM issues of getting lost in multi-turn conversations and single conversation length limitations by simulating human dialogue patterns.
Based on research paper LLMs Get Lost In Multi-Turn Conversation
Example provides both traditional and new architecture TUI modes for testing: Quick Jump to TUI Example
Research on 15 LLMs across 200,000+ conversations shows:
LLM Problem | Human Behavior |
---|---|
Premature Solutions | Ask clarifying questions first |
Information Hoarding | Forget irrelevant details |
Linear Replay | Maintain "current state" |
Verbose Spirals | Stay focused |
Cognitive Burden of Perfect Memory
Research shows exceptional memory ability doesn't equal intelligence advantage. The classic neuropsychological case of Solomon Shereshevsky could remember arbitrary details from decades ago, including meaningless number sequences and vocabulary lists, but "perfect memory" actually created cognitive burden. He couldn't distinguish important from unimportant information, leading to difficulties in abstract thinking and daily decision-making.
Traditional LLMs using complete memory models may actually be simulating cognitive impairment. This leads to requiring bigger, more powerful hardware support without proportional performance gains.
Selective attention > Complete memory
Abstract summarization > Detail preservation
Dynamic adaptation > Fixed replay
Human conversation process â Engineering implementation
Mental summary â Small model generates structured summary after each turn
Content recall â Automatic fuzzy search of conversation history for each question (relevance scoring)
New conversation â Latest summary + relevant history fragments + new question
Simulating imperfect memory: Instead of designing better, larger information retrieval support, we built a system that processes information like humans do
This approach explores combining human cognitive advantages with machine computational advantages:
Maintains the natural focus characteristics of human conversation while leveraging machine advantages in precise retrieval. Doesn't use complete history during conversation, only activating detailed retrieval under specific trigger conditions.
Exclude unnecessary information: Remove from key summaries
Maintain focus: Use structured summaries, similar to mental rough overviews
Active recall: Automatically retrieve relevant historical content for each question
State updates: Continuous summarization, similar to mental event understanding
Cognitive Mode | Human Behavior | Traditional LLM | Simulation Implementation |
---|---|---|---|
Memory Management | Selective retention | Perfect recall | Structured forgetting |
Error Learning | Avoid known failures | Repeat mistakes | Excluded options tracking |
Focus Maintenance | Current state oriented | Historical drowning | Summary-based context |
Memory Retrieval | Active associative triggering | Passive complete memory | Automatic fuzzy search |
graph TB T1["Turn 1 Conversation"] --> T1_Store["Store: [Q1] + [R1]"] T1_Store --> T2["Turn 2 Conversation"] T2 --> T2_Store["Store: [Q1] + [R1] + [Q2] + [R2]"] T2_Store --> T3["Turn 3 Conversation"] T3 --> T3_Store["Store: [Q1] + [R1] + [Q2] + [R2] + [Q3] + [R3]"] T3_Store --> TN["Turn N Conversation"] TN --> TN_Store["Store: Complete conversation"]
Turn 1: [question 1] + [response 1]
Turn 2: [question 1] + [response 1] + [question 2] + [response 2]
Turn 3: [question 1] + [response 1] + [question 2] + [response 2] + [question 3] + [response 3]
...
Turn N: [Complete verbatim conversation record]
graph TB H_Input["New question input"] --> H_Fuzzy["Fuzzy search history"] H_Fuzzy --> H_Components["Context composition"] H_Components --> H_Summary["Structured summary"] H_Components --> H_Relevant["Relevant history fragments"] H_Components --> H_Question["New question"] H_Summary --> H_LLM["LLM response"] H_Relevant --> H_LLM H_Question --> H_LLM H_LLM --> H_Response["Generate answer"] H_Response --> H_NewSummary["Update structured summary"] H_NewSummary --> H_Store["Store to memory"]
Each turn: [Structured current state] + [Relevant history fragments] + [New question]
Core topic of current discussion
Accumulated retention of all confirmed requirements
Accumulated retention of all constraint conditions
Excluded options + reasons
Accumulated retention of all important data, facts, and conclusions
Current topic-related questions to clarify
All important historical discussion points
Human memory retrieval is typically triggered by keywords, such as: "what we mentioned earlier..."
This section is designed to calculate high similarity between the latest question and conversation history to provide supplementary reference materials, simulating natural memory trigger mechanisms:
- Keyword triggering: Immediately associate relevant content upon hearing specific keywords
- Semantic Similarity: Comprehend content with similar meaning but different wording
- Time Weight: Recent conversations are more easily recalled
Total score = Keyword overlap (40%) + Semantic similarity (40%) + Time weight (20%)
Keyword triggering
Semantic Similarity
Time Weight
Each turn conversation context = [Structured summary] + [Relevant historical conversation] + [New question]
ExcludedOptions
git clone https://github.com/pardnchiu/cim-prototype cd cim-prototype
OPENAI_API_KEY
file and put your OpenAI API key:echo "your-openai-api-key-here" > OPENAI_API_KEY
Or set environment variable:
export OPENAI_API_KEY="your-openai-api-key-here"
./cimp ./cimp --old # Run traditional memory mode
or
go run main.go go run main.go --old # Run traditional memory mode
The program will look for OpenAI API key in the following order:
OPENAI_API_KEY
OPENAI_API_KEY
file in current directoryOPENAI_API_KEY
file in executable directoryINSTRUCTION_CONVERSATION
INSTRUCTION_SUMMARY
Start the program: After execution, displays three-panel interface
Basic operations:
Enter
: Submit questionTab
: Switch panel focusCtrl+C
: Exit programConversation flow:
This source code project is licensed under the MIT license.
ÂŠī¸ 2025 éąæŦåš Pardn Chiu