Purdy0228 commited on
Commit
1dc4b55
·
verified ·
1 Parent(s): 7d851a1

Upload ConvMemory v2 evidence reranker checkpoint (v0.5.0)

Browse files
MANIFEST.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "candidate_pool": "ConvMemory v1 top10 from dense MPNet top500",
3
+ "forbidden_inference_inputs": [
4
+ "gold",
5
+ "gold_ids",
6
+ "is_current",
7
+ "is_latest",
8
+ "is_stale",
9
+ "stale",
10
+ "answer",
11
+ "answer_text",
12
+ "ce_score",
13
+ "mxbai_score",
14
+ "teacher_score",
15
+ "gpt_label",
16
+ "entity_id",
17
+ "slot_id"
18
+ ],
19
+ "format": "convmemory_evidence_reranker",
20
+ "inference_inputs": [
21
+ "query text",
22
+ "candidate memory text",
23
+ "candidate id",
24
+ "optional position/time metadata"
25
+ ],
26
+ "seed": 7,
27
+ "source_experiment": "v361_top10_evidence_reranker.py",
28
+ "teacher_weight": 0.0,
29
+ "train_split": "LoCoMo dev split via choose_split(dev_ratio=0.5, seed=7)",
30
+ "training_target": "gold-only listwise retrieval CE",
31
+ "version": "0.5.0"
32
+ }
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: sentence-transformers
3
+ pipeline_tag: text-ranking
4
+ tags:
5
+ - convmemory
6
+ - reranking
7
+ - conversational-memory
8
+ - cross-encoder
9
+ - evidence-reranker
10
+ license: mit
11
+ ---
12
+
13
+ # ConvMemory v2 Evidence Reranker
14
+
15
+ This is the ConvMemory v0.5.0 protected top-10 token-evidence reranker checkpoint.
16
+ It is intended to be attached to the base ConvMemory LoCoMo/MPNet checkpoint:
17
+ `Purdy0228/ConvMemory-LoCoMo-MPNet`.
18
+
19
+ ## Usage
20
+
21
+ ```python
22
+ from convmemory import ConvMemory
23
+
24
+ model = ConvMemory.from_pretrained("Purdy0228/ConvMemory-LoCoMo-MPNet")
25
+ model.load_evidence_reranker("Purdy0228/ConvMemory-v2-Evidence-Reranker")
26
+
27
+ ranked = model.retrieve(
28
+ query=query,
29
+ memories=memories,
30
+ evidence_reranker="v2",
31
+ top_k=10,
32
+ )
33
+ ```
34
+
35
+ The repository layout is compatible with `convmemory.EvidenceReranker.from_pretrained`:
36
+
37
+ - `evidence_reranker_config.json`
38
+ - `MANIFEST.json`
39
+ - `cross_encoder/` SentenceTransformers CrossEncoder checkpoint
40
+
41
+ ## What It Does
42
+
43
+ ConvMemory v2 preserves the exact ConvMemory v1 top-10 candidate set and only
44
+ reorders that protected prefix using token-level query/memory evidence. It cannot
45
+ recover a gold memory that v1 failed to retrieve into top-10.
46
+
47
+ ## Training
48
+
49
+ - Source experiment: `experiments/v361_top10_evidence_reranker.py`
50
+ - Seed: 7
51
+ - Base model: `cross-encoder/ms-marco-MiniLM-L-6-v2`
52
+ - Training target: gold-only listwise retrieval cross-entropy
53
+ - Teacher weight: 0.0
54
+ - Candidate pool: ConvMemory v1 top-10 from dense MPNet top-500
55
+
56
+ ## Headline Evaluation
57
+
58
+ Canonical v361 5-seed headline, reported in the ConvMemory repository:
59
+
60
+ - ConvMemory v1 FULL MRR: 0.5824
61
+ - ConvMemory v2 FULL MRR: 0.6560
62
+ - Delta: +0.0734, paired bootstrap 95% CI [+0.0645, +0.0827]
63
+
64
+ The v364 load-bearing ablation retrained the same full-text arm in an ablation
65
+ harness and obtained FULL MRR 0.6677. Text perturbations collapsed:
66
+
67
+ - no memory text: 0.2966
68
+ - random other-query text: 0.2506
69
+ - shuffled memory text: 0.2731
70
+ - scalar only: 0.5792
71
+
72
+ ## Anti-Leak Discipline
73
+
74
+ The public inference API rejects gold-defining or post-hoc fields such as:
75
+ `gold`, `gold_ids`, `is_current`, `is_latest`, `is_stale`, `stale`, `answer`,
76
+ `answer_text`, `ce_score`, `mxbai_score`, `teacher_score`, `gpt_label`,
77
+ `entity_id`, and `slot_id`.
78
+
79
+ Inference inputs are query text, candidate id/text, optional candidate position
80
+ or time metadata, and the protected v1 top-10 candidate set.
81
+
82
+ ## Limitations
83
+
84
+ - LoCoMo-specific fine-tuning; validate or retrain before using cross-domain.
85
+ - Recall-preserving over v1 top-10, not a replacement for candidate generation.
86
+ - Not a full top-500 cross-encoder. It is a bounded precision stage after v1.
cross_encoder/README.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - cross-encoder
5
+ - reranker
6
+ pipeline_tag: text-ranking
7
+ library_name: sentence-transformers
8
+ ---
9
+
10
+ # CrossEncoder
11
+
12
+ This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model trained using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
13
+
14
+ ## Model Details
15
+
16
+ ### Model Description
17
+ - **Model Type:** Cross Encoder
18
+ <!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
19
+ - **Maximum Sequence Length:** 256 tokens
20
+ - **Number of Output Labels:** 1 label
21
+ - **Supported Modality:** Text
22
+ <!-- - **Training Dataset:** Unknown -->
23
+ <!-- - **Language:** Unknown -->
24
+ <!-- - **License:** Unknown -->
25
+
26
+ ### Model Sources
27
+
28
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
29
+ - **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
30
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
31
+ - **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
32
+
33
+ ### Full Model Architecture
34
+
35
+ ```
36
+ CrossEncoder(
37
+ (0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'BertForSequenceClassification'})
38
+ )
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ### Direct Usage (Sentence Transformers)
44
+
45
+ First install the Sentence Transformers library:
46
+
47
+ ```bash
48
+ pip install -U sentence-transformers
49
+ ```
50
+
51
+ Then you can load this model and run inference.
52
+ ```python
53
+ from sentence_transformers import CrossEncoder
54
+
55
+ # Download from the 🤗 Hub
56
+ model = CrossEncoder("cross_encoder_model_id")
57
+ # Get scores for pairs of inputs
58
+ pairs = [
59
+ ['How many calories in an egg', 'There are on average between 55 and 80 calories in an egg depending on its size.'],
60
+ ['How many calories in an egg', 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.'],
61
+ ['How many calories in an egg', 'Most of the calories in an egg come from the yellow yolk in the center.'],
62
+ ]
63
+ scores = model.predict(pairs)
64
+ print(scores)
65
+ # [ 9.8896 -2.073 0.0997]
66
+
67
+ # Or rank different texts based on similarity to a single text
68
+ ranks = model.rank(
69
+ 'How many calories in an egg',
70
+ [
71
+ 'There are on average between 55 and 80 calories in an egg depending on its size.',
72
+ 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.',
73
+ 'Most of the calories in an egg come from the yellow yolk in the center.',
74
+ ]
75
+ )
76
+ # [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
77
+ ```
78
+
79
+ <!--
80
+ ### Direct Usage (Transformers)
81
+
82
+ <details><summary>Click to see the direct usage in Transformers</summary>
83
+
84
+ </details>
85
+ -->
86
+
87
+ <!--
88
+ ### Downstream Usage (Sentence Transformers)
89
+
90
+ You can finetune this model on your own dataset.
91
+
92
+ <details><summary>Click to expand</summary>
93
+
94
+ </details>
95
+ -->
96
+
97
+ <!--
98
+ ### Out-of-Scope Use
99
+
100
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
101
+ -->
102
+
103
+ <!--
104
+ ## Bias, Risks and Limitations
105
+
106
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
107
+ -->
108
+
109
+ <!--
110
+ ### Recommendations
111
+
112
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
113
+ -->
114
+
115
+ ## Training Details
116
+
117
+ ### Framework Versions
118
+ - Python: 3.12.3
119
+ - Sentence Transformers: 5.4.1
120
+ - Transformers: 5.8.0
121
+ - PyTorch: 2.8.0+cu128
122
+ - Accelerate:
123
+ - Datasets: 4.8.5
124
+ - Tokenizers: 0.22.2
125
+
126
+ ## Citation
127
+
128
+ ### BibTeX
129
+
130
+ <!--
131
+ ## Glossary
132
+
133
+ *Clearly define terms in order to be accessible across audiences.*
134
+ -->
135
+
136
+ <!--
137
+ ## Model Card Authors
138
+
139
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
140
+ -->
141
+
142
+ <!--
143
+ ## Model Card Contact
144
+
145
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
146
+ -->
cross_encoder/config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": null,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": null,
11
+ "gradient_checkpointing": false,
12
+ "hidden_act": "gelu",
13
+ "hidden_dropout_prob": 0.1,
14
+ "hidden_size": 384,
15
+ "id2label": {
16
+ "0": "LABEL_0"
17
+ },
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 1536,
20
+ "is_decoder": false,
21
+ "label2id": {
22
+ "LABEL_0": 0
23
+ },
24
+ "layer_norm_eps": 1e-12,
25
+ "max_position_embeddings": 512,
26
+ "model_type": "bert",
27
+ "num_attention_heads": 12,
28
+ "num_hidden_layers": 6,
29
+ "pad_token_id": 0,
30
+ "position_embedding_type": "absolute",
31
+ "tie_word_embeddings": true,
32
+ "transformers_version": "5.8.0",
33
+ "type_vocab_size": 2,
34
+ "use_cache": true,
35
+ "vocab_size": 30522
36
+ }
cross_encoder/config_sentence_transformers.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.8.0+cu128",
4
+ "sentence_transformers": "5.4.1",
5
+ "transformers": "5.8.0"
6
+ },
7
+ "activation_fn": "torch.nn.modules.linear.Identity",
8
+ "default_prompt_name": null,
9
+ "model_type": "CrossEncoder",
10
+ "prompts": {}
11
+ }
cross_encoder/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1cd3bf011c49efd5681b40dfba4166a39c6be38520200c9f66d77a191e8b264
3
+ size 90866412
cross_encoder/modules.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ }
8
+ ]
cross_encoder/sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "sequence-classification",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "logits"
7
+ }
8
+ },
9
+ "module_output_name": "scores"
10
+ }
cross_encoder/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
cross_encoder/tokenizer_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "clean_up_tokenization_spaces": true,
4
+ "cls_token": "[CLS]",
5
+ "do_basic_tokenize": true,
6
+ "do_lower_case": true,
7
+ "is_local": true,
8
+ "local_files_only": false,
9
+ "mask_token": "[MASK]",
10
+ "model_max_length": 256,
11
+ "never_split": null,
12
+ "pad_token": "[PAD]",
13
+ "sep_token": "[SEP]",
14
+ "strip_accents": null,
15
+ "tokenize_chinese_chars": true,
16
+ "tokenizer_class": "BertTokenizer",
17
+ "unk_token": "[UNK]"
18
+ }
evidence_reranker_config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "cross_encoder_model": "cross-encoder/ms-marco-MiniLM-L-6-v2",
3
+ "max_length": 256,
4
+ "top_k": 10
5
+ }