diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..f05909f --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,16 @@ +cff-version: 1.2.0 +message: "If you use DecisionFormer in your work, please cite it as below." +title: "DecisionFormer: Fine-tune, load and serve one-pass decision models on Hugging Face transformers" +type: software +authors: + - name: "FrontiersMind AI" +repository-code: "https://github.com/FrontiersMindAI/decisionformer" +license: Apache-2.0 +version: "0.2.0" +date-released: "2026-10-24" +keywords: + - decision models + - classification + - calibration + - transformers + - fine-tuning diff --git a/README.md b/README.md index 8dc6887..1324e56 100644 --- a/README.md +++ b/README.md @@ -324,9 +324,10 @@ truncate and refuse what does not fit instead. Bidirectional mode uses transformers' own switches (`is_causal=False` on the text decoder only), so SDPA, flash and sliding-window kernels all respect it, and a vision tower keeps its own attention. Conformance tests -check every family in `tests/test_attention.py`. Compare against a causal baseline before adopting it: in our -MNLI tests, SmolLM2-360M made bidirectional without adaptation stayed near chance where causal reached 0.80 -(`docs/benchmarks.md`). +check every family in `tests/test_attention.py`. Compare against a causal baseline before adopting it: a causally +pretrained decoder made bidirectional loses most of what it knows. On deciformer-15k, Qwen3-0.6B reached 0.45 after +50 steps with bidirectional attention against 0.67 with causal attention, and on MNLI SmolLM2-360M stayed near +chance where causal reached 0.80 (`docs/benchmarks.md`). ### Multi-GPU (DDP) @@ -400,3 +401,17 @@ image and video inputs, and more heads (`multi_label`, `regression`). Apache-2.0. The option-code readout, prompt layouts, calibration metrics and near-duplicate checks are adapted from [AutoJev](https://github.com/denis-pplx/autojev) (MIT; see `NOTICE`). The `d3` prompt and checkpoint contract follow Decision 3.0 ([`vllm-sr/d3`](https://huggingface.co/vllm-sr/d3)). + +## Citation + +If you use DecisionFormer in your work, please cite it: + +```bibtex +@software{decisionformer2026, + title = {{DecisionFormer}: Fine-tune, load and serve one-pass decision models on Hugging Face transformers}, + author = {{FrontiersMind AI}}, + year = {2026}, + url = {https://github.com/FrontiersMindAI/decisionformer}, + note = {Version 0.2} +} +``` diff --git a/docs/benchmarks.md b/docs/benchmarks.md index 330a84e..3cf2f40 100644 --- a/docs/benchmarks.md +++ b/docs/benchmarks.md @@ -35,6 +35,19 @@ bidirectional attention and a mean pooler (0.84 above). With bidirectional atten (the Decision 3.0 layout, the default since v0.2), a 40-step QLoRA check on deciformer-15k showed the same loss spike near step 20 (1.55 → 2.04 → 1.23) and 0.41 dev accuracy on 128 records, so no Qwen3.5 recipe ships yet. +**Bidirectional attention on a smaller decoder.** Three 50-step LoRA runs of the `deciformer15k_qwen3` recipe +(Qwen3-0.6B, deciformer-15k, 256 dev records), identical except for attention and pooling: + +| attention | pooler | train loss, step 10 → 50 | dev accuracy | +|---|---|---|---| +| causal | last token | 1.55 → 0.73 | **0.672** | +| bidirectional | last token (the Decision 3.0 layout) | 2.89 → 1.27 | 0.449 | +| bidirectional | mean | 2.63 → 1.25 | 0.441 | + +Switching a causally pretrained decoder to bidirectional attention starts it from a much worse point (gradient +norms 3-5x larger with the last-token readout) and it learns far more slowly, on Qwen3 as on Qwen3.5 and SmolLM2 +(v0.1, below). Bidirectional decoders need a long adaptation stage before they compete; keep `causal` otherwise. + **Parity with the Decision 3.0 reference runtime.** `AutoDecisionModel.from_pretrained("vllm-sr/d3-edge")` against the checkpoint's own `trust_remote_code` runtime, BF16, four requests (choice, noul and score questions, an empty state, a JSON state, a 32-option choice): one question per forward pass, the probabilities are identical (maximum