dewmal commited on
Commit
795a5e6
·
verified ·
1 Parent(s): d4ceae0

Upload Concept Memory base model

Browse files
Files changed (1) hide show
  1. README.md +92 -64
README.md CHANGED
@@ -18,71 +18,94 @@ criteria-conditioned Choice, ordinal Score, and Yes/No (Noul) judgments. It is
18
  not a language model pretrained from scratch. Its text encoder is
19
  `sentence-transformers/all-mpnet-base-v2`.
20
 
21
- ## What the model does
22
-
23
- Concept Memory is a compact model for making typed judgments about a piece of
24
- text or other supplied state. You provide the state to assess, an instruction
25
- describing the judgment, and (for Choice and Score) the criteria to consider.
26
- The model encodes these inputs and returns a prediction with probabilities.
27
- It does not generate free-form answers.
28
-
29
- The three supported judgment types are:
30
-
31
- - **Choice:** select the best matching criterion, such as routing a support
32
- request to a team.
33
- - **Score:** estimate an ordinal position among the supplied criteria, from
34
- lowest to highest.
35
- - **Noul (Yes/No):** return a binary judgment for the instruction.
36
-
37
- ## Concept Memory and the Concept Bank
38
-
39
- Jev- or Laya-style typed decision systems return a structured judgment, such as
40
- a Choice label and its probabilities. Concept Memory can make that same kind of
41
- prediction and optionally add a **Concept Bank**: a separate, editable set of
42
- human-readable concepts with links to outcomes. For example, “integration
43
- failure” may support “Technical,” while “payment issue” may support “Billing.”
44
- This externalizes some domain knowledge from the model's learned weights so it
45
- can be inspected, reused, and adapted to different tasks or domains.
46
-
47
- With a bank, inference has two paths: the base model predicts an outcome, and a
48
- second Choice question ranks which bank concepts are relevant to the input.
49
- The bank maps those relevant concepts to outcome votes. In the current helper,
50
- the bank adjusts the probabilities only when its leading outcome agrees with
51
- the base model's leading outcome; the adjusted distribution is a blend of 20%
52
- raw model probabilities and 80% normalized bank votes. The bank therefore
53
- provides constrained decision support rather than an independent rule engine.
54
-
55
- Concept rankings and declared concept-to-outcome links make part of the
56
- decision process inspectable. They are not proof of the model's internal
57
- causal reasoning: relevance is a relative ranking, not calibrated evidence,
58
- and a ranked concept is not necessarily what caused the raw prediction.
59
-
60
- ## What this does and does not establish
61
-
62
- The Concept Bank offers a way to change or extend domain mappings without
63
- retraining the encoder, but new concepts still need evaluation on representative
64
- examples. This is an architectural capability, not evidence that Concept
65
- Memory is more accurate than Jev, Laya, or another model. Accuracy, calibration,
66
- robustness, and latency need head-to-head evaluation on the same data and
67
- conditions before making comparative performance claims.
68
-
69
- The current implementation ranks concepts with a second Choice question and
70
- uses an agreement gate. It does not independently detect each concept or let a
71
- bank vote overturn a raw prediction. Concept hierarchies, dependencies,
72
- contradictions, interventions, and provenance tracking are possible research
73
- directions, not capabilities of this checkpoint.
74
 
75
- ## Files
 
 
 
 
76
 
77
- - `model.pt`: PyTorch state dictionary and training metadata.
78
- - `config.json`: encoder, task, and training run metadata.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
- The Python inference implementation is not distributed in this model
81
- repository. The checkpoint is a PyTorch artifact and is not directly
82
- compatible with `transformers.AutoModel.from_pretrained`. For interactive
83
- inference, use the [Concept Memory playground](https://dewmal--concept-memory-playground-playground.modal.run/).
84
 
85
- ## Example Concept Bank entry
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  ```json
88
  {
@@ -94,9 +117,14 @@ inference, use the [Concept Memory playground](https://dewmal--concept-memory-pl
94
  }
95
  ```
96
 
97
- Concept entries describe reusable patterns and link them to outcome IDs or
98
- labels. Add entries to the playground's Concept Bank field to inspect which
99
- concepts rank as relevant and how their links contribute to a prediction.
 
 
 
 
 
100
 
101
  ## Training metadata
102
 
 
18
  not a language model pretrained from scratch. Its text encoder is
19
  `sentence-transformers/all-mpnet-base-v2`.
20
 
21
+ ## What is the problem?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ Typed decision models can return structured outputs such as a Choice label and
24
+ its probabilities. In a domain workflow, teams may also need to understand
25
+ which reusable ideas are relevant, apply domain knowledge consistently, and
26
+ adapt those mappings as policies change. A prediction by itself does not
27
+ provide those capabilities, and a probability is not an explanation.
28
 
29
+ Concept Memory is designed to explore this gap. It supports three judgment
30
+ types:
31
+
32
+ - **Choice:** select one criterion, such as a support team.
33
+ - **Score:** estimate an ordinal position among supplied criteria.
34
+ - **Noul (Yes/No):** return a binary judgment.
35
+
36
+ ## What is the solution?
37
+
38
+ ### Theory
39
+
40
+ Concept Memory pairs a learned language representation with an optional,
41
+ editable Concept Bank. A concept describes a reusable pattern, such as
42
+ “integration failure,” and can link that pattern to outcomes such as
43
+ “Technical.” This separates some domain knowledge from the model's learned
44
+ weights, making the definitions and mappings easier to inspect, reuse, and
45
+ adapt across tasks.
46
+
47
+ This is a different design emphasis from a decision-only interface: the model
48
+ still returns a typed prediction, while the bank offers an additional path for
49
+ relating relevant concepts to outcomes. This is a potential architectural
50
+ benefit, not evidence of higher accuracy than Jev, Laya, or another model.
51
+
52
+ ### Technical design
53
+
54
+ The base model first predicts from the input state, question instructions, and
55
+ criteria. When a Concept Bank is supplied, a second Choice question ranks the
56
+ bank's concepts by relevance. The bank maps those concept signals to outcome
57
+ votes. The current helper adjusts probabilities only when the bank's top
58
+ outcome agrees with the base model's top outcome; when it does, it blends 20%
59
+ raw model probabilities with 80% normalized bank votes. The bank is therefore
60
+ constrained decision support, not an independent rule engine, and it cannot
61
+ overturn the raw model's winner.
62
+
63
+ Concept rankings and declared mappings make part of the decision process
64
+ inspectable. They are not causal explanations: relevance is a relative ranking,
65
+ not calibrated evidence, and it does not prove what caused the raw prediction.
66
+ The current implementation also does not independently detect each concept.
67
+ Concept hierarchies, dependencies, interventions, and provenance tracking are
68
+ future research directions, not capabilities of this checkpoint.
69
+
70
+ This architecture allows domain mappings to be changed without retraining the
71
+ encoder, but new concepts must still be evaluated on representative examples.
72
+ Accuracy, calibration, robustness, and latency should be compared on the same
73
+ data and conditions before making performance claims.
74
+
75
+ ## How can you use it?
76
+
77
+ ### Run the standalone Choice example
78
 
79
+ The local [`artifacts/base_model/example.py`](./example.py) script:
 
 
 
80
 
81
+ 1. Downloads the `Syigen/rgcm` repository snapshot from Hugging Face.
82
+ 2. Loads `model.pt` and constructs the model using its saved encoder settings.
83
+ 3. Creates a Choice question with Billing, Technical, and Sales criteria.
84
+ 4. Predicts a category for a sample Stripe integration problem, then prints
85
+ the chosen criterion and probabilities.
86
+
87
+ From the project root, install the dependencies and run it:
88
+
89
+ ```bash
90
+ pip install torch transformers huggingface_hub
91
+ python artifacts/base_model/example.py
92
+ ```
93
+
94
+ The example demonstrates Choice. Score and Noul questions use the same typed
95
+ question interface with the appropriate `type` and criteria. The checkpoint is
96
+ a PyTorch artifact for this project's model class; it is not directly loadable
97
+ with `transformers.AutoModel.from_pretrained`.
98
+
99
+ ### Try the linked examples
100
+
101
+ - [Hugging Face `example.py`](https://huggingface.co/Syigen/rgcm/blob/main/example.py) is the hosted Python example file.
102
+ - [Open the Colab notebook](https://colab.research.google.com/drive/1LMLbdff8rAVxPy-qwcVI6iFROkjUk8EK?usp=sharing) to try the linked notebook.
103
+ - [Open the Concept Memory playground](https://dewmal--concept-memory-playground-playground.modal.run/) for interactive inference.
104
+
105
+ ### Add concepts
106
+
107
+ Concept Bank entries define a readable concept and the outcomes it supports or
108
+ contradicts. For example:
109
 
110
  ```json
111
  {
 
117
  }
118
  ```
119
 
120
+ Add concepts to the playground's Concept Bank field to see which ones rank as
121
+ relevant and how their links contribute to the decision.
122
+
123
+ ## Files
124
+
125
+ - `model.pt`: PyTorch state dictionary and training metadata.
126
+ - `config.json`: encoder, task, and training run metadata.
127
+ - `example.py`: standalone Python Choice example.
128
 
129
  ## Training metadata
130