Skip to content

Commit e4367a9

Browse files
authored
Merge branch 'main' into patch-1
2 parents d6922b5 + 11243c3 commit e4367a9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

_quarto.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ website:
134134
- developers/inference/variational-inference/index.qmd
135135
- developers/inference/implementing-samplers/index.qmd
136136

137+
- faq/index.qmd
138+
137139
back-to-top-navigation: true
138140
repo-url: https://github.com/TuringLang/docs
139141
repo-actions: [edit, issue]

faq/index.qmd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ sample(m2, NUTS(), 100) # This doesn't work!
4141
The key insight is that `filldist` creates a single distribution (not N independent distributions), which is why you cannot condition on individual elements. The distinction is not just about what appears on the LHS of `~`, but whether you're dealing with separate distributions (`.~` with univariate) or a single distribution over multiple values (`~` with multivariate or `filldist`).
4242

4343
To understand more about how Turing determines whether a variable is treated as random or observed, see:
44+
4445
- [Core Functionality]({{< meta core-functionality >}}) - basic explanation of the `~` notation and conditioning
4546

4647

@@ -50,6 +51,7 @@ Yes, but with important caveats! There are two types of parallelism to consider:
5051

5152
### 1. Parallel Sampling (Multiple Chains)
5253
Turing.jl fully supports sampling multiple chains in parallel:
54+
5355
- **Multithreaded sampling**: Use `MCMCThreads()` to run one chain per thread
5456
- **Distributed sampling**: Use `MCMCDistributed()` for distributed computing
5557

@@ -69,6 +71,7 @@ end
6971
```
7072

7173
**Important limitations:**
74+
7275
- **Observe statements**: Generally safe to use in threaded loops
7376
- **Assume statements** (sampling statements): Often crash unpredictably or produce incorrect results
7477
- **AD backend compatibility**: Many AD backends don't support threading. Check the [multithreaded column in ADTests](https://turinglang.org/ADTests/) for compatibility
@@ -78,12 +81,14 @@ For safe parallelism within models, consider vectorized operations instead of ex
7881
## How do I check the type stability of my Turing model?
7982

8083
Type stability is crucial for performance. Check out:
84+
8185
- [Performance Tips]({{< meta usage-performance-tips >}}) - includes specific advice on type stability
8286
- Use `DynamicPPL.DebugUtils.model_warntype` to check type stability of your model
8387

8488
## How do I debug my Turing model?
8589

8690
For debugging both statistical and syntactical issues:
91+
8792
- [Troubleshooting Guide]({{< meta usage-troubleshooting >}}) - common errors and their solutions
8893
- For more advanced debugging, DynamicPPL provides [the `DynamicPPL.DebugUtils` module](https://turinglang.org/DynamicPPL.jl/stable/api/#Debugging-Utilities) for inspecting model internals
8994

@@ -125,16 +130,18 @@ end
125130
## Which automatic differentiation backend should I use?
126131

127132
The choice of AD backend can significantly impact performance. See:
133+
128134
- [Automatic Differentiation Guide]({{< meta usage-automatic-differentiation >}}) - comprehensive comparison of ForwardDiff, Mooncake, ReverseDiff, and other backends
129135
- [Performance Tips]({{< meta usage-performance-tips >}}#choose-your-ad-backend) - quick guide on choosing backends
130136
- [AD Backend Benchmarks](https://turinglang.org/ADTests/) - performance comparisons across various models
131137

132138
## I changed one line of my model and now it's so much slower; why?
133139

134140
Small changes can have big performance impacts. Common culprits include:
141+
135142
- Type instability introduced by the change
136143
- Switching from vectorized to scalar operations (or vice versa)
137144
- Inadvertently causing AD backend incompatibilities
138145
- Breaking assumptions that allowed compiler optimizations
139146

140-
See our [Performance Tips]({{< meta usage-performance-tips >}}) and [Troubleshooting Guide]({{< meta usage-troubleshooting >}}) for debugging performance regressions.
147+
See our [Performance Tips]({{< meta usage-performance-tips >}}) and [Troubleshooting Guide]({{< meta usage-troubleshooting >}}) for debugging performance regressions.

0 commit comments

Comments
 (0)