Overview

This repository is an SFT checkpoint based on Qwen3-4B, fine-tuned for structured long-term memory extraction from user–assistant conversations. The model is configured to output valid JSON only.

Document structure

Section Description
Input Full prompt sent to the model at inference (task instruction + conversation to extract)
Output Expected JSON response from the model (do not include Markdown fences in production)

How the prompt is split into system / user depends on the chat template you use; the example below shows a single user-side text block, consistent with the training data format.


Input

Prompt (task instruction)


Task: Extract structured memories with long-term value from the input user-assistant conversation, and strictly output valid JSON.
Only output JSON. Do not output explanations, analysis, Markdown, or any extra text.

========================
Output Format
========================

{
  "memories": [
    {
      "source_id": 1,
      "content": "",
      "dimension": {
        "memory_type": "",
        "time": "",
        "location": "",
        "reason": "",
        "purpose": "",
        "keywords": []
      }
    }
  ]
}

========================
Extraction Targets
========================

Extract:
1. Factual information, identity/background, relationships, current status, tools, models, datasets, and project configurations;
2. Specific experiences, events, actions, behavioral records, stage progress, and future plans;
3. Long-term preferences, habits, interests, values, goals, abilities, interaction style, or writing style;
4. Information that helps understand the user's future needs or retrieve the user's background.

Do not extract:
1. Greetings, thanks, simple confirmations, or meaningless small talk;
2. Temporary formatting requirements, one-off operation instructions, or current-task details without long-term value.

========================
memory_type
========================

dimension.memory_type must be one of: fact, episodic, profile.

fact: stable facts, answering "what it is / what exists / what is used / what the relationship is / what the current status is".
Includes identity, background, relationships, status, tools, models, datasets, configurations, confirmed choices, and stable objective attributes.
Example: The user uses LLaMA2-7B as the base model.

episodic: specific events, answering "what happened / what someone did / what someone experienced / what someone plans to do".
Includes a specific event, experience, action, stage progress, future plan, or concrete fact with time/location/context.
Example: The user plans to train a local LLaMA2-7B model using Urdu data.

profile: long-term user profile, answering "what someone is like long-term / what someone likes / what someone usually does / what someone believes".
Includes preferences, habits, interests, values, long-term goals, abilities, style preferences, and stable behavior patterns.
Example: The user prefers concise Java code with a single main function.

Do not extract content that cannot be classified as fact, episodic, or profile.

========================
content Rules
========================

content is the main text of the memory and must be one complete, self-contained, retrievable sentence.

Requirements:
1. Clearly state who the memory is about and the core fact, event, or profile information.
2. If the source text contains time, location, reason, or purpose, include them in content when possible.
3. Remove ambiguous pronouns so that content does not depend on the original context.
4. Normalize relative time expressions based on the message timestamp, e.g., yesterday 鈫?a specific date.
5. Do not add unsupported information, and do not overgeneralize a single event into a long-term profile.

========================
dimension Rules
========================

dimension is used for structured retrieval. Except for memory_type, use "" when there is no clear evidence; use [] for keywords when there are no clear keywords.

time: the time when the memory is valid, happened, is planned to happen, or repeatedly occurs.
Use an absolute date if available. Normalize relative time if the message timestamp is available. Use "" if there is no time.
Do not use the current system time unless it is the message timestamp.

location: physical place, online platform, organizational context, home space, workplace, system environment, or activity venue.
Fill this only when the source text explicitly mentions or strongly implies it. Do not force ordinary topics into location.

reason: cause, motivation, trigger, or background condition.
Fill this only when the source text explicitly states or strongly implies it. Do not infer hidden motivations. Do not confuse it with purpose.

purpose: goal, intention, or expected outcome.
Fill this only when the source text explicitly states or strongly implies it. Do not infer unstated purposes.

keywords: key terms or phrases for retrieval, deduplication, and query-memory alignment.
Extract subjects, objects, tools, models, datasets, projects, people, locations, activities, results, preference objects, interest domains, etc.
Keywords must be short words or noun phrases. Do not include full sentences. Do not repeat keywords. Do not extract ordinary words without retrieval value.

========================
Extraction Rules
========================

1. Process messages in chronological order.
2. Extract memories mainly from user messages.
3. Each memory should be as atomic as possible. If a message is long or contains multiple independent information points, split it into multiple memories, preserving key details such as people, time, location, events, reasons, purposes, preferences, and objects separately. Avoid over-merging or omitting details.
4. The `content` field must be self-contained and must not rely on the original dialogue context.
5. The `time` field should be normalized based on the message timestamp: relative time expressions must be converted into absolute dates or time ranges. For example, if the message timestamp is `2023-05-08` and the original text says `yesterday`, then `time` should be `2023-05-07`.
6. Simple confirmations, temporary formatting requirements, and one-off tasks in the current conversation should generally not be extracted.
7. The output must be valid JSON. Do not output any text outside the JSON.



Here is the real input you need to process:

Conversation (immediately follows the prompt's "Here is the real input you need to process:")

[2023-04-23T08:57:00.500000, Sun] 2.User: interested in seeing a Broadway - style show in both cities. any musicals or theater productions I shouldn ' t miss in Paris or Rome
[2023-04-23T08:57:01, Sun] 3.User: For Paris, any historical sites or museums offer unique perspective on city ' s history like USS Arizona Memorial in Hawaii
[2023-04-23T08:57:01.500000, Sun] 4.User: interested in learning more about French Resistance during WWII you recommend any guided tours or museums in Paris focus on this period of history
[2023-04-23T08:57:02, Sun] 5.User: What some good restaurants in Paris serve traditional French cuisine with focus on seasonal ingredients cozy atmosphere
[2023-04-23T08:57:02.500000, Sun] 6.User: What about some wine to go with meal? recommend some wine bars or shops in Paris can find good selection of French wines
[2023-04-24T09:36:00, Mon] 7.User: daily wages for group 200 persons obtained from frequency distribution continuous variable X after substitution U = ( X - 130 ) / 20 U = ( X 130 ) / 20 - 2 - 1 0 1 2 No. persons 7 50 80 60 3 Calculate median, lower upper quartiles 3rd decile 98th percentile
[2023-04-27T13:38:00, Thu] 8.User: ' looking for inspiration for my next pasta dish been craving Italian food a lot lately recently tried a Spaghetti Carbonara at Bella Vita amazing. also been experimenting with different pasta recipes at home, like quick and easy dinner made last Thursday using fettuccine and arrabbiata sauce. any recommendations for other pasta dishes I could try
[2023-04-27T13:38:00.500000, Thu] 9.User: I think I ' ll try Spaghetti alla Bolognese ve always wanted to make meat - based pasta sauce from scratch. Can you give me simple recipe I can follow recommend good wine pairings for it
[2023-04-27T13:38:01, Thu] 10.User: excited to try this recipe out. never made a meat - based pasta sauce from scratch before bit curious to see how it turns out. have a question though - what type of ground beef you recommend using? seen different types at the store, like 80 / 20 or 70 / 30 lean to fat ratio. Does it make a big difference
[2023-04-27T13:38:01.500000, Thu] 11.User: That ' s really helpful, thanks! think ' ll go with 80 / 20 lean to fat ratio. been thinking about making garlic bread to go with my Spaghetti alla Bolognese. any tips on how to make good garlic bread
[2023-04-27T13:38:02, Thu] 12.User: That sounds great, thanks for tips! think ' ll try adding some Parmesan cheese to garlic butter mixture for extra burst of flavor. ll make sure to time it so it comes out of oven just as serving pasta. By way speaking of pasta, been thinking about trying to make my own pasta from scratch soon. have any tips or resources for a beginner like me
[2023-04-27T13:38:02.500000, Thu] 13.User: ' been thinking about making my own pasta from scratch soon
[2023-05-05T03:48:00, Fri] 14.User: ' m looking for some gift wrapping ideas. finished all my shopping feeling pretty organized relieved I got all my shopping done on time! have any simple and creative ways to wrap gifts for my family and friends
[2023-05-05T03:48:00.500000, Fri] 15.User: I like monochromatic idea. any suggestions for nice ribbon or bow would complement red and green color scheme?

Output

Example model response (in production the model should output valid JSON only, with no fences or surrounding text):

  "memories": [
    {
      "source_id": 1,
      "content": "The user is planning a trip to Europe in fall and is considering visiting Paris or Rome.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-09-01/2023-11-30",
        "location": "Europe",
        "reason": "",
        "purpose": "to visit Paris or Rome",
        "keywords": [
          "trip to Europe",
          "fall travel",
          "Paris",
          "Rome"
        ]
      }
    },
    {
      "source_id": 2,
      "content": "The user is interested in seeing Broadway-style shows in Paris and Rome and wants recommendations for musicals or theater productions not to miss.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "Paris and Rome",
        "reason": "",
        "purpose": "to see Broadway-style shows",
        "keywords": [
          "Broadway-style shows",
          "musicals",
          "theater productions",
          "Paris",
          "Rome"
        ]
      }
    },
    {
      "source_id": 4,
      "content": "The user is interested in learning more about the French Resistance during World War II and wants guided tours or museums in Paris that focus on that period of history.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "Paris",
        "reason": "",
        "purpose": "to learn about the French Resistance during World War II",
        "keywords": [
          "French Resistance",
          "World War II",
          "guided tours",
          "museums",
          "Paris"
        ]
      }
    },
    {
      "source_id": 5,
      "content": "The user wants recommendations for restaurants in Paris that serve traditional French cuisine with seasonal ingredients and a cozy atmosphere.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "Paris",
        "reason": "",
        "purpose": "to find a good restaurant",
        "keywords": [
          "restaurants",
          "traditional French cuisine",
          "seasonal ingredients",
          "cozy atmosphere",
          "Paris"
        ]
      }
    },
    {
      "source_id": 6,
      "content": "The user wants recommendations for wine bars or shops in Paris with a good selection of French wines to pair with meals.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "Paris",
        "reason": "",
        "purpose": "to find French wine pairings",
        "keywords": [
          "wine bars",
          "wine shops",
          "French wines",
          "meal pairing",
          "Paris"
        ]
      }
    },
    {
      "source_id": 8,
      "content": "The user has been craving Italian food lately and recently tried Spaghetti Carbonara at Bella Vita, which the user found amazing.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-27",
        "location": "Bella Vita",
        "reason": "",
        "purpose": "",
        "keywords": [
          "Italian food",
          "Spaghetti Carbonara",
          "Bella Vita"
        ]
      }
    },
    {
      "source_id": 8,
      "content": "The user has been experimenting with different pasta recipes at home, including a quick and easy dinner made on 2023-04-24 using fettuccine and arrabbiata sauce.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-24",
        "location": "home",
        "reason": "",
        "purpose": "to make quick and easy dinner",
        "keywords": [
          "pasta recipes",
          "fettuccine",
          "arrabbiata sauce",
          "home cooking"
        ]
      }
    },
    {
      "source_id": 9,
      "content": "The user plans to try Spaghetti alla Bolognese and wants a simple recipe to follow.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-27",
        "location": "",
        "reason": "",
        "purpose": "to make Spaghetti alla Bolognese",
        "keywords": [
          "Spaghetti alla Bolognese",
          "recipe"
        ]
      }
    },
    {
      "source_id": 9,
      "content": "The user has always wanted to make meat-based pasta sauce from scratch.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "",
        "reason": "",
        "purpose": "",
        "keywords": [
          "meat-based pasta sauce",
          "from scratch"
        ]
      }
    },
    {
      "source_id": 10,
      "content": "The user has never made a meat-based pasta sauce from scratch before and is curious about which type of ground beef to use.",
      "dimension": {
        "memory_type": "fact",
        "time": "2023-04-27",
        "location": "",
        "reason": "",
        "purpose": "to choose ground beef for meat-based pasta sauce",
        "keywords": [
          "meat-based pasta sauce",
          "ground beef",
          "80/20",
          "70/30"
        ]
      }
    },
    {
      "source_id": 11,
      "content": "The user plans to use an 80/20 lean-to-fat ratio for ground beef in the Spaghetti alla Bolognese recipe.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-27",
        "location": "",
        "reason": "",
        "purpose": "to make Spaghetti alla Bolognese",
        "keywords": [
          "80/20 ground beef",
          "Spaghetti alla Bolognese"
        ]
      }
    },
    {
      "source_id": 11,
      "content": "The user has been thinking about making garlic bread to go with Spaghetti alla Bolognese.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-27",
        "location": "",
        "reason": "",
        "purpose": "to serve with Spaghetti alla Bolognese",
        "keywords": [
          "garlic bread",
          "Spaghetti alla Bolognese"
        ]
      }
    },
    {
      "source_id": 12,
      "content": "The user plans to add Parmesan cheese to the garlic butter mixture for extra flavor and wants to make sure it comes out of the oven just as the pasta is served.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-27",
        "location": "",
        "reason": "",
        "purpose": "to enhance garlic bread flavor and timing",
        "keywords": [
          "Parmesan cheese",
          "garlic butter",
          "garlic bread",
          "timing"
        ]
      }
    },
    {
      "source_id": 12,
      "content": "The user has been thinking about making homemade pasta from scratch soon.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-04-27",
        "location": "",
        "reason": "",
        "purpose": "to make homemade pasta",
        "keywords": [
          "homemade pasta",
          "from scratch"
        ]
      }
    },
    {
      "source_id": 14,
      "content": "The user finished shopping on time and felt organized and relieved.",
      "dimension": {
        "memory_type": "episodic",
        "time": "2023-05-05",
        "location": "",
        "reason": "",
        "purpose": "",
        "keywords": [
          "shopping",
          "organized",
          "relieved"
        ]
      }
    },
    {
      "source_id": 14,
      "content": "The user wants simple and creative gift-wrapping ideas for family and friends.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "",
        "reason": "",
        "purpose": "to wrap gifts for family and friends",
        "keywords": [
          "gift wrapping",
          "family",
          "friends"
        ]
      }
    },
    {
      "source_id": 15,
      "content": "The user likes the monochromatic gift-wrapping idea and wants suggestions for ribbons or bows that complement a red and green color scheme.",
      "dimension": {
        "memory_type": "profile",
        "time": "",
        "location": "",
        "reason": "",
        "purpose": "to choose gift-wrapping accessories",
        "keywords": [
          "monochromatic wrapping",
          "ribbons",
          "bows",
          "red and green"
        ]
      }
    }
  ]
}
Downloads last month
45
Safetensors
Model size
4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for wtqiu/DimMem-4B-Longmemeval

Finetuned
Qwen/Qwen3-4B
Finetuned
(706)
this model