Text Classification
Transformers
Safetensors
Laya
English
system-one
calibrated-decisions
logical-fallacy
debate
modernbert
Instructions to use BryanSnappCTO/laya-fallacies with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BryanSnappCTO/laya-fallacies with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="BryanSnappCTO/laya-fallacies")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BryanSnappCTO/laya-fallacies", device_map="auto") - Laya
How to use BryanSnappCTO/laya-fallacies with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- LICENSE +192 -0
- README.md +178 -0
- encoder/config.json +84 -0
- model.safetensors +3 -0
- rl_agent_config.json +28 -0
- rl_common.py +2 -0
- tokenizer/tokenizer.json +0 -0
- tokenizer/tokenizer_config.json +15 -0
- train_report.json +82 -0
LICENSE
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License Version 2.0, January 2004
|
| 2 |
+
http://www.apache.org/licenses/
|
| 3 |
+
|
| 4 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 5 |
+
|
| 6 |
+
1. Definitions.
|
| 7 |
+
|
| 8 |
+
"License" shall mean the terms and conditions for use, reproduction, and
|
| 9 |
+
distribution as defined by Sections 1 through 9 of this document.
|
| 10 |
+
|
| 11 |
+
"Licensor" shall mean the copyright owner or entity authorized by the
|
| 12 |
+
copyright owner that is granting the License.
|
| 13 |
+
|
| 14 |
+
"Legal Entity" shall mean the union of the acting entity and all other
|
| 15 |
+
entities that control, are controlled by, or are under common control with
|
| 16 |
+
that entity. For the purposes of this definition, "control" means (i) the
|
| 17 |
+
power, direct or indirect, to cause the direction or management of such
|
| 18 |
+
entity, whether by contract or otherwise, or (ii) ownership of fifty
|
| 19 |
+
percent (50%) or more of the outstanding shares, or (iii) beneficial
|
| 20 |
+
ownership of such entity.
|
| 21 |
+
|
| 22 |
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
| 23 |
+
permissions granted by this License.
|
| 24 |
+
|
| 25 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 26 |
+
including but not limited to software source code, documentation source,
|
| 27 |
+
and configuration files.
|
| 28 |
+
|
| 29 |
+
"Object" form shall mean any form resulting from mechanical transformation
|
| 30 |
+
or translation of a Source form, including but not limited to compiled
|
| 31 |
+
object code, generated documentation, and conversions to other media
|
| 32 |
+
types.
|
| 33 |
+
|
| 34 |
+
"Work" shall mean the work of authorship, whether in Source or Object
|
| 35 |
+
form, made available under the License, as indicated by a copyright notice
|
| 36 |
+
that is included in or attached to the work (an example is provided in the
|
| 37 |
+
Appendix below).
|
| 38 |
+
|
| 39 |
+
"Derivative Works" shall mean any work, whether in Source or Object form,
|
| 40 |
+
that is based on (or derived from) the Work and for which the editorial
|
| 41 |
+
revisions, annotations, elaborations, or other modifications represent, as
|
| 42 |
+
a whole, an original work of authorship. For the purposes of this License,
|
| 43 |
+
Derivative Works shall not include works that remain separable from, or
|
| 44 |
+
merely link (or bind by name) to the interfaces of, the Work and
|
| 45 |
+
Derivative Works thereof.
|
| 46 |
+
|
| 47 |
+
"Contribution" shall mean any work of authorship, including the original
|
| 48 |
+
version of the Work and any modifications or additions to that Work or
|
| 49 |
+
Derivative Works thereof, that is intentionally submitted to Licensor for
|
| 50 |
+
inclusion in the Work by the copyright owner or by an individual or Legal
|
| 51 |
+
Entity authorized to submit on behalf of the copyright owner. For the
|
| 52 |
+
purposes of this definition, "submitted" means any form of electronic,
|
| 53 |
+
verbal, or written communication sent to the Licensor or its
|
| 54 |
+
representatives, including but not limited to communication on electronic
|
| 55 |
+
mailing lists, source code control systems, and issue tracking systems
|
| 56 |
+
that are managed by, or on behalf of, the Licensor for the purpose of
|
| 57 |
+
discussing and improving the Work, but excluding communication that is
|
| 58 |
+
conspicuously marked or otherwise designated in writing by the copyright
|
| 59 |
+
owner as "Not a Contribution."
|
| 60 |
+
|
| 61 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity on
|
| 62 |
+
behalf of whom a Contribution has been received by Licensor and
|
| 63 |
+
subsequently incorporated within the Work.
|
| 64 |
+
|
| 65 |
+
2. Grant of Copyright License. Subject to the terms and conditions of this
|
| 66 |
+
License, each Contributor hereby grants to You a perpetual, worldwide,
|
| 67 |
+
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
| 68 |
+
reproduce, prepare Derivative Works of, publicly display, publicly
|
| 69 |
+
perform, sublicense, and distribute the Work and such Derivative Works in
|
| 70 |
+
Source or Object form.
|
| 71 |
+
|
| 72 |
+
3. Grant of Patent License. Subject to the terms and conditions of this
|
| 73 |
+
License, each Contributor hereby grants to You a perpetual, worldwide,
|
| 74 |
+
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
|
| 75 |
+
this section) patent license to make, have made, use, offer to sell, sell,
|
| 76 |
+
import, and otherwise transfer the Work, where such license applies only
|
| 77 |
+
to those patent claims licensable by such Contributor that are necessarily
|
| 78 |
+
infringed by their Contribution(s) alone or by combination of their
|
| 79 |
+
Contribution(s) with the Work to which such Contribution(s) was submitted.
|
| 80 |
+
If You institute patent litigation against any entity (including a
|
| 81 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
| 82 |
+
Contribution incorporated within the Work constitutes direct or
|
| 83 |
+
contributory patent infringement, then any patent licenses granted to You
|
| 84 |
+
under this License for that Work shall terminate as of the date such
|
| 85 |
+
litigation is filed.
|
| 86 |
+
|
| 87 |
+
4. Redistribution. You may reproduce and distribute copies of the Work or
|
| 88 |
+
Derivative Works thereof in any medium, with or without modifications, and
|
| 89 |
+
in Source or Object form, provided that You meet the following conditions:
|
| 90 |
+
|
| 91 |
+
(a) You must give any other recipients of the Work or Derivative Works a
|
| 92 |
+
copy of this License; and
|
| 93 |
+
|
| 94 |
+
(b) You must cause any modified files to carry prominent notices stating
|
| 95 |
+
that You changed the files; and
|
| 96 |
+
|
| 97 |
+
(c) You must retain, in the Source form of any Derivative Works that You
|
| 98 |
+
distribute, all copyright, patent, trademark, and attribution notices from
|
| 99 |
+
the Source form of the Work, excluding those notices that do not pertain
|
| 100 |
+
to any part of the Derivative Works; and
|
| 101 |
+
|
| 102 |
+
(d) If the Work includes a "NOTICE" text file as part of its distribution,
|
| 103 |
+
then any Derivative Works that You distribute must include a readable copy
|
| 104 |
+
of the attribution notices contained within such NOTICE file, excluding
|
| 105 |
+
those notices that do not pertain to any part of the Derivative Works, in
|
| 106 |
+
at least one of the following places: within a NOTICE text file
|
| 107 |
+
distributed as part of the Derivative Works; within the Source form or
|
| 108 |
+
documentation, if provided along with the Derivative Works; or, within a
|
| 109 |
+
display generated by the Derivative Works, if and wherever such
|
| 110 |
+
third-party notices normally appear. The contents of the NOTICE file are
|
| 111 |
+
for informational purposes only and do not modify the License. You may add
|
| 112 |
+
Your own attribution notices within Derivative Works that You distribute,
|
| 113 |
+
alongside or as an addendum to the NOTICE text from the Work, provided
|
| 114 |
+
that such additional attribution notices cannot be construed as modifying
|
| 115 |
+
the License.
|
| 116 |
+
|
| 117 |
+
You may add Your own copyright statement to Your modifications and may
|
| 118 |
+
provide additional or different license terms and conditions for use,
|
| 119 |
+
reproduction, or distribution of Your modifications, or for any such
|
| 120 |
+
Derivative Works as a whole, provided Your use, reproduction, and
|
| 121 |
+
distribution of the Work otherwise complies with the conditions stated in
|
| 122 |
+
this License.
|
| 123 |
+
|
| 124 |
+
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
| 125 |
+
Contribution intentionally submitted for inclusion in the Work by You to
|
| 126 |
+
the Licensor shall be under the terms and conditions of this License,
|
| 127 |
+
without any additional terms or conditions. Notwithstanding the above,
|
| 128 |
+
nothing herein shall supersede or modify the terms of any separate license
|
| 129 |
+
agreement you may have executed with Licensor regarding such
|
| 130 |
+
Contributions.
|
| 131 |
+
|
| 132 |
+
6. Trademarks. This License does not grant permission to use the trade names,
|
| 133 |
+
trademarks, service marks, or product names of the Licensor, except as
|
| 134 |
+
required for reasonable and customary use in describing the origin of the
|
| 135 |
+
Work and reproducing the content of the NOTICE file.
|
| 136 |
+
|
| 137 |
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
|
| 138 |
+
writing, Licensor provides the Work (and each Contributor provides its
|
| 139 |
+
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
| 140 |
+
ANY KIND, either express or implied, including, without limitation, any
|
| 141 |
+
warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
|
| 142 |
+
FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
|
| 143 |
+
determining the appropriateness of using or redistributing the Work and
|
| 144 |
+
assume any risks associated with Your exercise of permissions under this
|
| 145 |
+
License.
|
| 146 |
+
|
| 147 |
+
8. Limitation of Liability. In no event and under no legal theory, whether in
|
| 148 |
+
tort (including negligence), contract, or otherwise, unless required by
|
| 149 |
+
applicable law (such as deliberate and grossly negligent acts) or agreed
|
| 150 |
+
to in writing, shall any Contributor be liable to You for damages,
|
| 151 |
+
including any direct, indirect, special, incidental, or consequential
|
| 152 |
+
damages of any character arising as a result of this License or out of the
|
| 153 |
+
use or inability to use the Work (including but not limited to damages for
|
| 154 |
+
loss of goodwill, work stoppage, computer failure or malfunction, or any
|
| 155 |
+
and all other commercial damages or losses), even if such Contributor has
|
| 156 |
+
been advised of the possibility of such damages.
|
| 157 |
+
|
| 158 |
+
9. Accepting Warranty or Additional Liability. While redistributing the Work
|
| 159 |
+
or Derivative Works thereof, You may choose to offer, and charge a fee
|
| 160 |
+
for, acceptance of support, warranty, indemnity, or other liability
|
| 161 |
+
obligations and/or rights consistent with this License. However, in
|
| 162 |
+
accepting such obligations, You may act only on Your own behalf and on
|
| 163 |
+
Your sole responsibility, not on behalf of any other Contributor, and only
|
| 164 |
+
if You agree to indemnify, defend, and hold each Contributor harmless for
|
| 165 |
+
any liability incurred by, or claims asserted against, such Contributor by
|
| 166 |
+
reason of your accepting any such warranty or additional liability.
|
| 167 |
+
|
| 168 |
+
END OF TERMS AND CONDITIONS
|
| 169 |
+
|
| 170 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 171 |
+
|
| 172 |
+
To apply the Apache License to your work, attach the following boilerplate
|
| 173 |
+
notice, with the fields enclosed by brackets "[]" replaced with your own
|
| 174 |
+
identifying information. (Don't include the brackets!) The text should be
|
| 175 |
+
enclosed in the appropriate comment syntax for the file format. We also
|
| 176 |
+
recommend that a file or class name and description of purpose be included
|
| 177 |
+
on the same "printed page" as the copyright notice for easier
|
| 178 |
+
identification within third-party archives.
|
| 179 |
+
|
| 180 |
+
Copyright 2026 Pax Agentica
|
| 181 |
+
|
| 182 |
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
| 183 |
+
use this file except in compliance with the License. You may obtain a copy of
|
| 184 |
+
the License at
|
| 185 |
+
|
| 186 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 187 |
+
|
| 188 |
+
Unless required by applicable law or agreed to in writing, software
|
| 189 |
+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
| 190 |
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
| 191 |
+
License for the specific language governing permissions and limitations under
|
| 192 |
+
the License.
|
README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: convaiinnovations/laya
|
| 4 |
+
library_name: transformers
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
pipeline_tag: text-classification
|
| 8 |
+
tags:
|
| 9 |
+
- laya
|
| 10 |
+
- system-one
|
| 11 |
+
- calibrated-decisions
|
| 12 |
+
- logical-fallacy
|
| 13 |
+
- debate
|
| 14 |
+
- modernbert
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# laya-fallacies
|
| 18 |
+
|
| 19 |
+
A fine-tune of **[Laya](https://huggingface.co/convaiinnovations/laya)** that
|
| 20 |
+
labels a debate statement with the logical fallacy it commits, or `none`. It is
|
| 21 |
+
the model behind the fallacy debate detector in [`@receptron/laya`](https://github.com/receptron/laya)
|
| 22 |
+
(`examples/debate.ts`).
|
| 23 |
+
|
| 24 |
+
Laya is a non-autoregressive System 1 decision model: it does not generate text.
|
| 25 |
+
You hand it a state and a `choice` question whose options are the taxonomy
|
| 26 |
+
below, and it returns one probability per option in a single forward pass.
|
| 27 |
+
|
| 28 |
+
## Taxonomy
|
| 29 |
+
|
| 30 |
+
The 14 options are `none` plus the 13 fallacy classes of the training data:
|
| 31 |
+
|
| 32 |
+
| Label | Meaning |
|
| 33 |
+
| --- | --- |
|
| 34 |
+
| `none` | no logical fallacy |
|
| 35 |
+
| `ad_hominem` | attacking the opponent instead of their argument |
|
| 36 |
+
| `ad_populum` | appealing to popularity instead of the merits |
|
| 37 |
+
| `appeal_to_emotion` | manipulating emotion instead of engaging with the argument |
|
| 38 |
+
| `circular_reasoning` | assuming the conclusion in the premises |
|
| 39 |
+
| `equivocation` | using a word in two different senses |
|
| 40 |
+
| `fallacy_of_credibility` | leaning on the source's credibility instead of evidence |
|
| 41 |
+
| `fallacy_of_extension` | stretching the opponent's claim beyond what it says |
|
| 42 |
+
| `fallacy_of_logic` | the reasoning structure itself is invalid |
|
| 43 |
+
| `fallacy_of_relevance` | diverting to an issue that is irrelevant |
|
| 44 |
+
| `false_causality` | assuming causation from correlation |
|
| 45 |
+
| `false_dilemma` | presenting only two options when others exist |
|
| 46 |
+
| `faulty_generalization` | concluding from too little evidence |
|
| 47 |
+
| `intentional` | rejecting the argument because of the opponent's intent |
|
| 48 |
+
|
| 49 |
+
The taxonomy is defined at request time, so the option set can be changed
|
| 50 |
+
without retraining, as long as it stays within the model's option budget.
|
| 51 |
+
|
| 52 |
+
## Usage
|
| 53 |
+
|
| 54 |
+
The package this checkpoint was built for runs the model through ONNX. Export
|
| 55 |
+
the bundle first, then load it:
|
| 56 |
+
|
| 57 |
+
```sh
|
| 58 |
+
export/.venv/bin/python export/export_onnx.py ./laya-fallacies ./onnx-fallacies
|
| 59 |
+
LAYA_MODEL_DIR=./onnx-fallacies bun examples/debate.ts
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
```ts
|
| 63 |
+
import { Laya } from "@receptron/laya";
|
| 64 |
+
|
| 65 |
+
const laya = await Laya.load({ modelDir: "./onnx-fallacies" });
|
| 66 |
+
|
| 67 |
+
const result = await laya.systemOne(
|
| 68 |
+
{ statement: "You only believe that because you work for the company." },
|
| 69 |
+
{
|
| 70 |
+
fallacy: {
|
| 71 |
+
type: "choice",
|
| 72 |
+
instructions: "which logical fallacy, if any, does this statement commit?",
|
| 73 |
+
criteria: FALLACY_TAXONOMY,
|
| 74 |
+
},
|
| 75 |
+
},
|
| 76 |
+
);
|
| 77 |
+
|
| 78 |
+
result.answers.fallacy.choice; // "ad_hominem"
|
| 79 |
+
result.answers.fallacy.probabilities; // one value per label
|
| 80 |
+
|
| 81 |
+
await laya.close();
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
The forward pass runs on CPU; the ONNX bundle is fp32 and about 1.7 GB.
|
| 85 |
+
|
| 86 |
+
## Training
|
| 87 |
+
|
| 88 |
+
`scripts/finetune.py` produced this checkpoint. It is a single-device port
|
| 89 |
+
(Apple MPS, no DDP) of the upstream 2xT4 RLCD notebook: policy gradient against
|
| 90 |
+
a strictly proper scoring rule (GRPO-style group-mean baseline), with soft
|
| 91 |
+
cross-entropy guidance and post-training temperature fitting.
|
| 92 |
+
|
| 93 |
+
| | |
|
| 94 |
+
| --- | --- |
|
| 95 |
+
| base checkpoint | `convaiinnovations/laya@1c5edc17a7acd8701df6fc341c0d179f1c62c982` |
|
| 96 |
+
| encoder | `answerdotai/ModernBERT-large` (inherited from the base checkpoint) |
|
| 97 |
+
| dataset | `tasksource/logical-fallacy@37e9b0537a86e72e9eaf6ee8c9a27d872a944103` (the LOGIC dataset) |
|
| 98 |
+
| extra rows | `scripts/negatives.jsonl` (30 sound statements labelled `none`) |
|
| 99 |
+
| epochs | 4, AdamW with `lr_encoder 2.5e-5`, `lr_head 1e-4`, cosine decay to `1e-6` |
|
| 100 |
+
| `laya` package | `0.3.5` — supplies `build_model`, `build_sequence`, `render_options`, `proper_reward` |
|
| 101 |
+
|
| 102 |
+
The 2710 labelled sequences split with a fixed seed into 2196 train / 243
|
| 103 |
+
validation / 271 calibration rows, so the split is reproducible.
|
| 104 |
+
`scripts/train_report_base_run.json` records the same 2196/243 from an earlier
|
| 105 |
+
run of this recipe, and this re-run reproduces its test accuracy to within 2
|
| 106 |
+
items out of 511.
|
| 107 |
+
|
| 108 |
+
A second stage was tried and discarded. One further epoch resumed from this
|
| 109 |
+
model with the 136 hand-written rows in `scripts/curated.jsonl` added, at a
|
| 110 |
+
gentler learning rate (`5e-6` encoder / `1e-5` head), scored **0.4990** on the
|
| 111 |
+
test split — 0.6 points below this model and inside noise. An earlier attempt at
|
| 112 |
+
the same stage with a larger learning rate (`1e-5`/`5e-5`) over 3 epochs scored
|
| 113 |
+
**0.4618**, a 4.3-point regression. Neither earned its place, so the curated
|
| 114 |
+
rows are not part of the published weights.
|
| 115 |
+
|
| 116 |
+
## Evaluation
|
| 117 |
+
|
| 118 |
+
Measured on this checkpoint, after temperature fitting:
|
| 119 |
+
|
| 120 |
+
| split | items | accuracy | mean argmax confidence |
|
| 121 |
+
| --- | --- | --- | --- |
|
| 122 |
+
| validation, held out from the LOGIC train split | 243 | 0.6543 | 0.780 |
|
| 123 |
+
| test, the LOGIC `test` split | 511 | 0.5049 | 0.649 |
|
| 124 |
+
|
| 125 |
+
The fitted per-type temperatures are `[1.8769, 1.2, 1.2]`. Only the `choice`
|
| 126 |
+
entry is meaningful: the taxonomy is a single `choice` question, so the `score`
|
| 127 |
+
and `noul` calibration slices are empty and those two entries keep the script's
|
| 128 |
+
`1.2` initialisation default.
|
| 129 |
+
|
| 130 |
+
Note the 15-point gap between the two rows. Validation is drawn from the same
|
| 131 |
+
pool as training; the test split is not. Expect the test figure on unfamiliar
|
| 132 |
+
text.
|
| 133 |
+
|
| 134 |
+
`train_report.json` in this repository is the raw output of the run.
|
| 135 |
+
|
| 136 |
+
## Known limitations
|
| 137 |
+
|
| 138 |
+
1. **The training data's licence is not clearly stated** on the Hub.
|
| 139 |
+
`tasksource/logical-fallacy` lists it as `unknown`; treat the training mix as
|
| 140 |
+
research-only.
|
| 141 |
+
2. **Accuracy is 0.5049 on the LOGIC test split.** This is a task-specific
|
| 142 |
+
fine-tune, not a general fallacy detector; validate it on your own data.
|
| 143 |
+
3. **The test split was used to select between candidates**, so 0.5049 is a
|
| 144 |
+
mildly optimistic estimate rather than a clean held-out number.
|
| 145 |
+
4. **Context-dependent fallacies are the main error mode.** Each debate turn is
|
| 146 |
+
judged in isolation, so fallacies that need the previous turn (straw man,
|
| 147 |
+
`fallacy_of_extension`) are the weakest.
|
| 148 |
+
5. **`ad_hominem` is only recognised when the attack is overt.** A
|
| 149 |
+
circumstantial attack ("she says that because her family sells them") tends
|
| 150 |
+
to land on the authority or popularity classes.
|
| 151 |
+
6. **English only.** The base English checkpoint collapses on non-Latin scripts.
|
| 152 |
+
7. **Fewer than about 20 options** is Laya's own recommendation;
|
| 153 |
+
high-cardinality option sets degrade sharply because options share a fixed
|
| 154 |
+
token budget.
|
| 155 |
+
8. **`rl_agent_config.json`'s `training` block is inherited**, not written by
|
| 156 |
+
this fine-tune. `finetune.py` passes the base checkpoint's `training` record
|
| 157 |
+
through unchanged, so its `epochs_completed` and `hours` describe Convai's
|
| 158 |
+
pretraining rather than this run.
|
| 159 |
+
|
| 160 |
+
## Attribution and licence
|
| 161 |
+
|
| 162 |
+
This repository is licensed **Apache-2.0**. It is a derivative of two Apache-2.0
|
| 163 |
+
works, and redistributes both:
|
| 164 |
+
|
| 165 |
+
1. **[Laya](https://huggingface.co/convaiinnovations/laya)** — Convai
|
| 166 |
+
Innovations, Apache-2.0. The base checkpoint, including the decision head and
|
| 167 |
+
`rl_common.py`.
|
| 168 |
+
2. **[ModernBERT-large](https://huggingface.co/answerdotai/ModernBERT-large)** —
|
| 169 |
+
Answer.AI and LightOn, Apache-2.0. The encoder weights inside the base
|
| 170 |
+
checkpoint.
|
| 171 |
+
|
| 172 |
+
`laya-fallacies` is an unofficial derivative and is not endorsed by either
|
| 173 |
+
project. "Laya" is the name of the upstream model; no trademark rights are
|
| 174 |
+
granted by the Apache-2.0 licence.
|
| 175 |
+
|
| 176 |
+
The fine-tuning pipeline in [`@receptron/laya`](https://github.com/receptron/laya)
|
| 177 |
+
is itself a port of the upstream [fine-tuning notebook](https://github.com/NandhaKishorM/laya/blob/main/notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb)
|
| 178 |
+
(Apache-2.0). See the accompanying `LICENSE` file for the full licence text.
|
encoder/config.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"ModernBertForMaskedLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 50281,
|
| 8 |
+
"classifier_activation": "gelu",
|
| 9 |
+
"classifier_bias": false,
|
| 10 |
+
"classifier_dropout": 0.0,
|
| 11 |
+
"classifier_pooling": "mean",
|
| 12 |
+
"cls_token_id": 50281,
|
| 13 |
+
"decoder_bias": true,
|
| 14 |
+
"deterministic_flash_attn": false,
|
| 15 |
+
"dtype": "float32",
|
| 16 |
+
"embedding_dropout": 0.0,
|
| 17 |
+
"eos_token_id": 50282,
|
| 18 |
+
"global_attn_every_n_layers": 3,
|
| 19 |
+
"gradient_checkpointing": false,
|
| 20 |
+
"hidden_activation": "gelu",
|
| 21 |
+
"hidden_size": 1024,
|
| 22 |
+
"initializer_cutoff_factor": 2.0,
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 2624,
|
| 25 |
+
"layer_norm_eps": 1e-05,
|
| 26 |
+
"layer_types": [
|
| 27 |
+
"full_attention",
|
| 28 |
+
"sliding_attention",
|
| 29 |
+
"sliding_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"sliding_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"sliding_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"full_attention"
|
| 55 |
+
],
|
| 56 |
+
"local_attention": 128,
|
| 57 |
+
"max_position_embeddings": 8192,
|
| 58 |
+
"mlp_bias": false,
|
| 59 |
+
"mlp_dropout": 0.0,
|
| 60 |
+
"model_type": "modernbert",
|
| 61 |
+
"norm_bias": false,
|
| 62 |
+
"norm_eps": 1e-05,
|
| 63 |
+
"num_attention_heads": 16,
|
| 64 |
+
"num_hidden_layers": 28,
|
| 65 |
+
"pad_token_id": 50283,
|
| 66 |
+
"position_embedding_type": "absolute",
|
| 67 |
+
"repad_logits_with_grad": false,
|
| 68 |
+
"rope_parameters": {
|
| 69 |
+
"full_attention": {
|
| 70 |
+
"rope_theta": 160000.0,
|
| 71 |
+
"rope_type": "default"
|
| 72 |
+
},
|
| 73 |
+
"sliding_attention": {
|
| 74 |
+
"rope_theta": 10000.0,
|
| 75 |
+
"rope_type": "default"
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
"sep_token_id": 50282,
|
| 79 |
+
"sparse_pred_ignore_index": -100,
|
| 80 |
+
"sparse_prediction": false,
|
| 81 |
+
"tie_word_embeddings": true,
|
| 82 |
+
"transformers_version": "5.17.0",
|
| 83 |
+
"vocab_size": 50368
|
| 84 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:72274434a12c6cc9812874b18670d5c0e7fb1f26871462d7e712ac8be02ea2a4
|
| 3 |
+
size 1685197088
|
rl_agent_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"encoder": "answerdotai/ModernBERT-large",
|
| 3 |
+
"head_layers": 2,
|
| 4 |
+
"max_len": 1024,
|
| 5 |
+
"head_max_len": 256,
|
| 6 |
+
"max_prefixes": 6,
|
| 7 |
+
"act_costs": {
|
| 8 |
+
"escalate": 0.5
|
| 9 |
+
},
|
| 10 |
+
"cost_wrong_act": 3.0,
|
| 11 |
+
"amp_dtype": "bf16",
|
| 12 |
+
"model_name": "laya-fallacies",
|
| 13 |
+
"temperature": [
|
| 14 |
+
1.876949429512024,
|
| 15 |
+
1.2,
|
| 16 |
+
1.2
|
| 17 |
+
],
|
| 18 |
+
"training": {
|
| 19 |
+
"updates": 7313,
|
| 20 |
+
"epochs_completed": 1,
|
| 21 |
+
"hours": 1.96,
|
| 22 |
+
"world_size": 1,
|
| 23 |
+
"fine_tuned_from_checkpoint": true
|
| 24 |
+
},
|
| 25 |
+
"gradient_checkpointing": true,
|
| 26 |
+
"max_tokens_per_batch": 4096,
|
| 27 |
+
"fine_tuned": true
|
| 28 |
+
}
|
rl_common.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# shim so export/export_onnx.py can import build_model from rl_common
|
| 2 |
+
from laya.common import * # noqa: F401,F403
|
tokenizer/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer/tokenizer_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"clean_up_tokenization_spaces": true,
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"local_files_only": false,
|
| 5 |
+
"mask_token": "[MASK]",
|
| 6 |
+
"model_input_names": [
|
| 7 |
+
"input_ids",
|
| 8 |
+
"attention_mask"
|
| 9 |
+
],
|
| 10 |
+
"model_max_length": 8192,
|
| 11 |
+
"pad_token": "[PAD]",
|
| 12 |
+
"sep_token": "[SEP]",
|
| 13 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 14 |
+
"unk_token": "[UNK]"
|
| 15 |
+
}
|
train_report.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"args": {
|
| 3 |
+
"task_file": "scripts/fallacies.json",
|
| 4 |
+
"dataset": null,
|
| 5 |
+
"dataset_revision": null,
|
| 6 |
+
"split": "train",
|
| 7 |
+
"text_column": null,
|
| 8 |
+
"label_column": null,
|
| 9 |
+
"model_dir": null,
|
| 10 |
+
"base_revision": "1c5edc17a7acd8701df6fc341c0d179f1c62c982",
|
| 11 |
+
"output_dir": "./tmp/stage1",
|
| 12 |
+
"device": "auto",
|
| 13 |
+
"amp": false,
|
| 14 |
+
"epochs": 4,
|
| 15 |
+
"micro_batch": 8,
|
| 16 |
+
"grad_accum": 4,
|
| 17 |
+
"group_size": 4,
|
| 18 |
+
"lr_encoder": 2.5e-05,
|
| 19 |
+
"lr_head": 0.0001,
|
| 20 |
+
"weight_decay": 0.01,
|
| 21 |
+
"sigma_start": 0.4,
|
| 22 |
+
"sigma_end": 0.1,
|
| 23 |
+
"seed": 42,
|
| 24 |
+
"max_items": 0,
|
| 25 |
+
"calib_max": 400,
|
| 26 |
+
"val_frac": 0.1,
|
| 27 |
+
"negative_file": "/Users/brian/git/receptron/laya/scripts/negatives.jsonl",
|
| 28 |
+
"extra_file": "none",
|
| 29 |
+
"dry_run": false,
|
| 30 |
+
"dry_steps": 5,
|
| 31 |
+
"finalize_only": false
|
| 32 |
+
},
|
| 33 |
+
"base_model": "convaiinnovations/laya",
|
| 34 |
+
"base_revision": "1c5edc17a7acd8701df6fc341c0d179f1c62c982",
|
| 35 |
+
"base_model_dir": "/Users/brian/.cache/huggingface/hub/models--convaiinnovations--laya/snapshots/1c5edc17a7acd8701df6fc341c0d179f1c62c982",
|
| 36 |
+
"dataset": "tasksource/logical-fallacy",
|
| 37 |
+
"dataset_revision": "37e9b0537a86e72e9eaf6ee8c9a27d872a944103",
|
| 38 |
+
"env": {
|
| 39 |
+
"laya": "0.3.5",
|
| 40 |
+
"torch": "2.14.0",
|
| 41 |
+
"transformers": "5.17.0",
|
| 42 |
+
"datasets": "5.0.1",
|
| 43 |
+
"safetensors": "0.8.0",
|
| 44 |
+
"numpy": "2.5.3"
|
| 45 |
+
},
|
| 46 |
+
"epochs": [
|
| 47 |
+
{
|
| 48 |
+
"epoch": 1,
|
| 49 |
+
"avg_loss": 1.9571953387693926
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"epoch": 2,
|
| 53 |
+
"avg_loss": 1.4149250892075624
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"epoch": 3,
|
| 57 |
+
"avg_loss": 0.9954640326174823
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"epoch": 4,
|
| 61 |
+
"avg_loss": 0.7398663367737424
|
| 62 |
+
}
|
| 63 |
+
],
|
| 64 |
+
"fitted_temperatures": [
|
| 65 |
+
1.8769,
|
| 66 |
+
1.2,
|
| 67 |
+
1.2
|
| 68 |
+
],
|
| 69 |
+
"val": {
|
| 70 |
+
"accuracy": 0.654320987654321,
|
| 71 |
+
"mean_argmax_confidence": 0.7798909438858307,
|
| 72 |
+
"n": 243
|
| 73 |
+
},
|
| 74 |
+
"test": {
|
| 75 |
+
"accuracy": 0.5048923679060665,
|
| 76 |
+
"mean_argmax_confidence": 0.6494024801860817,
|
| 77 |
+
"n": 511
|
| 78 |
+
},
|
| 79 |
+
"train_items": 2196,
|
| 80 |
+
"device": "mps",
|
| 81 |
+
"amp": false
|
| 82 |
+
}
|