# Parameter trees

`(parameters model)` returns the model's trainable floating-point parameters as
a plist keyed by their full paths. A static list, vector or plist of model roots
is also accepted. Paths are ordered lexically; a tied parameter appears once.
[Buffers](https://sx.041.io/docs/buffers.md) and [frozen parameters](https://sx.041.io/docs/frozen-parameters.md) are outside
this differentiated tree; [tree-merge](https://sx.041.io/docs/tree-merge.md) combines the three subsets
for a complete functional call.

Query the tree inside a traced function, after model paths are assigned. An
early query during top-level loading is refused with `E-FUNC-003`; put an
initializer query in a lambda.

The leaves are tensor values when the tree is used in a traced function. Reading
them does not update the model. Use [functional-call](https://sx.041.io/docs/functional-call.md) to
apply replacement values, and [tree-map](https://sx.041.io/docs/tree-map.md) to construct an update.

Save this as `scalar.sx`:

```sx
(defmodel scalar ()
  (defparam weight (full [] 4.0))
  (lambda (x) (* weight x)))
(defvar model (scalar))
```

Inspect its weight with a bounded probe:

```sh
sexpgpu probe scalar.sx --expr '(getf (parameters model) :model.weight)' --max-elements 100
```

This returns `4.0`. Parameter paths identify values; equal numerical values do
not tie independent parameters.

---

SexpGPU documentation. Every page: https://sx.041.io/llms.txt
