File size: 6,017 Bytes
6b6eb1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
license: apache-2.0
base_model: vllm-sr/d3-lite
pipeline_tag: zero-shot-classification
tags:
- coreai
- apple
- decision-model
- multimodal
- experimental
- vision
- video
---

# d3-lite — experimental Apple Core AI conversion

Community conversion of [vllm-sr/d3-lite](https://huggingface.co/vllm-sr/d3-lite) at revision `a8d25a91ef75552803f7009d25b7bd435991abd9`. Converted by Max Farrell. This is an Apple **Core AI `.aimodel`** bundle for macOS 27, with its text backbone, original 255-way answer readout, and vision encoder. Choice, yes/no (noul), and score questions run through Core AI; tokenization, media decoding, and result formatting run on the host. No text is generated.

**Experimental, with measured numerical drift.** All 10 smoke cases selected the same answer as the official BF16 PyTorch runtime on identical resized inputs. The largest absolute probability difference was **0.053441**. These are small conversion smoke tests, not a quality benchmark, calibration result, or evidence of equivalence on arbitrary inputs. Fixed-capacity padding and Core AI's BF16 execution can change probabilities and may change decisions on other inputs. The initial 0.02 probability-parity target was not met by every model; the full values are reported rather than claimed as strict numerical parity.

## Capacity and changes from upstream

- One question per forward pass; `system_one` processes several questions sequentially.
- **512 combined tokens**, including visual tokens and all prompt text. Oversized requests raise an error; nothing is truncated.
- Images and sampled video frames are resized to **224×224**, including aspect-ratio changes. Each image or two-frame video patch group occupies 49 visual tokens. This is much smaller than upstream's default image/video resolution.
- Multiple images/videos work only when their complete prompt fits. Video decoding retains upstream's 2-fps sampling, at least 4 and at most 32 frames; long sampled clips may exceed the 512-token limit and are rejected.
- Up to 255 answer codes are retained; the prompt capacity generally limits practical option count well before 255.
- The original **BF16 backbone weights** and **FP32 decision head** are retained. Linear attention stays causal; full attention remains noncausal as upstream specifies.
- Default specialization was tested on this Mac. Forced CPU-only specialization crashed inside Apple's compiler during development. **No verified Neural Engine/GPU placement, iPhone compatibility, speedup, or power-efficiency claim.**

## Use

```bash
hf download maxffarrell/d3-lite-CoreAI --local-dir d3-lite-CoreAI
cd d3-lite-CoreAI
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

```python
import asyncio
from coreai_d3 import D3CoreAI

async def main():
    model = await D3CoreAI.load(".")
    result = await model.system_one(
        state="The customer was charged twice.",
        questions={"route": {
            "type": "choice",
            "instructions": "Which team should handle this?",
            "criteria": {"billing": "Payments", "shipping": "Delivery"}
        }},
        # images=["receipt.png"],
        # videos=["clip.mp4"],
    )
    print(result)

asyncio.run(main())
```

All neural inference in this adapter uses `decision.aimodel` and `vision.aimodel`. PyTorch/Transformers are dependencies for conversion and host preprocessing; source PyTorch weights are not included or needed for inference. Core AI may write a local specialization cache on first load. The adapter uses the upstream prompt formatter and typed response shapes.

## Validation

macOS 27.0.1, `coreai-core==1.0.0b3`, default specialization. The BF16 reference uses Transformers 5.17.0 and the pinned upstream checkpoint. Images and video are compared using the same 224×224 input pixels, not against upstream's original full-resolution run. Text includes choice, noul, score, Spanish, 10 options, and a 433-token case. Additional checks cover one image, two images, video, and rejecting oversized text. End-to-end `system_one` is separately smoke-tested without loading source weights.

| Case | Tokens | Options | Selected answer matches | Max probability difference |
| --- | ---: | ---: | --- | ---: |
| text / choice | 95 | 3 | Yes | 0.000897 |
| text / noul | 97 | 2 | Yes | 0.000091 |
| text / score | 102 | 4 | Yes | 0.003587 |
| text / choice | 106 | 3 | Yes | 0.000008 |
| text / choice | 149 | 10 | Yes | 0.002151 |
| text / choice | 433 | 2 | Yes | 0.000111 |
| image / choice | 145 | 3 | Yes | 0.000150 |
| image / noul | 145 | 2 | Yes | 0.053441 |
| images / noul | 196 | 2 | Yes | 0.040241 |
| video / choice | 340 | 3 | Yes | 0.011449 |

See `validation.json` for per-case records. Its elapsed times include reference work and are **not inference benchmarks**.

## Reproduce

Download the exact source revision, convert, and reassemble into a fresh output directory:

```bash
hf download vllm-sr/d3-lite --revision a8d25a91ef75552803f7009d25b7bd435991abd9 --local-dir upstream/d3-lite
python convert.py --source upstream/d3-lite --output bundles/d3-lite-CoreAI --length 512 --precision bfloat16
python package.py d3-lite
python validate_mm.py d3-lite
```

`coreai-torch==0.4.3` warns that PyTorch 2.14.0 is newer than its validated range; the supplied environment is the version used for these exports and smoke tests. `UPSTREAM_MANIFEST.json` describes original source files; `SHA256SUMS` verifies this converted bundle.

## Attribution and license

Original model: vLLM Semantic Router Team, based on the Qwen model identified in `UPSTREAM_NOTICE`. Original model and this conversion are Apache-2.0; see `LICENSE` and `NOTICE`. The prompt contract and host decision formatting/media loader are included from the pinned upstream source. The upstream runtime contains an Apache-2.0 noncausal attention hook adapted from Perplexity AI and retains its original attribution. This is an independent community conversion, not an official Apple or vLLM release.